summaryrefslogtreecommitdiffstats
path: root/tests/ui/unsized-locals
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unsized-locals')
-rw-r--r--tests/ui/unsized-locals/issue-67981.stderr5
-rw-r--r--tests/ui/unsized-locals/rust-call.rs12
-rw-r--r--tests/ui/unsized-locals/rust-call.stderr13
3 files changed, 26 insertions, 4 deletions
diff --git a/tests/ui/unsized-locals/issue-67981.stderr b/tests/ui/unsized-locals/issue-67981.stderr
index a4b179ae2..13fdc037a 100644
--- a/tests/ui/unsized-locals/issue-67981.stderr
+++ b/tests/ui/unsized-locals/issue-67981.stderr
@@ -5,10 +5,7 @@ LL | let f: fn([u8]) = |_| {};
| ^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
-help: function arguments must have a statically known size, borrowed types always have a known size
- |
-LL | let f: fn([u8]) = |&_| {};
- | +
+ = note: all function arguments must have a statically known size
error: aborting due to previous error
diff --git a/tests/ui/unsized-locals/rust-call.rs b/tests/ui/unsized-locals/rust-call.rs
new file mode 100644
index 000000000..ff4075aa4
--- /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 000000000..fff7ef75b
--- /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`.