1212
1313extern crate no_method_suggested_traits;
1414
15+ struct Foo ;
16+ enum Bar { X }
17+
1518mod foo {
1619 trait Bar {
1720 fn method ( & self ) { }
@@ -25,23 +28,48 @@ mod foo {
2528}
2629
2730fn main ( ) {
31+ // test the values themselves, and autoderef.
32+
33+
2834 1u32 . method ( ) ;
2935 //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
3036 //~^^ ERROR does not implement
3137 //~^^^ HELP `foo::Bar`
3238 //~^^^^ 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`
3344
3445 'a' . method ( ) ;
3546 //~^ ERROR does not implement
3647 //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
3748 //~^^^ 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`
3853
3954 1i32 . method ( ) ;
4055 //~^ ERROR does not implement
4156 //~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
4257 //~^^^ 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`
4362
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 ( ) ;
4573 //~^ ERROR does not implement
4674 //~^^ HELP following traits define a method `method`, perhaps you need to implement one of them
4775 //~^^^ HELP `foo::Bar`
@@ -55,8 +83,52 @@ fn main() {
5583 //~^ ERROR does not implement
5684 //~^^ HELP the following trait defines a method `method2`, perhaps you need to implement it
5785 //~^^^ HELP `foo::Bar`
58- 1u64 . method3 ( ) ;
86+ std :: rc :: Rc :: new ( & mut Box :: new ( & 1u64 ) ) . method2 ( ) ;
5987 //~^ 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
61119 //~^^^ 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
62134}
0 commit comments