From 9a6a2dd943a582af6666b97ce99f3ca1a0bbec12 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 17 Jul 2020 13:48:49 +0200 Subject: [PATCH] Extend intra-doc links documentation --- src/doc/rustdoc/src/unstable-features.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index eea674f2b84b9..16bc6f3db9c3e 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -95,6 +95,14 @@ fn Foo() {} Note: Because of how `macro_rules` macros are scoped in Rust, the intra-doc links of a `macro_rules` macro will be resolved relative to the crate root, as opposed to the module it is defined in. +Anchors can be used alongside intra-doc link features. It's very useful in case you want to target a trait implementation or any element in the target's page. For example, we want to link to an implementation the `Debug` trait in the `std` documentation: + +```rust +/// The implementation of [`Debug`] on [`CpuidResult`] can be +/// found [here](Debug#impl-Debug-for-CpuidResult). +mod foo {} +``` + ## Extensions to the `#[doc]` attribute These features operate by extending the `#[doc]` attribute, and thus can be caught by the compiler