Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that unsized locals fail when turning unsized_fn_params feature …
…flag on
- Loading branch information
1 parent
f0a71f7
commit a3470b1
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs
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,7 @@ | ||
#![feature(unsized_fn_params)] | ||
|
||
fn main() { | ||
let foo: Box<[u8]> = Box::new(*b"foo"); | ||
let _foo: [u8] = *foo; | ||
//~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time [E0277] | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr
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,13 @@ | ||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/unsized-locals-using-unsized-fn-params.rs:5:9 | ||
| | ||
LL | let _foo: [u8] = *foo; | ||
| ^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
= note: all local variables must have a statically known size | ||
= help: unsized locals are gated as an unstable feature | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |