]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/impl-generic-mismatch.rs
Remove licenses
[rust.git] / src / test / ui / impl-trait / impl-generic-mismatch.rs
1 // ignore-musl
2 // ignore-x86
3
4 use std::fmt::Debug;
5
6 trait Foo {
7     fn foo(&self, _: &impl Debug);
8 }
9
10 impl Foo for () {
11     fn foo<U: Debug>(&self, _: &U) { }
12     //~^ Error method `foo` has incompatible signature for trait
13 }
14
15 trait Bar {
16     fn bar<U: Debug>(&self, _: &U);
17 }
18
19 impl Bar for () {
20     fn bar(&self, _: &impl Debug) { }
21     //~^ Error method `bar` has incompatible signature for trait
22 }
23
24 // With non-local trait (#49841):
25
26 use std::hash::{Hash, Hasher};
27
28 struct X;
29
30 impl Hash for X {
31     fn hash(&self, hasher: &mut impl Hasher) {}
32     //~^ Error method `hash` has incompatible signature for trait
33 }
34
35 fn main() {}