]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/traits/wf-object/no-duplicates.rs
1 // The purpose of this test is to demonstrate that duplicating object safe traits
2 // that are not auto-traits is rejected even though one could reasonably accept this.
4 // Some arbitrary object-safe trait:
7 // Demonstrate that recursive expansion of trait aliases doesn't affect stable behavior:
8 type _0
= dyn Obj
+ Obj
;
9 //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
13 type _1
= dyn Send
+ Obj
+ Obj
;
14 //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
16 type _2
= dyn Obj
+ Send
+ Obj
;
17 //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
19 type _3
= dyn Obj
+ Send
+ Send
; // But it is OK to duplicate auto traits.
21 // Take higher ranked types into account.
23 // Note that `'a` and `'b` are intentionally different to make sure we consider
24 // them semantically the same.
26 type _4
= dyn for<'a
> ObjL
<'a
> + for<'b
> ObjL
<'b
>;
27 //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
30 type _5
= dyn ObjT
<for<'a
> fn(&'a
u8)> + ObjT
<for<'b
> fn(&'b
u8)>;
31 //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]