about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-25 09:09:48 +0000
committerbors <bors@rust-lang.org>2022-03-25 09:09:48 +0000
commite70e211e99b3b7a4c3d75ff56598662530828f65 (patch)
tree08ec170499816df13205071fd07d828f8c08de75 /src/test
parent8a0c55046c7092d9e019dad03729e8d32e38df72 (diff)
parent42e986f77ba350f9cb28958d9ef19af06007ac1c (diff)
downloadrust-e70e211e99b3b7a4c3d75ff56598662530828f65.tar.gz
rust-e70e211e99b3b7a4c3d75ff56598662530828f65.zip
Auto merge of #95082 - spastorino:overlap-inherent-impls, r=nikomatsakis
Overlap inherent impls

r? `@nikomatsakis`

Closes #94526
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/coherence/coherence-negative-inherent-where-bounds.rs25
-rw-r--r--src/test/ui/coherence/coherence-negative-inherent.rs22
2 files changed, 47 insertions, 0 deletions
diff --git a/src/test/ui/coherence/coherence-negative-inherent-where-bounds.rs b/src/test/ui/coherence/coherence-negative-inherent-where-bounds.rs
new file mode 100644
index 00000000000..39ccaa6ac35
--- /dev/null
+++ b/src/test/ui/coherence/coherence-negative-inherent-where-bounds.rs
@@ -0,0 +1,25 @@
+// check-pass
+
+#![feature(negative_impls)]
+#![feature(rustc_attrs)]
+#![feature(with_negative_coherence)]
+
+trait Foo {}
+
+impl !Foo for u32 {}
+
+#[rustc_strict_coherence]
+struct MyStruct<T>(T);
+
+impl MyStruct<u32> {
+    fn method(&self) {}
+}
+
+impl<T> MyStruct<T>
+where
+    T: Foo,
+{
+    fn method(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/coherence-negative-inherent.rs b/src/test/ui/coherence/coherence-negative-inherent.rs
new file mode 100644
index 00000000000..a9e1acc8044
--- /dev/null
+++ b/src/test/ui/coherence/coherence-negative-inherent.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+#![feature(negative_impls)]
+#![feature(rustc_attrs)]
+#![feature(with_negative_coherence)]
+
+#[rustc_strict_coherence]
+trait Foo {}
+
+impl !Foo for u32 {}
+
+struct MyStruct<T>(T);
+
+impl<T: Foo> MyStruct<T> {
+    fn method(&self) {}
+}
+
+impl MyStruct<u32> {
+    fn method(&self) {}
+}
+
+fn main() {}