Skip to content

Commit 486a70c

Browse files
ojedaintel-lab-lkp
authored andcommitted
rust: enable rustdoc's --generate-link-to-definition
In Rust 1.56.0 [1], rustdoc introduced the "jump to definition" feature [2], i.e. the unstable flag `--generate-link-to-definition`. It adds links to the source view of the documentation. For instance, in the source view of `rust/kernel/sync.rs`, for this code: impl Default for LockClassKey { fn default() -> Self { Self::new() } } It will add three hyperlinks: - `Default` points to the rendered "Trait `core::default::Default`" page (not the source view, since it goes to another crate, though this may change). - `LockClassKey` points to the `pub struct LockClassKey(...);` line in the same page, highlighting the line number. - `Self::new()` points to the `pub const fn new() -> Self { ... }` associated function, highlighting its line numbers (i.e. for the full function). This makes the source view more useful and a bit closer to the experience in e.g. the Elixir Cross Referencer [3]. I have provisionally enabled it for rust.docs.kernel.org [4] -- one can take a look at the source view there for an example of how it looks like. Thus enable it. Cc: Guillaume Gomez <[email protected]> Link: rust-lang/rust#84176 [1] Link: rust-lang/rust#89095 [2] Link: https://elixir.bootlin.com [3] Link: https://rust.docs.kernel.org [4] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 7c626ce commit 486a70c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

rust/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
6363
OBJTREE=$(abspath $(objtree)) \
6464
$(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \
6565
$(rustc_target_flags) -L$(objtree)/$(obj) \
66+
-Zunstable-options --generate-link-to-definition \
6667
--output $(rustdoc_output) \
6768
--crate-name $(subst rustdoc-,,$@) \
6869
$(if $(rustdoc_host),,--sysroot=/dev/null) \

0 commit comments

Comments
 (0)