File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
src/test/ui/higher-rank-trait-bounds/normalize-under-binder Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1111fn main ( ) {
1212 foo :: < Vec < u32 > > ( vec ! [ ] ) ;
1313}
14+
15+ mod another {
16+ use std:: ops:: Deref ;
17+
18+ fn test < T , TDeref > ( )
19+ where
20+ T : Deref < Target = TDeref > ,
21+ TDeref : ?Sized ,
22+ for < ' a > & ' a TDeref : IntoIterator ,
23+ for < ' a > <& ' a TDeref as IntoIterator >:: IntoIter : Clone ,
24+ {
25+ }
26+
27+ fn main ( ) {
28+ test :: < Vec < u8 > , _ > ( ) ;
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ trait Variable < ' a > {
4+ type Type ;
5+ }
6+
7+ impl Variable < ' _ > for ( ) {
8+ type Type = ( ) ;
9+ }
10+
11+ fn check < F , T > ( _: F )
12+ where
13+ F : Fn ( T ) , // <- if removed, all fn_* then require type annotations
14+ F : for < ' a > Fn ( <T as Variable < ' a > >:: Type ) ,
15+ T : for < ' a > Variable < ' a > ,
16+ {
17+ }
18+
19+ fn test ( arg : impl Fn ( ( ) ) ) {
20+ fn fn_1 ( _: ( ) ) { }
21+ let fn_2 = |_: ( ) | ( ) ;
22+ let fn_3 = |a| fn_1 ( a) ;
23+ let fn_4 = arg;
24+
25+ check ( fn_1) ; // Error
26+ check ( fn_2) ; // Ok
27+ check ( fn_3) ; // Ok
28+ check ( fn_4) ; // Error
29+ }
30+
31+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments