2022-08-19 22:23:23 -05:00
|
|
|
// revisions: stock with_negative_coherence
|
2023-11-20 12:39:44 -06:00
|
|
|
|
2023-08-01 21:06:55 -05:00
|
|
|
//[with_negative_coherence] known-bug: unknown
|
2023-11-20 12:39:44 -06:00
|
|
|
// Ideally this would work, but we don't use `&'a T` to imply that `T: 'a`
|
|
|
|
// which is required for `&'a T: !MyPredicate` to hold. This is similar to the
|
|
|
|
// test `negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr`
|
2022-08-22 13:52:49 -05:00
|
|
|
|
2022-02-10 08:55:23 -06:00
|
|
|
#![feature(negative_impls)]
|
2022-08-19 22:23:23 -05:00
|
|
|
#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))]
|
2022-02-10 08:55:23 -06:00
|
|
|
|
|
|
|
trait MyPredicate<'a> {}
|
2022-08-19 22:23:23 -05:00
|
|
|
|
|
|
|
impl<'a, T> !MyPredicate<'a> for &'a T where T: 'a {}
|
|
|
|
|
2022-02-10 08:55:23 -06:00
|
|
|
trait MyTrait<'a> {}
|
2022-08-19 22:23:23 -05:00
|
|
|
|
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 {}
|
2022-08-22 13:52:49 -05:00
|
|
|
//[stock]~^ ERROR: conflicting implementations of trait `MyTrait<'_>` for type `&_`
|
2022-02-10 08:55:23 -06:00
|
|
|
|
|
|
|
fn main() {}
|