//@ check-pass //@ known-bug: #74629 // Should fail. The `0` and `1` impls overlap, violating coherence. Eg, with // `T = Test, F = ()`, all bounds are true, making both impls applicable. // `Test: Fold`, `Test: Fold<()>` are true because of `2`. // `Is: NotNil` is true because of `auto trait` and lack of negative impl. #![feature(negative_impls)] #![feature(auto_traits)] struct Nil; struct Cons(H); struct Test; trait Fold {} impl Fold for Cons // 0 where T: Fold, { } impl Fold for Cons // 1 where T: Fold, private::Is: private::NotNil, { } impl Fold for Test {} // 2 mod private { use crate::Nil; pub struct Is(T); pub auto trait NotNil {} impl !NotNil for Is {} } fn main() {}