12
12
13
13
extern crate no_method_suggested_traits;
14
14
15
+ struct Foo ;
16
+ enum Bar { X }
17
+
15
18
mod foo {
16
19
trait Bar {
17
20
fn method ( & self ) { }
@@ -25,23 +28,48 @@ mod foo {
25
28
}
26
29
27
30
fn main ( ) {
31
+ // test the values themselves, and autoderef.
32
+
33
+
28
34
1u32 . method ( ) ;
29
35
//~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
30
36
//~^^ ERROR does not implement
31
37
//~^^^ HELP `foo::Bar`
32
38
//~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
39
+ std:: rc:: Rc :: new ( & mut Box :: new ( & 1u32 ) ) . method ( ) ;
40
+ //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
41
+ //~^^ ERROR does not implement
42
+ //~^^^ HELP `foo::Bar`
43
+ //~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
33
44
34
45
'a' . method ( ) ;
35
46
//~^ ERROR does not implement
36
47
//~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
37
48
//~^^^ HELP `foo::Bar`
49
+ std:: rc:: Rc :: new ( & mut Box :: new ( & 'a' ) ) . method ( ) ;
50
+ //~^ ERROR does not implement
51
+ //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
52
+ //~^^^ HELP `foo::Bar`
38
53
39
54
1i32 . method ( ) ;
40
55
//~^ ERROR does not implement
41
56
//~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
42
57
//~^^^ HELP `no_method_suggested_traits::foo::PubPub`
58
+ std:: rc:: Rc :: new ( & mut Box :: new ( & 1i32 ) ) . method ( ) ;
59
+ //~^ ERROR does not implement
60
+ //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
61
+ //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
43
62
44
- 1u64 . method ( ) ;
63
+ Foo . method ( ) ;
64
+ //~^ ERROR does not implement
65
+ //~^^ HELP following traits define a method `method`, perhaps you need to implement one of them
66
+ //~^^^ HELP `foo::Bar`
67
+ //~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
68
+ //~^^^^^ HELP `no_method_suggested_traits::reexport::Reexported`
69
+ //~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv`
70
+ //~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub`
71
+ //~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv`
72
+ std:: rc:: Rc :: new ( & mut Box :: new ( & Foo ) ) . method ( ) ;
45
73
//~^ ERROR does not implement
46
74
//~^^ HELP following traits define a method `method`, perhaps you need to implement one of them
47
75
//~^^^ HELP `foo::Bar`
@@ -55,8 +83,52 @@ fn main() {
55
83
//~^ ERROR does not implement
56
84
//~^^ HELP the following trait defines a method `method2`, perhaps you need to implement it
57
85
//~^^^ HELP `foo::Bar`
58
- 1u64 . method3 ( ) ;
86
+ std :: rc :: Rc :: new ( & mut Box :: new ( & 1u64 ) ) . method2 ( ) ;
59
87
//~^ ERROR does not implement
60
- //~^^ HELP the following trait defines a method `method3`, perhaps you need to implement it
88
+ //~^^ HELP the following trait defines a method `method2`, perhaps you need to implement it
89
+ //~^^^ HELP `foo::Bar`
90
+
91
+ no_method_suggested_traits:: Foo . method2 ( ) ;
92
+ //~^ ERROR does not implement
93
+ //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it
94
+ //~^^^ HELP `foo::Bar`
95
+ std:: rc:: Rc :: new ( & mut Box :: new ( & no_method_suggested_traits:: Foo ) ) . method2 ( ) ;
96
+ //~^ ERROR does not implement
97
+ //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it
98
+ //~^^^ HELP `foo::Bar`
99
+ no_method_suggested_traits:: Bar :: X . method2 ( ) ;
100
+ //~^ ERROR does not implement
101
+ //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it
102
+ //~^^^ HELP `foo::Bar`
103
+ std:: rc:: Rc :: new ( & mut Box :: new ( & no_method_suggested_traits:: Bar :: X ) ) . method2 ( ) ;
104
+ //~^ ERROR does not implement
105
+ //~^^ HELP following trait defines a method `method2`, perhaps you need to implement it
106
+ //~^^^ HELP `foo::Bar`
107
+
108
+ Foo . method3 ( ) ;
109
+ //~^ ERROR does not implement
110
+ //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it
111
+ //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
112
+ std:: rc:: Rc :: new ( & mut Box :: new ( & Foo ) ) . method3 ( ) ;
113
+ //~^ ERROR does not implement
114
+ //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it
115
+ //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
116
+ Bar :: X . method3 ( ) ;
117
+ //~^ ERROR does not implement
118
+ //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it
61
119
//~^^^ HELP `no_method_suggested_traits::foo::PubPub`
120
+ std:: rc:: Rc :: new ( & mut Box :: new ( & Bar :: X ) ) . method3 ( ) ;
121
+ //~^ ERROR does not implement
122
+ //~^^ HELP following trait defines a method `method3`, perhaps you need to implement it
123
+ //~^^^ HELP `no_method_suggested_traits::foo::PubPub`
124
+
125
+ // should have no help:
126
+ 1 us. method3 ( ) ; //~ ERROR does not implement
127
+ std:: rc:: Rc :: new ( & mut Box :: new ( & 1 us) ) . method3 ( ) ; //~ ERROR does not implement
128
+ no_method_suggested_traits:: Foo . method3 ( ) ; //~ ERROR does not implement
129
+ std:: rc:: Rc :: new ( & mut Box :: new ( & no_method_suggested_traits:: Foo ) ) . method3 ( ) ;
130
+ //~^ ERROR does not implement
131
+ no_method_suggested_traits:: Bar :: X . method3 ( ) ; //~ ERROR does not implement
132
+ std:: rc:: Rc :: new ( & mut Box :: new ( & no_method_suggested_traits:: Bar :: X ) ) . method3 ( ) ;
133
+ //~^ ERROR does not implement
62
134
}
0 commit comments