diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-07-05 21:20:31 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-07-05 21:40:02 -0400 |
| commit | e46c18768e3c0f046942b907d32b3c02c100b163 (patch) | |
| tree | c94021760b3e8a5539233c589f7b806250479aa6 /src/test/rustdoc | |
| parent | f844ea1e561475e6023282ef167e76bc973773ef (diff) | |
| download | rust-e46c18768e3c0f046942b907d32b3c02c100b163.tar.gz rust-e46c18768e3c0f046942b907d32b3c02c100b163.zip | |
Always resolve type@primitive as a primitive, not a module
Previously, if there were a module in scope with the same name as the
primitive, that would take precedence. Coupled with
https://github.com/rust-lang/rust/issues/58699, this made it impossible
to link to the primitive when that module was in scope.
This approach could be extended so that `struct@foo` would no longer resolve
to any type, etc. However, it could not be used for glob imports:
```rust
pub mod foo {
pub struct Bar;
}
pub enum Bar {}
use foo::*;
// This is expected to link to `inner::Bar`, but instead it will link to the enum.
/// Link to [struct@Bar]
pub struct MyDocs;
```
The reason for this is that this change does not affect the resolution
algorithm of rustc_resolve at all. The only reason we could special-case
primitives is because we have a list of all possible primitives ahead of time.
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/intra-link-prim-precedence.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/rustdoc/intra-link-prim-precedence.rs b/src/test/rustdoc/intra-link-prim-precedence.rs new file mode 100644 index 00000000000..ca83d5e2281 --- /dev/null +++ b/src/test/rustdoc/intra-link-prim-precedence.rs @@ -0,0 +1,12 @@ +// ignore-tidy-linelength +#![deny(intra_doc_resolution_failure)] + +pub mod char {} + +/// See also [type@char] +// @has intra_link_prim_precedence/struct.MyString.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' +pub struct MyString; + +/// See also [char] +// @has intra_link_prim_precedence/struct.MyString2.html '//a/@href' 'intra_link_prim_precedence/char/index.html' +pub struct MyString2; |
