]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/negative-impls/explicitly-unimplemented-error-message.rs
Move `{core,std}::stream::Stream` to `{core,std}::async_iter::AsyncIterator`.
[rust.git] / src / test / ui / traits / negative-impls / explicitly-unimplemented-error-message.rs
1 // This tests issue #79683: note in the error message that the trait is
2 // explicitely unimplemented instead of suggesting to implement it.
3
4 #![feature(negative_impls)]
5
6 struct Qux;
7 //~^ NOTE method `clone` not found for this
8 //~^^ NOTE method `foo` not found for this
9
10 impl !Clone for Qux {}
11
12 trait Bar {
13     fn bar(&self);
14 }
15
16 impl !Bar for u32 {}
17
18 trait Foo {
19     fn foo(&self);
20 }
21 //~^^^ NOTE `Foo` defines an item `foo`, perhaps you need to implement it
22
23 trait FooBar {
24     fn foo(&self);
25 }
26
27 impl !Foo for Qux {}
28
29 impl !FooBar for Qux {}
30
31 impl !FooBar for u32 {}
32
33 fn main() {
34     Qux.clone();
35     //~^ ERROR no method named `clone` found for struct `Qux`
36     //~| NOTE method not found in `Qux`
37     //~| NOTE `Clone` defines an item `clone`, but is explicitely unimplemented
38
39     0_u32.bar();
40     //~^ ERROR no method named `bar` found for type `u32`
41     //~| NOTE method not found in `u32`
42     //~| NOTE `Bar` defines an item `bar`, but is explicitely unimplemented
43
44     Qux.foo();
45     //~^ ERROR no method named `foo` found for struct `Qux`
46     //~| NOTE method not found in `Qux`
47     //~| NOTE the following traits define an item `foo`, but are explicitely unimplemented
48
49     0_u32.foo();
50     //~^ ERROR no method named `foo` found for type `u32`
51     //~| NOTE method not found in `u32`
52     //~| NOTE `FooBar` defines an item `foo`, but is explicitely unimplemented
53 }