diff options
Diffstat (limited to 'tests/ui/hygiene/impl_items-2.rs')
-rw-r--r-- | tests/ui/hygiene/impl_items-2.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/hygiene/impl_items-2.rs b/tests/ui/hygiene/impl_items-2.rs new file mode 100644 index 000000000..465e444ae --- /dev/null +++ b/tests/ui/hygiene/impl_items-2.rs @@ -0,0 +1,26 @@ +#![feature(decl_macro)] + +trait Trait { + fn foo() {} +} + +macro trait_impl() { + fn foo() {} +} + +// Check that we error on multiple impl items that resolve to the same trait item. +impl Trait for i32 { + trait_impl!(); + fn foo() {} + //~^ ERROR duplicate definitions with name `foo`: [E0201] +} + +struct Type; + +// Check that we do not error with inherent impls. +impl Type { + trait_impl!(); + fn foo() {} +} + +fn main() {} |