Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend intra-doc links documentation #74436

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/doc/rustdoc/src/unstable-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down