]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/intra-doc/associated-items.rs
Update unsuspicious file list
[rustc.git] / src / test / rustdoc / intra-doc / associated-items.rs
CommitLineData
a2a8927a 1#![deny(rustdoc::broken_intra_doc_links)]
fc512014
XL
2
3/// [`std::collections::BTreeMap::into_iter`]
4/// [`String::from`] is ambiguous as to which `From` impl
5/// [Vec::into_iter()] uses a disambiguator
17df50a5
XL
6// @has 'associated_items/fn.foo.html' '//a[@href="{{channel}}/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter'
7// @has 'associated_items/fn.foo.html' '//a[@href="{{channel}}/alloc/string/struct.String.html#method.from"]' 'String::from'
8// @has 'associated_items/fn.foo.html' '//a[@href="{{channel}}/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter'
fc512014
XL
9pub fn foo() {}
10
11/// Link to [MyStruct], [link from struct][MyStruct::method], [MyStruct::clone], [MyStruct::Input]
cdc7bbd5
XL
12// @has 'associated_items/struct.MyStruct.html' '//a[@href="struct.MyStruct.html"]' 'MyStruct'
13// @has 'associated_items/struct.MyStruct.html' '//a[@href="struct.MyStruct.html#method.method"]' 'link from struct'
14// @has 'associated_items/struct.MyStruct.html' '//a[@href="struct.MyStruct.html#method.clone"]' 'MyStruct::clone'
15// @has 'associated_items/struct.MyStruct.html' '//a[@href="struct.MyStruct.html#associatedtype.Input"]' 'MyStruct::Input'
fc512014
XL
16pub struct MyStruct { foo: () }
17
18impl Clone for MyStruct {
19 fn clone(&self) -> Self {
20 MyStruct
21 }
22}
23
24pub trait T {
25 type Input;
26 fn method(i: Self::Input);
27}
28
29impl T for MyStruct {
30 type Input = usize;
31
32 /// [link from method][MyStruct::method] on method
cdc7bbd5 33 // @has 'associated_items/struct.MyStruct.html' '//a[@href="struct.MyStruct.html#method.method"]' 'link from method'
fc512014
XL
34 fn method(i: usize) {
35 }
36}
37
38/// Ambiguity between which trait to use
39pub trait T1 {
40 fn ambiguous_method();
41}
42
43pub trait T2 {
44 fn ambiguous_method();
45}
46
47/// Link to [S::ambiguous_method]
48// FIXME: there is no way to disambiguate these.
49// Since we have `#[deny(intra_doc_failure)]`, we still know it was one or the other.
50pub struct S;
51
52impl T1 for S {
53 fn ambiguous_method() {}
54}
55
56impl T2 for S {
57 fn ambiguous_method() {}
58}
59
ee023bcb
FG
60// @has associated_items/enum.MyEnum.html '//a/@href' 'enum.MyEnum.html#variant.MyVariant'
61/// Link to [MyEnumAlias::MyVariant]
62pub enum MyEnum {
63 MyVariant,
64}
65
66pub type MyEnumAlias = MyEnum;
67
fc512014 68fn main() {}