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.
Always register sized obligation for argument
- Loading branch information
1 parent
6330daa
commit 0d6da78
Showing
7 changed files
with
57 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![feature(unsized_fn_params)] | ||
|
||
fn main() { | ||
// CoerceMany "LUB" | ||
let f = if true { |_a| {} } else { |_b| {} }; | ||
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time | ||
//~| 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,21 @@ | ||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/cannot-call-unsized-via-ptr-2.rs:5:24 | ||
| | ||
LL | let f = if true { |_a| {} } else { |_b| {} }; | ||
| ^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
= note: all function arguments must have a statically known size | ||
|
||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/cannot-call-unsized-via-ptr-2.rs:5:41 | ||
| | ||
LL | let f = if true { |_a| {} } else { |_b| {} }; | ||
| ^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
= note: all function arguments must have a statically known size | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
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,10 @@ | ||
#![feature(unsized_fn_params)] | ||
|
||
fn main() { | ||
// Simple coercion | ||
let f: fn([u8]) = |_result| {}; | ||
//~^ 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,12 @@ | ||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/cannot-call-unsized-via-ptr.rs:5:24 | ||
| | ||
LL | let f: fn([u8]) = |_result| {}; | ||
| ^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
= note: all function arguments 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
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