]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/negative-reasoning.rs
Auto merge of #106171 - compiler-errors:consolidate-extract_callable_info, r=estebank...
[rust.git] / tests / ui / impl-trait / negative-reasoning.rs
1 // Tests that we cannot assume that an opaque type does *not* implement some
2 // other trait
3 #![feature(type_alias_impl_trait)]
4
5 trait OpaqueTrait {}
6 impl<T> OpaqueTrait for T {}
7 type OpaqueType = impl OpaqueTrait;
8 fn mk_opaque() -> OpaqueType {
9     ()
10 }
11
12 #[derive(Debug)]
13 struct D<T>(T);
14
15 trait AnotherTrait {}
16 impl<T: std::fmt::Debug> AnotherTrait for T {}
17
18 // This is in error, because we cannot assume that `OpaqueType: !Debug`
19 impl AnotherTrait for D<OpaqueType> {
20     //~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
21 }
22
23 fn main() {}