about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-10-30 19:10:35 +0000
committerMichael Goulet <michael@errs.io>2022-10-30 19:11:55 +0000
commit953727f57474e540315ef16f11ad7dfafdfd9db9 (patch)
tree739023261eec52399ff38e8256f44b9d810cc2c1 /src/test/ui
parent5ab74459b86465e751fc8f6fa9934687423ce2a6 (diff)
downloadrust-953727f57474e540315ef16f11ad7dfafdfd9db9.tar.gz
rust-953727f57474e540315ef16f11ad7dfafdfd9db9.zip
better error for rustc_strict_coherence misuse
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/coherence/strict-coherence-needs-negative-coherence.rs7
-rw-r--r--src/test/ui/coherence/strict-coherence-needs-negative-coherence.stderr10
2 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/coherence/strict-coherence-needs-negative-coherence.rs b/src/test/ui/coherence/strict-coherence-needs-negative-coherence.rs
new file mode 100644
index 00000000000..221683dd56f
--- /dev/null
+++ b/src/test/ui/coherence/strict-coherence-needs-negative-coherence.rs
@@ -0,0 +1,7 @@
+#![feature(rustc_attrs)]
+
+#[rustc_strict_coherence]
+trait Foo {}
+//~^ ERROR to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled
+
+fn main() {}
diff --git a/src/test/ui/coherence/strict-coherence-needs-negative-coherence.stderr b/src/test/ui/coherence/strict-coherence-needs-negative-coherence.stderr
new file mode 100644
index 00000000000..b5472928778
--- /dev/null
+++ b/src/test/ui/coherence/strict-coherence-needs-negative-coherence.stderr
@@ -0,0 +1,10 @@
+error: to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled
+  --> $DIR/strict-coherence-needs-negative-coherence.rs:4:1
+   |
+LL | #[rustc_strict_coherence]
+   | ------------------------- due to this attribute
+LL | trait Foo {}
+   | ^^^^^^^^^
+
+error: aborting due to previous error
+