diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-26 18:11:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-26 18:11:13 +0200 |
| commit | 67d88f93cd193312ca7f5258b6aac3f4365f1d5e (patch) | |
| tree | 96707ec6c98d570d7ef3d5c04c641e273326b283 /src | |
| parent | e504c108df2f87eb8a696012394940d956646331 (diff) | |
| parent | 62c457bb02488dc6df95c574f34dd0ce444475dd (diff) | |
| download | rust-67d88f93cd193312ca7f5258b6aac3f4365f1d5e.tar.gz rust-67d88f93cd193312ca7f5258b6aac3f4365f1d5e.zip | |
Rollup merge of #147027 - GuillaumeGomez:tyalias-disambiguator, r=lolbinarycat
Add new `tyalias` intra-doc link disambiguator Fixes https://github.com/rust-lang/rust/issues/146855. Alternative to rust-lang/rust#146866. This adds support for a new disambiguator: `tyalias`. I think it's common enough to have type aliases nowaday, so no reason to not be able to have a disambiguator for them. cc ``@fmease`` r? lolbinarycat
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md | 2 | ||||
| -rw-r--r-- | src/librustdoc/passes/collect_intra_doc_links.rs | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md index 5e785483402..b1495b2575e 100644 --- a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md +++ b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md @@ -90,7 +90,7 @@ fn Foo() {} These prefixes will be stripped when displayed in the documentation, so `[struct@Foo]` will be rendered as `Foo`. The following prefixes are available: `struct`, `enum`, `trait`, `union`, `mod`, `module`, `const`, `constant`, `fn`, `function`, `field`, `variant`, `method`, `derive`, -`type`, `value`, `macro`, `prim` or `primitive`. +`type`, `value`, `macro`, `tyalias`, `typealias`, `prim` or `primitive`. You can also disambiguate for functions by adding `()` after the function name, or for macros by adding `!` after the macro name. The macro `!` can be followed by `()`, `{}`, diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 0da42f38251..79d74c3c4eb 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -130,6 +130,7 @@ impl Res { DefKind::Static { .. } => "static", DefKind::Field => "field", DefKind::Variant | DefKind::Ctor(..) => "variant", + DefKind::TyAlias => "tyalias", // Now handle things that don't have a specific disambiguator _ => match kind .ns() @@ -1708,6 +1709,7 @@ impl Disambiguator { "value" => NS(Namespace::ValueNS), "macro" => NS(Namespace::MacroNS), "prim" | "primitive" => Primitive, + "tyalias" | "typealias" => Kind(DefKind::TyAlias), _ => return Err((format!("unknown disambiguator `{prefix}`"), 0..idx)), }; |
