about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-13 06:13:43 +0000
committerbors <bors@rust-lang.org>2023-06-13 06:13:43 +0000
commitcaeea3f0a21574419254c72b3e0863742d3c6fd0 (patch)
treedbc47fdf3226927f4e15ee1a32d1eecd7a070bbf /tests
parentde1ff0a8b559c300fb8145123accdfa8bda1031e (diff)
parentaee8e10a26ea1dd76c2ea11ace36f642c9f2ac50 (diff)
Auto merge of #112575 - matthiaskrgr:rollup-7a8d7tg, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #111885 (Don't ICE on unsized `extern "rust-call"` call)
 - #112558 (Fix typo in mod.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/unsized-locals/rust-call.rs12
-rw-r--r--tests/ui/unsized-locals/rust-call.stderr13
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`.