Add a regression test for issue-53448
This commit is contained in:
parent
07627a3aa3
commit
32bc245bc0
2 changed files with 35 additions and 0 deletions
15
src/test/ui/unboxed-closures/issue-53448.rs
Normal file
15
src/test/ui/unboxed-closures/issue-53448.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#![feature(unboxed_closures)]
|
||||
|
||||
trait Lt<'a> {
|
||||
type T;
|
||||
}
|
||||
impl<'a> Lt<'a> for () {
|
||||
type T = ();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let v: <() as Lt<'_>>::T = ();
|
||||
let f: &mut dyn FnMut<(_,), Output = ()> = &mut |_: <() as Lt<'_>>::T| {};
|
||||
//~^ ERROR: the size for values of type `<() as Lt<'_>>::T` cannot be known
|
||||
f(v);
|
||||
}
|
||||
20
src/test/ui/unboxed-closures/issue-53448.stderr
Normal file
20
src/test/ui/unboxed-closures/issue-53448.stderr
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
error[E0277]: the size for values of type `<() as Lt<'_>>::T` cannot be known at compilation time
|
||||
--> $DIR/issue-53448.rs:12:54
|
||||
|
|
||||
LL | let f: &mut dyn FnMut<(_,), Output = ()> = &mut |_: <() as Lt<'_>>::T| {};
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `<() as Lt<'_>>::T`
|
||||
= help: unsized locals are gated as an unstable feature
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | fn main() where <() as Lt<'_>>::T: Sized {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: function arguments must have a statically known size, borrowed types always have a known size
|
||||
|
|
||||
LL | let f: &mut dyn FnMut<(_,), Output = ()> = &mut |_: &<() as Lt<'_>>::T| {};
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue