about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2022-05-07 15:23:45 +0200
committerGitHub <noreply@github.com>2022-05-07 15:23:45 +0200
commit3346d11f4e8521894377636f145bfc68fad10bea (patch)
tree87cbf3de89ee0de2eaf5969d451b6e52b45d871a /src/test/rustdoc
parentc29f8575acae4b1e533f630b51a639758919911c (diff)
parent3bfa2eb9f09035dcd779910b77880252baaf2ef5 (diff)
downloadrust-3346d11f4e8521894377636f145bfc68fad10bea.tar.gz
rust-3346d11f4e8521894377636f145bfc68fad10bea.zip
Rollup merge of #96636 - GuillaumeGomez:fix-jump-to-def-regression, r=notriddle
Fix jump to def regression

https://github.com/rust-lang/rust/pull/93803 introduced a regression in the "jump to def" feature. This fixes it.

Nice side-effect: it adds a new regression test. :)

I also used this opportunity to add documentation about this unstable feature in the rustdoc book.

cc ``@cjgillot``
r? ``@notriddle``
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/check-source-code-urls-to-def.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/rustdoc/check-source-code-urls-to-def.rs b/src/test/rustdoc/check-source-code-urls-to-def.rs
index ca4179d403d..12c5df2871c 100644
--- a/src/test/rustdoc/check-source-code-urls-to-def.rs
+++ b/src/test/rustdoc/check-source-code-urls-to-def.rs
@@ -46,6 +46,24 @@ pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::Sour
 // @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
 pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {}
 
+pub trait AnotherTrait {}
+pub trait WhyNot {}
+
+// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#49"]' 'AnotherTrait'
+// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#50"]' 'WhyNot'
+pub fn foo3<T, V>(t: &T, v: &V)
+where
+    T: AnotherTrait,
+    V: WhyNot
+{}
+
+pub trait AnotherTrait2 {}
+
+// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#60"]' 'AnotherTrait2'
+pub fn foo4() {
+    let x: Vec<AnotherTrait2> = Vec::new();
+}
+
 // @has - '//a[@href="../../foo/primitive.bool.html"]' 'bool'
 #[doc(primitive = "bool")]
 mod whatever {}