better error for rustc_strict_coherence misuse

This commit is contained in:
Michael Goulet 2022-10-30 19:10:35 +00:00
parent 5ab74459b8
commit 953727f574
5 changed files with 45 additions and 2 deletions

View file

@ -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() {}

View file

@ -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