Skip to content

Commit 32bc245

Browse files
committed
Add a regression test for issue-53448
1 parent 07627a3 commit 32bc245

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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`.

0 commit comments

Comments
 (0)