rust/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
473 B
Rust
Raw Normal View History

// revisions: stock with_negative_coherence
//[with_negative_coherence] check-pass
2022-02-10 08:55:23 -06:00
#![feature(negative_impls)]
#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))]
2022-02-10 08:55:23 -06:00
trait MyPredicate<'a> {}
impl<'a, T> !MyPredicate<'a> for &'a T where T: 'a {}
2022-02-10 08:55:23 -06:00
trait MyTrait<'a> {}
2022-02-10 08:55:23 -06:00
impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
impl<'a, T> MyTrait<'a> for &'a T {}
//[stock]~^ ERROR: conflicting implementations of trait `MyTrait<'_>` for type `&_`
2022-02-10 08:55:23 -06:00
fn main() {}