summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2024-08-18 17:12:49 +0300
committerMiguel Ojeda <ojeda@kernel.org>2024-08-25 19:37:40 +0300
commit6e6efc5fef4a1cdcccca3cffd5b73fd25d093352 (patch)
treed66b2671e5d2fc096bee85a0d4cb13922865909f /rust
parentb2bf463ed9a8131ad4e91a11af8c9a4ec84b876a (diff)
downloadlinux-6e6efc5fef4a1cdcccca3cffd5b73fd25d093352.tar.xz
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 <guillaume1.gomez@gmail.com> Link: https://github.com/rust-lang/rust/pull/84176 [1] Link: https://github.com/rust-lang/rust/issues/89095 [2] Link: https://elixir.bootlin.com [3] Link: https://rust.docs.kernel.org [4] Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/20240818141249.387166-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust')
-rw-r--r--rust/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/rust/Makefile b/rust/Makefile
index c24c3689e7b4..e13d14ec5fe7 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -63,6 +63,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
OBJTREE=$(abspath $(objtree)) \
$(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \
$(rustc_target_flags) -L$(objtree)/$(obj) \
+ -Zunstable-options --generate-link-to-definition \
--output $(rustdoc_output) \
--crate-name $(subst rustdoc-,,$@) \
$(if $(rustdoc_host),,--sysroot=/dev/null) \