]> git.proxmox.com Git - rustc.git/blob - src/test/ui/impl-trait/impl-generic-mismatch.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / 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 // With non-local trait (#49841):
22
23 use std::hash::{Hash, Hasher};
24
25 struct X;
26
27 impl Hash for X {
28 fn hash(&self, hasher: &mut impl Hasher) {}
29 //~^ Error method `hash` has incompatible signature for trait
30 }
31
32 fn main() {}