about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-09-20 02:18:09 -0400
committerJoshua Nelson <jyn514@gmail.com>2020-09-23 21:04:22 -0400
commit472e52e5a03790becdbe21be1002a90dd2d7d3d4 (patch)
tree836bf03336a1fe86d4654436a36231253163b6da /src/test
parentdd7b8c85a6a2bffb2cce1c40ba72680a1d7be93b (diff)
downloadrust-472e52e5a03790becdbe21be1002a90dd2d7d3d4.tar.gz
rust-472e52e5a03790becdbe21be1002a90dd2d7d3d4.zip
Fix intra-doc links for primitives
- Add `PrimTy::name` and `PrimTy::name_str`
- Use those new functions to distinguish between the name in scope and
the canonical name
- Fix diagnostics for primitive types
- Add tests for primitives
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-ui/intra-link-errors.stderr5
-rw-r--r--src/test/rustdoc/primitive-link.rs7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/test/rustdoc-ui/intra-link-errors.stderr b/src/test/rustdoc-ui/intra-link-errors.stderr
index cd06ee6f798..fab8c105a49 100644
--- a/src/test/rustdoc-ui/intra-link-errors.stderr
+++ b/src/test/rustdoc-ui/intra-link-errors.stderr
@@ -80,10 +80,7 @@ error: unresolved link to `u8::not_found`
   --> $DIR/intra-link-errors.rs:55:6
    |
 LL | /// [u8::not_found]
-   |      ^^^^^^^^^^^^^
-   |      |
-   |      the builtin type `u8` does not have an associated item named `not_found`
-   |      the builtin type `u8` has no builtin type named `not_found`
+   |      ^^^^^^^^^^^^^ the builtin type `u8` does not have an associated item named `not_found`
 
 error: unresolved link to `S`
   --> $DIR/intra-link-errors.rs:59:6
diff --git a/src/test/rustdoc/primitive-link.rs b/src/test/rustdoc/primitive-link.rs
index 819ef05174a..8f69b894a22 100644
--- a/src/test/rustdoc/primitive-link.rs
+++ b/src/test/rustdoc/primitive-link.rs
@@ -4,6 +4,13 @@
 
 // @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.u32.html"]' 'u32'
 // @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i64.html"]' 'i64'
+// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html"]' 'std::primitive::i32'
+// @has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html"]' 'std::primitive::str'
+
+// FIXME: this doesn't resolve
+// @ has foo/struct.Foo.html '//*[@class="docblock"]/p/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' 'std::primitive::i32::MAX'
 
 /// It contains [`u32`] and [i64].
+/// It also links to [std::primitive::i32], [std::primitive::str],
+/// and [`std::primitive::i32::MAX`].
 pub struct Foo;