forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#111864 - Jules-Bertholet:sized-closures, r=…
…compiler-errors Always require closure parameters to be `Sized` The `rust-call` ABI isn't compatible with `#![feature(unsized_fn_params)]`, so trying to use that feature with closures leads to an ICE (rust-lang#67981). This turns that ICE into a type-check error. `@rustbot` label A-closures F-unsized_fn_params
- Loading branch information
Showing
5 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![feature(unsized_fn_params)] | ||
|
||
fn main() { | ||
let f: fn([u8]) = |_| {}; | ||
//~^ERROR the size for values of type `[u8]` cannot be known at compilation time | ||
let slice: Box<[u8]> = Box::new([1; 8]); | ||
|
||
f(*slice); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/issue-67981.rs:4:24 | ||
| | ||
LL | let f: fn([u8]) = |_| {}; | ||
| ^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
help: function arguments must have a statically known size, borrowed types always have a known size | ||
| | ||
LL | let f: fn([u8]) = |&_| {}; | ||
| + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |