]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/impl-generic-mismatch.rs
Auto merge of #106742 - compiler-errors:new-solver-make-it-not-ice, r=lcnr
[rust.git] / tests / ui / impl-trait / impl-generic-mismatch.rs
1 use std::fmt::Debug;
2
3 trait Foo {
4     fn foo(&self, _: &impl Debug);
5 }
6
7 impl Foo for () {
8     fn foo<U: Debug>(&self, _: &U) { }
9     //~^ Error method `foo` has incompatible signature for trait
10 }
11
12 trait Bar {
13     fn bar<U: Debug>(&self, _: &U);
14 }
15
16 impl Bar for () {
17     fn bar(&self, _: &impl Debug) { }
18     //~^ Error method `bar` has incompatible signature for trait
19 }
20
21 trait Baz {
22     fn baz<U: Debug, T: Debug>(&self, _: &U, _: &T);
23 }
24
25 impl Baz for () {
26     fn baz<T: Debug>(&self, _: &impl Debug, _: &T) { }
27     //~^ Error method `baz` has incompatible signature for trait
28 }
29
30 // With non-local trait (#49841):
31
32 use std::hash::{Hash, Hasher};
33
34 struct X;
35
36 impl Hash for X {
37     fn hash(&self, hasher: &mut impl Hasher) {}
38     //~^ Error method `hash` has incompatible signature for trait
39 }
40
41 fn main() {}