-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for zero-sized function items not ICEing
- Loading branch information
1 parent
bf45975
commit cd4c309
Showing
4 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![feature(unsized_locals)] | ||
|
||
struct Test([i32]); | ||
|
||
fn main() { | ||
let _x: fn(_) -> Test = Test; | ||
} //~^the size for values of type `[i32]` cannot be known at compilation time |
14 changes: 14 additions & 0 deletions
14
src/test/ui/unsized-locals/issue-30276-feature-flagged.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,14 @@ | ||
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time | ||
--> $DIR/issue-30276-feature-flagged.rs:6:29 | ||
| | ||
LL | let _x: fn(_) -> Test = Test; | ||
| ^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: within `Test`, the trait `std::marker::Sized` is not implemented for `[i32]` | ||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> | ||
= note: required because it appears within the type `Test` | ||
= note: the return type of a function must have a statically known size | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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,5 @@ | ||
struct Test([i32]); | ||
|
||
fn main() { | ||
let _x: fn(_) -> Test = Test; | ||
} //~^the size for values of type `[i32]` cannot be known at compilation time |
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,14 @@ | ||
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time | ||
--> $DIR/issue-30276.rs:4:29 | ||
| | ||
LL | let _x: fn(_) -> Test = Test; | ||
| ^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `[i32]` | ||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> | ||
= note: all function arguments 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`. |