diff options
Diffstat (limited to 'src/test/ui/impl-trait/type-arg-mismatch-due-to-impl-trait.rs')
-rw-r--r-- | src/test/ui/impl-trait/type-arg-mismatch-due-to-impl-trait.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/type-arg-mismatch-due-to-impl-trait.rs b/src/test/ui/impl-trait/type-arg-mismatch-due-to-impl-trait.rs new file mode 100644 index 000000000..ecfa5c69e --- /dev/null +++ b/src/test/ui/impl-trait/type-arg-mismatch-due-to-impl-trait.rs @@ -0,0 +1,16 @@ +trait Foo { + type T; + fn foo(&self, t: Self::T); +//~^ NOTE expected 0 type parameters +} + +impl Foo for u32 { + type T = (); + + fn foo(&self, t: impl Clone) {} +//~^ ERROR method `foo` has 1 type parameter but its trait declaration has 0 type parameters +//~| NOTE found 1 type parameter +//~| NOTE `impl Trait` introduces an implicit type parameter +} + +fn main() {} |