File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
src/test/ui/unboxed-closures Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( unboxed_closures) ]
2+
3+ trait Lt < ' a > {
4+ type T ;
5+ }
6+ impl < ' a > Lt < ' a > for ( ) {
7+ type T = ( ) ;
8+ }
9+
10+ fn main ( ) {
11+ let v: <( ) as Lt < ' _ > >:: T = ( ) ;
12+ let f: & mut dyn FnMut < ( _ , ) , Output = ( ) > = & mut |_: <( ) as Lt < ' _ > >:: T | { } ;
13+ //~^ ERROR: the size for values of type `<() as Lt<'_>>::T` cannot be known
14+ f ( v) ;
15+ }
Original file line number Diff line number Diff line change 1+ error[E0277]: the size for values of type `<() as Lt<'_>>::T` cannot be known at compilation time
2+ --> $DIR/issue-53448.rs:12:54
3+ |
4+ LL | let f: &mut dyn FnMut<(_,), Output = ()> = &mut |_: <() as Lt<'_>>::T| {};
5+ | ^ doesn't have a size known at compile-time
6+ |
7+ = help: the trait `Sized` is not implemented for `<() as Lt<'_>>::T`
8+ = help: unsized locals are gated as an unstable feature
9+ help: consider further restricting the associated type
10+ |
11+ LL | fn main() where <() as Lt<'_>>::T: Sized {
12+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13+ help: function arguments must have a statically known size, borrowed types always have a known size
14+ |
15+ LL | let f: &mut dyn FnMut<(_,), Output = ()> = &mut |_: &<() as Lt<'_>>::T| {};
16+ | ^
17+
18+ error: aborting due to previous error
19+
20+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments