|
| 1 | +// ignore-tidy-linelength |
| 2 | +#![deny(intra_doc_link_resolution_failure)] |
| 3 | + |
| 4 | +/// [`std::collections::BTreeMap::into_iter`] |
| 5 | +/// [`String::from`] is ambiguous as to which `From` impl |
| 6 | +/// [Vec::into_iter()] uses a disambiguator |
| 7 | +// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter' |
| 8 | +// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from"]' 'String::from' |
| 9 | +// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter' |
| 10 | +pub fn foo() {} |
| 11 | + |
| 12 | +/// Link to [MyStruct], [link from struct][MyStruct::method], [MyStruct::clone], [MyStruct::Input] |
| 13 | +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html"]' 'MyStruct' |
| 14 | +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.method"]' 'link from struct' |
| 15 | +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.clone"]' 'MyStruct::clone' |
| 16 | +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#associatedtype.Input"]' 'MyStruct::Input' |
| 17 | +pub struct MyStruct { foo: () } |
| 18 | + |
| 19 | +impl Clone for MyStruct { |
| 20 | + fn clone(&self) -> Self { |
| 21 | + MyStruct |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +pub trait T { |
| 26 | + type Input; |
| 27 | + fn method(i: Self::Input); |
| 28 | +} |
| 29 | + |
| 30 | +impl T for MyStruct { |
| 31 | + type Input = usize; |
| 32 | + |
| 33 | + /// [link from method][MyStruct::method] on method |
| 34 | + // @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.method"]' 'link from method' |
| 35 | + fn method(i: usize) { |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +/// Ambiguity between which trait to use |
| 40 | +pub trait T1 { |
| 41 | + fn ambiguous_method(); |
| 42 | +} |
| 43 | + |
| 44 | +pub trait T2 { |
| 45 | + fn ambiguous_method(); |
| 46 | +} |
| 47 | + |
| 48 | +/// Link to [S::ambiguous_method] |
| 49 | +// FIXME: there is no way to disambiguate these. |
| 50 | +// Since we have `#[deny(intra_doc_failure)]`, we still know it was one or the other. |
| 51 | +pub struct S; |
| 52 | + |
| 53 | +impl T1 for S { |
| 54 | + fn ambiguous_method() {} |
| 55 | +} |
| 56 | + |
| 57 | +impl T2 for S { |
| 58 | + fn ambiguous_method() {} |
| 59 | +} |
| 60 | + |
| 61 | +fn main() {} |
0 commit comments