diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-06-13 07:02:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-13 07:02:28 +0200 |
| commit | b7706e891d60f63d61a1a90e6c25521699c6e74e (patch) | |
| tree | e0d7cf452929c1136be92929f85313ca90206522 /tests/ui/unsized-locals | |
| parent | 5e8c53f1f660236bd88bfe40145646104f265846 (diff) | |
| parent | b95ea45a60faac4219226d13f9c6c7fffd0b8cef (diff) | |
| download | rust-b7706e891d60f63d61a1a90e6c25521699c6e74e.tar.gz rust-b7706e891d60f63d61a1a90e6c25521699c6e74e.zip | |
Rollup merge of #111885 - compiler-errors:rust-call-abi-sized, r=eholk
Don't ICE on unsized `extern "rust-call"` call Conceptually builds on #111864, but doesn't depend on it.
Diffstat (limited to 'tests/ui/unsized-locals')
| -rw-r--r-- | tests/ui/unsized-locals/rust-call.rs | 12 | ||||
| -rw-r--r-- | tests/ui/unsized-locals/rust-call.stderr | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/unsized-locals/rust-call.rs b/tests/ui/unsized-locals/rust-call.rs new file mode 100644 index 00000000000..ff4075aa4c0 --- /dev/null +++ b/tests/ui/unsized-locals/rust-call.rs @@ -0,0 +1,12 @@ +#![feature(unsized_tuple_coercion)] +#![feature(unboxed_closures)] +#![feature(unsized_fn_params)] + +fn bad() -> extern "rust-call" fn(([u8],)) { todo!() } + +fn main() { + let f = bad(); + let slice: Box<([u8],)> = Box::new(([1; 8],)); + f(*slice); + //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time +} diff --git a/tests/ui/unsized-locals/rust-call.stderr b/tests/ui/unsized-locals/rust-call.stderr new file mode 100644 index 00000000000..fff7ef75b33 --- /dev/null +++ b/tests/ui/unsized-locals/rust-call.stderr @@ -0,0 +1,13 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/rust-call.rs:10:7 + | +LL | f(*slice); + | ^^^^^^ doesn't have a size known at compile-time + | + = help: within `([u8],)`, the trait `Sized` is not implemented for `[u8]` + = note: required because it appears within the type `([u8],)` + = note: argument required to be sized due to `extern "rust-call"` ABI + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
