]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/auto-trait.rs
Rollup merge of #82434 - jyn514:hash, r=JohnTitor
[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 // revisions: min_tait full_tait
4 #![feature(min_type_alias_impl_trait)]
5 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
6 //[full_tait]~^ WARN incomplete
7
8 trait OpaqueTrait {}
9 impl<T> OpaqueTrait for T {}
10 type OpaqueType = impl OpaqueTrait;
11 fn mk_opaque() -> OpaqueType {
12     ()
13 }
14
15 #[derive(Debug)]
16 struct D<T>(T);
17
18 trait AnotherTrait {}
19 impl<T: Send> AnotherTrait for T {}
20
21 // This is in error, because we cannot assume that `OpaqueType: !Send`.
22 // (We treat opaque types as "foreign types" that could grow more impls
23 // in the future.)
24 impl AnotherTrait for D<OpaqueType> {
25     //~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<impl OpaqueTrait>`
26 }
27
28 fn main() {}