diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2021-10-22 17:54:20 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2021-10-22 17:54:20 -0300 |
| commit | 953418685769424388fb9ea1f4b2beaceedb6857 (patch) | |
| tree | 9c25a6391ff62954512b16744c54d24c7237b6b4 /src/test/ui | |
| parent | 9e264137e9cececda98521bd411f3317c408a0ec (diff) | |
| download | rust-953418685769424388fb9ea1f4b2beaceedb6857.tar.gz rust-953418685769424388fb9ea1f4b2beaceedb6857.zip | |
Hide negative coherence checks under negative_impls feature flag
Diffstat (limited to 'src/test/ui')
4 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/coherence/coherence-overlap-negate-not-use-feature-gate.rs b/src/test/ui/coherence/coherence-overlap-negate-not-use-feature-gate.rs new file mode 100644 index 00000000000..a067736f63a --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-negate-not-use-feature-gate.rs @@ -0,0 +1,8 @@ +use std::ops::DerefMut; + +trait Foo {} +impl<T: DerefMut> Foo for T {} +impl<U> Foo for &U {} +//~^ ERROR: conflicting implementations of trait `Foo` for type `&_` [E0119] + +fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-negate-not-use-feature-gate.stderr b/src/test/ui/coherence/coherence-overlap-negate-not-use-feature-gate.stderr new file mode 100644 index 00000000000..4b55001ecc0 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-negate-not-use-feature-gate.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `&_` + --> $DIR/coherence-overlap-negate-not-use-feature-gate.rs:5:1 + | +LL | impl<T: DerefMut> Foo for T {} + | --------------------------- first implementation here +LL | impl<U> Foo for &U {} + | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-negate-use-feature-gate.rs b/src/test/ui/coherence/coherence-overlap-negate-use-feature-gate.rs new file mode 100644 index 00000000000..e024eae9819 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-negate-use-feature-gate.rs @@ -0,0 +1,11 @@ +// check-pass + +#![feature(negative_impls)] + +use std::ops::DerefMut; + +trait Foo {} +impl<T: DerefMut> Foo for T {} +impl<U> Foo for &U {} + +fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-negative-trait.rs b/src/test/ui/coherence/coherence-overlap-negative-trait.rs index 357c4e87c91..ab65163bea4 100644 --- a/src/test/ui/coherence/coherence-overlap-negative-trait.rs +++ b/src/test/ui/coherence/coherence-overlap-negative-trait.rs @@ -3,6 +3,8 @@ // // Check that if we promise to not impl what would overlap it doesn't actually overlap +#![feature(negative_impls)] + extern crate error_lib as lib; use lib::Error; |
