forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#116115 - RalfJung:dyn-unsized-args, r=<try>
detect dyn-unsized arguments before they cause ICEs "Fixes" rust-lang#115709 in a crude way, with a post-mono check. This is entirely caused by us not having a trait to express "type can have its size determined at runtime".
- Loading branch information
Showing
12 changed files
with
192 additions
and
15 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
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
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,17 @@ | ||
#![feature(extern_types)] | ||
#![feature(unsized_fn_params)] | ||
|
||
extern { | ||
pub type E; | ||
} | ||
|
||
fn test(_e: E) {} | ||
|
||
pub fn calltest(e: Box<E>) { | ||
test(*e) //~ERROR: does not have a dynamically computable size | ||
} | ||
|
||
fn main() { | ||
let b = Box::new(0u32); | ||
calltest(unsafe { std::mem::transmute(b)} ); | ||
} |
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 @@ | ||
error: function parameter does not have a dynamically computable size | ||
--> $DIR/unsized-extern-type-arg.rs:LL:CC | ||
| | ||
LL | test(*e) | ||
| ^^^^^^^^ | ||
| | ||
= note: `E` contains an `extern type`, which is not allowed in function parameters | ||
|
||
error: aborting due to previous error | ||
|
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 @@ | ||
// build-fail | ||
#![feature(extern_types)] | ||
#![feature(unsized_fn_params)] | ||
#![crate_type = "lib"] | ||
|
||
extern { | ||
pub type E; | ||
} | ||
|
||
fn test(e: E) {} //~ERROR: does not have a dynamically computable size | ||
|
||
pub fn calltest(e: Box<E>) { | ||
test(*e) //~ERROR: does not have a dynamically computable size | ||
} |
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,18 @@ | ||
error: function argument does not have a dynamically computable size | ||
--> $DIR/extern-type.rs:10:9 | ||
| | ||
LL | fn test(e: E) {} | ||
| ^ | ||
| | ||
= note: `E` contains an `extern type`, which is not allowed in function arguments | ||
|
||
error: function parameter does not have a dynamically computable size | ||
--> $DIR/extern-type.rs:13:5 | ||
| | ||
LL | test(*e) | ||
| ^^^^^^^^ | ||
| | ||
= note: `E` contains an `extern type`, which is not allowed in function parameters | ||
|
||
error: aborting due to 2 previous errors | ||
|