summaryrefslogtreecommitdiffstats
path: root/src/test/ui/codemap_tests/overlapping_inherent_impls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/codemap_tests/overlapping_inherent_impls.rs')
-rw-r--r--src/test/ui/codemap_tests/overlapping_inherent_impls.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/codemap_tests/overlapping_inherent_impls.rs b/src/test/ui/codemap_tests/overlapping_inherent_impls.rs
new file mode 100644
index 000000000..66af21226
--- /dev/null
+++ b/src/test/ui/codemap_tests/overlapping_inherent_impls.rs
@@ -0,0 +1,36 @@
+// Test that you cannot define items with the same name in overlapping inherent
+// impl blocks.
+
+#![allow(unused)]
+
+struct Foo;
+
+impl Foo {
+ fn id() {} //~ ERROR duplicate definitions
+}
+
+impl Foo {
+ fn id() {}
+}
+
+struct Bar<T>(T);
+
+impl<T> Bar<T> {
+ fn bar(&self) {} //~ ERROR duplicate definitions
+}
+
+impl Bar<u32> {
+ fn bar(&self) {}
+}
+
+struct Baz<T>(T);
+
+impl<T: Copy> Baz<T> {
+ fn baz(&self) {} //~ ERROR duplicate definitions
+}
+
+impl<T> Baz<Vec<T>> {
+ fn baz(&self) {}
+}
+
+fn main() {}