File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
tests/ui/impl-trait/in-bindings Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ feature( impl_trait_in_bindings) ]
4+
5+ // A test for #61773 which would have been difficult to support if we
6+ // were to represent `impl_trait_in_bindings` using opaque types.
7+
8+ trait Trait < ' a , ' b > { }
9+ impl < T > Trait < ' _ , ' _ > for T { }
10+
11+
12+ fn bar < ' a , ' b > ( data0 : & ' a u32 , data1 : & ' b u32 ) {
13+ let x: impl Trait < ' _ , ' _ > = ( data0, data1) ;
14+ force_equal ( x) ;
15+ }
16+
17+ fn force_equal < ' a > ( t : impl Trait < ' a , ' a > ) { }
18+
19+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ feature( impl_trait_in_bindings) ]
4+
5+ // A test for #61773 which would have been difficult to support if we
6+ // were to represent `impl_trait_in_bindings` using opaque types.
7+
8+ trait Foo < ' a > { }
9+ impl Foo < ' _ > for & u32 { }
10+
11+ fn bar < ' a > ( data : & ' a u32 ) {
12+ let x: impl Foo < ' _ > = data;
13+ }
14+
15+ fn main ( ) {
16+ let _: impl Foo < ' _ > = & 44 ;
17+ }
You can’t perform that action at this time.
0 commit comments