Skip to content

Commit 9eccc58

Browse files
committed
add trait@, union@, value@, macro@
1 parent 8f5be35 commit 9eccc58

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

text/1946-intra-rustdoc-links.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,24 +292,37 @@ Our proposal is this:
292292
Non-disambiguated paths cannot be used to link to macros.
293293
- Links to types can be disambiguated by prefixing them with the concrete
294294
item type:
295+
- Links to any type-namespace object can be prefixed with `type@`,
296+
e.g., `See [type@foo]`. This will work for structs, enums, mods, traits,
297+
and unions.
295298
- Links to `struct`s can be prefixed with `struct@`,
296299
e.g., `See [struct@Foo]`.
297300
- Links to `enum`s can be prefixed with `enum@`,
298301
e.g., `See [enum@foo]`.
299-
- Links to type aliases can be prefixed with `type@`,
300-
e.g., `See [type@foo]`.
301302
- Links to modules can be prefixed with `mod@`,
302303
e.g., `See [mod@foo]`.
304+
- Links to traits can be prefixed with `trait@`,
305+
e.g., `See [trait@foo]`.
306+
- Links to unions can be prefixed with `union@`,
307+
e.g., `See [union@foo]`.
308+
- It is possible that disambiguators for one kind of type-namespace object
309+
will work for the other (i.e. you can use `struct@` to refer to an enum),
310+
but do not rely on this.
303311
- In links to macros,
304312
the link label _must_ end with a `!`,
305-
e.g., `Look at the [FOO!] macro`.
313+
e.g., `Look at the [FOO!] macro`. You can alternatively use a `foo@` prefix,
314+
e.g. `[macro@foo]`
306315
- For disambiguating links to values, we differentiate three cases:
316+
- Links to any kind of value (function, const, static) can be prefixed with `value@`,
317+
e.g., `See [value@foo]`.
307318
- Links to functions can be written with a `()` suffix,
308319
e.g., `Also see the [foo()] function`.
309320
- Links to constants are prefixed with `const@`,
310321
e.g., `As defined in [const@FOO].`
311322
- Links to statics are prefixed with `static@`,
312323
e.g., `See [static@FOO]`.
324+
- It is possible that disambiguators for one kind of type-namespace object
325+
will work for the other (i.e. you can use `static@` to refer to a const),
313326

314327
For disambiguation markers using an `@`, in implied shortcut links
315328
you can use a space instead of the `@`. In other words, `[struct Foo]`

0 commit comments

Comments
 (0)