diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-16 16:58:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-16 16:58:19 +0100 |
| commit | 682ad02b49d5152501fd19d7816f019e789cf404 (patch) | |
| tree | 8a6bebd38d85025bb038b5b0e4532f967dc77129 /src/test/rustdoc | |
| parent | 9323a0d1bef9b0708e25f0a8abaf5e5f88599f8d (diff) | |
| parent | ae20500d76e36b5e8692af499830c4707f713bc0 (diff) | |
| download | rust-682ad02b49d5152501fd19d7816f019e789cf404.tar.gz rust-682ad02b49d5152501fd19d7816f019e789cf404.zip | |
Rollup merge of #92792 - mdibaiee:92662/fix-intra-doc-generics, r=camelid
rustdoc: fix intra-link for generic trait impls fixes #92662 r? `````@camelid`````
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/intra-doc/extern-type.rs | 24 | ||||
| -rw-r--r-- | src/test/rustdoc/intra-doc/generic-trait-impl.rs | 20 |
2 files changed, 42 insertions, 2 deletions
diff --git a/src/test/rustdoc/intra-doc/extern-type.rs b/src/test/rustdoc/intra-doc/extern-type.rs index f37ae62dde1..ab088ab789d 100644 --- a/src/test/rustdoc/intra-doc/extern-type.rs +++ b/src/test/rustdoc/intra-doc/extern-type.rs @@ -4,14 +4,34 @@ extern { pub type ExternType; } +pub trait T { + fn test(&self) {} +} + +pub trait G<N> { + fn g(&self, n: N) {} +} + impl ExternType { - pub fn f(&self) { + pub fn f(&self) {} +} - } +impl T for ExternType { + fn test(&self) {} +} + +impl G<usize> for ExternType { + fn g(&self, n: usize) {} } // @has 'extern_type/foreigntype.ExternType.html' // @has 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.f"' +// @has 'extern_type/fn.links_to_extern_type.html' \ +// 'href="foreigntype.ExternType.html#method.test"' +// @has 'extern_type/fn.links_to_extern_type.html' \ +// 'href="foreigntype.ExternType.html#method.g"' /// See also [ExternType::f] +/// See also [ExternType::test] +/// See also [ExternType::g] pub fn links_to_extern_type() {} diff --git a/src/test/rustdoc/intra-doc/generic-trait-impl.rs b/src/test/rustdoc/intra-doc/generic-trait-impl.rs new file mode 100644 index 00000000000..ba8595abfa9 --- /dev/null +++ b/src/test/rustdoc/intra-doc/generic-trait-impl.rs @@ -0,0 +1,20 @@ +#![deny(rustdoc::broken_intra_doc_links)] + +// Test intra-doc links on trait implementations with generics +// regression test for issue #92662 + +use std::marker::PhantomData; + +pub trait Bar<T> { + fn bar(&self); +} + +pub struct Foo<U>(PhantomData<U>); + +impl<T, U> Bar<T> for Foo<U> { + fn bar(&self) {} +} + +// @has generic_trait_impl/fn.main.html '//a[@href="struct.Foo.html#method.bar"]' 'Foo::bar' +/// link to [`Foo::bar`] +pub fn main() {} |
