]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/auto-trait.rs
Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup
[rust.git] / src / test / ui / impl-trait / auto-trait.rs
1 // Tests that type alias impls traits do not leak auto-traits for
2 // the purposes of coherence checking
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: Send> AnotherTrait for T {}
17
18 // This is in error, because we cannot assume that `OpaqueType: !Send`.
19 // (We treat opaque types as "foreign types" that could grow more impls
20 // in the future.)
21 impl AnotherTrait for D<OpaqueType> {
22     //~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<impl OpaqueTrait>`
23 }
24
25 fn main() {}