summaryrefslogtreecommitdiffstats
path: root/tests/ui/unsized
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/unsized
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/ui/unsized-locals/autoderef.rs (renamed from src/test/ui/unsized-locals/autoderef.rs)0
-rw-r--r--tests/ui/unsized-locals/auxiliary/ufuncs.rs (renamed from src/test/ui/unsized-locals/auxiliary/ufuncs.rs)0
-rw-r--r--tests/ui/unsized-locals/borrow-after-move.rs (renamed from src/test/ui/unsized-locals/borrow-after-move.rs)0
-rw-r--r--tests/ui/unsized-locals/borrow-after-move.stderr (renamed from src/test/ui/unsized-locals/borrow-after-move.stderr)2
-rw-r--r--tests/ui/unsized-locals/box-fnonce.rs (renamed from src/test/ui/unsized-locals/box-fnonce.rs)0
-rw-r--r--tests/ui/unsized-locals/by-value-trait-object-safety-rpass.rs (renamed from src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs)0
-rw-r--r--tests/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs (renamed from src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs)0
-rw-r--r--tests/ui/unsized-locals/by-value-trait-object-safety.rs (renamed from src/test/ui/unsized-locals/by-value-trait-object-safety.rs)0
-rw-r--r--tests/ui/unsized-locals/by-value-trait-object-safety.stderr (renamed from src/test/ui/unsized-locals/by-value-trait-object-safety.stderr)0
-rw-r--r--tests/ui/unsized-locals/double-move.rs (renamed from src/test/ui/unsized-locals/double-move.rs)0
-rw-r--r--tests/ui/unsized-locals/double-move.stderr (renamed from src/test/ui/unsized-locals/double-move.stderr)2
-rw-r--r--tests/ui/unsized-locals/issue-30276-feature-flagged.rs (renamed from src/test/ui/unsized-locals/issue-30276-feature-flagged.rs)0
-rw-r--r--tests/ui/unsized-locals/issue-30276-feature-flagged.stderr (renamed from src/test/ui/unsized-locals/issue-30276-feature-flagged.stderr)0
-rw-r--r--tests/ui/unsized-locals/issue-30276.rs (renamed from src/test/ui/unsized-locals/issue-30276.rs)0
-rw-r--r--tests/ui/unsized-locals/issue-30276.stderr (renamed from src/test/ui/unsized-locals/issue-30276.stderr)0
-rw-r--r--tests/ui/unsized-locals/issue-50940-with-feature.rs (renamed from src/test/ui/unsized-locals/issue-50940-with-feature.rs)0
-rw-r--r--tests/ui/unsized-locals/issue-50940-with-feature.stderr (renamed from src/test/ui/unsized-locals/issue-50940-with-feature.stderr)0
-rw-r--r--tests/ui/unsized-locals/issue-50940.rs (renamed from src/test/ui/unsized-locals/issue-50940.rs)0
-rw-r--r--tests/ui/unsized-locals/issue-50940.stderr (renamed from src/test/ui/unsized-locals/issue-50940.stderr)0
-rw-r--r--tests/ui/unsized-locals/reference-unsized-locals.rs (renamed from src/test/ui/unsized-locals/reference-unsized-locals.rs)0
-rw-r--r--tests/ui/unsized-locals/simple-unsized-locals.rs (renamed from src/test/ui/unsized-locals/simple-unsized-locals.rs)0
-rw-r--r--tests/ui/unsized-locals/suggest-borrow.rs7
-rw-r--r--tests/ui/unsized-locals/suggest-borrow.stderr60
-rw-r--r--tests/ui/unsized-locals/unsized-exprs-rpass.rs (renamed from src/test/ui/unsized-locals/unsized-exprs-rpass.rs)0
-rw-r--r--tests/ui/unsized-locals/unsized-exprs.rs (renamed from src/test/ui/unsized-locals/unsized-exprs.rs)0
-rw-r--r--tests/ui/unsized-locals/unsized-exprs.stderr (renamed from src/test/ui/unsized-locals/unsized-exprs.stderr)0
-rw-r--r--tests/ui/unsized-locals/unsized-exprs2.rs (renamed from src/test/ui/unsized-locals/unsized-exprs2.rs)0
-rw-r--r--tests/ui/unsized-locals/unsized-exprs2.stderr (renamed from src/test/ui/unsized-locals/unsized-exprs2.stderr)0
-rw-r--r--tests/ui/unsized-locals/unsized-exprs3.rs (renamed from src/test/ui/unsized-locals/unsized-exprs3.rs)0
-rw-r--r--tests/ui/unsized-locals/unsized-exprs3.stderr (renamed from src/test/ui/unsized-locals/unsized-exprs3.stderr)0
-rw-r--r--tests/ui/unsized-locals/unsized-index.rs (renamed from src/test/ui/unsized-locals/unsized-index.rs)0
-rw-r--r--tests/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs (renamed from src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs)0
-rw-r--r--tests/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr (renamed from src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr)4
-rw-r--r--tests/ui/unsized-locals/unsized-parameters.rs (renamed from src/test/ui/unsized-locals/unsized-parameters.rs)0
-rw-r--r--tests/ui/unsized/box-instead-of-dyn-fn.rs (renamed from src/test/ui/unsized/box-instead-of-dyn-fn.rs)0
-rw-r--r--tests/ui/unsized/box-instead-of-dyn-fn.stderr (renamed from src/test/ui/unsized/box-instead-of-dyn-fn.stderr)0
-rw-r--r--tests/ui/unsized/issue-30355.rs (renamed from src/test/ui/unsized/issue-30355.rs)0
-rw-r--r--tests/ui/unsized/issue-30355.stderr (renamed from src/test/ui/unsized/issue-30355.stderr)0
-rw-r--r--tests/ui/unsized/issue-40231-1.rs (renamed from src/test/ui/unsized/issue-40231-1.rs)0
-rw-r--r--tests/ui/unsized/issue-40231-2.rs (renamed from src/test/ui/unsized/issue-40231-2.rs)0
-rw-r--r--tests/ui/unsized/issue-71659.rs (renamed from src/test/ui/unsized/issue-71659.rs)0
-rw-r--r--tests/ui/unsized/issue-71659.stderr18
-rw-r--r--tests/ui/unsized/issue-75707.rs (renamed from src/test/ui/unsized/issue-75707.rs)0
-rw-r--r--tests/ui/unsized/issue-75707.stderr (renamed from src/test/ui/unsized/issue-75707.stderr)0
-rw-r--r--tests/ui/unsized/issue-75899-but-gats.rs (renamed from src/test/ui/unsized/issue-75899-but-gats.rs)0
-rw-r--r--tests/ui/unsized/issue-75899.rs (renamed from src/test/ui/unsized/issue-75899.rs)0
-rw-r--r--tests/ui/unsized/issue-91801.rs (renamed from src/test/ui/unsized/issue-91801.rs)0
-rw-r--r--tests/ui/unsized/issue-91801.stderr (renamed from src/test/ui/unsized/issue-91801.stderr)0
-rw-r--r--tests/ui/unsized/issue-91803.rs (renamed from src/test/ui/unsized/issue-91803.rs)0
-rw-r--r--tests/ui/unsized/issue-91803.stderr (renamed from src/test/ui/unsized/issue-91803.stderr)0
-rw-r--r--tests/ui/unsized/issue-97732.rs (renamed from src/test/ui/unsized/issue-97732.rs)0
-rw-r--r--tests/ui/unsized/maybe-bounds-where-cpass.rs (renamed from src/test/ui/unsized/maybe-bounds-where-cpass.rs)0
-rw-r--r--tests/ui/unsized/maybe-bounds-where.rs (renamed from src/test/ui/unsized/maybe-bounds-where.rs)0
-rw-r--r--tests/ui/unsized/maybe-bounds-where.stderr (renamed from src/test/ui/unsized/maybe-bounds-where.stderr)0
-rw-r--r--tests/ui/unsized/param-mentioned-by-different-field.rs (renamed from src/test/ui/unsized/param-mentioned-by-different-field.rs)0
-rw-r--r--tests/ui/unsized/param-mentioned-by-different-field.stderr (renamed from src/test/ui/unsized/param-mentioned-by-different-field.stderr)0
-rw-r--r--tests/ui/unsized/return-unsized-from-trait-method.rs (renamed from src/test/ui/unsized/return-unsized-from-trait-method.rs)0
-rw-r--r--tests/ui/unsized/return-unsized-from-trait-method.stderr (renamed from src/test/ui/unsized/return-unsized-from-trait-method.stderr)0
-rw-r--r--tests/ui/unsized/unchanged-param.rs (renamed from src/test/ui/unsized/unchanged-param.rs)0
-rw-r--r--tests/ui/unsized/unsized-bare-typaram.rs (renamed from src/test/ui/unsized/unsized-bare-typaram.rs)0
-rw-r--r--tests/ui/unsized/unsized-bare-typaram.stderr (renamed from src/test/ui/unsized/unsized-bare-typaram.stderr)0
-rw-r--r--tests/ui/unsized/unsized-enum.rs (renamed from src/test/ui/unsized/unsized-enum.rs)0
-rw-r--r--tests/ui/unsized/unsized-enum.stderr (renamed from src/test/ui/unsized/unsized-enum.stderr)0
-rw-r--r--tests/ui/unsized/unsized-enum2.rs (renamed from src/test/ui/unsized/unsized-enum2.rs)0
-rw-r--r--tests/ui/unsized/unsized-enum2.stderr (renamed from src/test/ui/unsized/unsized-enum2.stderr)0
-rw-r--r--tests/ui/unsized/unsized-fn-arg.fixed (renamed from src/test/ui/unsized/unsized-fn-arg.fixed)0
-rw-r--r--tests/ui/unsized/unsized-fn-arg.rs (renamed from src/test/ui/unsized/unsized-fn-arg.rs)0
-rw-r--r--tests/ui/unsized/unsized-fn-arg.stderr (renamed from src/test/ui/unsized/unsized-fn-arg.stderr)0
-rw-r--r--tests/ui/unsized/unsized-fn-param.rs (renamed from src/test/ui/unsized/unsized-fn-param.rs)0
-rw-r--r--tests/ui/unsized/unsized-fn-param.stderr (renamed from src/test/ui/unsized/unsized-fn-param.stderr)0
-rw-r--r--tests/ui/unsized/unsized-inherent-impl-self-type.rs (renamed from src/test/ui/unsized/unsized-inherent-impl-self-type.rs)0
-rw-r--r--tests/ui/unsized/unsized-inherent-impl-self-type.stderr (renamed from src/test/ui/unsized/unsized-inherent-impl-self-type.stderr)0
-rw-r--r--tests/ui/unsized/unsized-struct.rs (renamed from src/test/ui/unsized/unsized-struct.rs)0
-rw-r--r--tests/ui/unsized/unsized-struct.stderr (renamed from src/test/ui/unsized/unsized-struct.stderr)0
-rw-r--r--tests/ui/unsized/unsized-trait-impl-self-type.rs (renamed from src/test/ui/unsized/unsized-trait-impl-self-type.rs)0
-rw-r--r--tests/ui/unsized/unsized-trait-impl-self-type.stderr (renamed from src/test/ui/unsized/unsized-trait-impl-self-type.stderr)0
-rw-r--r--tests/ui/unsized/unsized-trait-impl-trait-arg.rs (renamed from src/test/ui/unsized/unsized-trait-impl-trait-arg.rs)0
-rw-r--r--tests/ui/unsized/unsized-trait-impl-trait-arg.stderr (renamed from src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr)0
-rw-r--r--tests/ui/unsized/unsized-tuple-impls.rs (renamed from src/test/ui/unsized/unsized-tuple-impls.rs)0
-rw-r--r--tests/ui/unsized/unsized.rs (renamed from src/test/ui/unsized/unsized.rs)0
-rw-r--r--tests/ui/unsized/unsized2.rs (renamed from src/test/ui/unsized/unsized2.rs)0
-rw-r--r--tests/ui/unsized/unsized3-rpass.rs (renamed from src/test/ui/unsized/unsized3-rpass.rs)0
-rw-r--r--tests/ui/unsized/unsized3.rs (renamed from src/test/ui/unsized/unsized3.rs)0
-rw-r--r--tests/ui/unsized/unsized3.stderr (renamed from src/test/ui/unsized/unsized3.stderr)0
-rw-r--r--tests/ui/unsized/unsized5.rs (renamed from src/test/ui/unsized/unsized5.rs)0
-rw-r--r--tests/ui/unsized/unsized5.stderr (renamed from src/test/ui/unsized/unsized5.stderr)0
-rw-r--r--tests/ui/unsized/unsized6.rs (renamed from src/test/ui/unsized/unsized6.rs)0
-rw-r--r--tests/ui/unsized/unsized6.stderr (renamed from src/test/ui/unsized/unsized6.stderr)16
-rw-r--r--tests/ui/unsized/unsized7.rs (renamed from src/test/ui/unsized/unsized7.rs)0
-rw-r--r--tests/ui/unsized/unsized7.stderr (renamed from src/test/ui/unsized/unsized7.stderr)0
90 files changed, 107 insertions, 2 deletions
diff --git a/src/test/ui/unsized-locals/autoderef.rs b/tests/ui/unsized-locals/autoderef.rs
index 5dd5898c1..5dd5898c1 100644
--- a/src/test/ui/unsized-locals/autoderef.rs
+++ b/tests/ui/unsized-locals/autoderef.rs
diff --git a/src/test/ui/unsized-locals/auxiliary/ufuncs.rs b/tests/ui/unsized-locals/auxiliary/ufuncs.rs
index 5954abf3a..5954abf3a 100644
--- a/src/test/ui/unsized-locals/auxiliary/ufuncs.rs
+++ b/tests/ui/unsized-locals/auxiliary/ufuncs.rs
diff --git a/src/test/ui/unsized-locals/borrow-after-move.rs b/tests/ui/unsized-locals/borrow-after-move.rs
index ad73b720f..ad73b720f 100644
--- a/src/test/ui/unsized-locals/borrow-after-move.rs
+++ b/tests/ui/unsized-locals/borrow-after-move.rs
diff --git a/src/test/ui/unsized-locals/borrow-after-move.stderr b/tests/ui/unsized-locals/borrow-after-move.stderr
index d8bffd4f9..9e3c345dd 100644
--- a/src/test/ui/unsized-locals/borrow-after-move.stderr
+++ b/tests/ui/unsized-locals/borrow-after-move.stderr
@@ -59,7 +59,7 @@ LL | y.foo();
LL | println!("{}", &y);
| ^^ value borrowed here after move
|
-note: this function takes ownership of the receiver `self`, which moves `y`
+note: `Foo::foo` takes ownership of the receiver `self`, which moves `y`
--> $DIR/borrow-after-move.rs:5:12
|
LL | fn foo(self) -> String;
diff --git a/src/test/ui/unsized-locals/box-fnonce.rs b/tests/ui/unsized-locals/box-fnonce.rs
index 8b2f9b4c9..8b2f9b4c9 100644
--- a/src/test/ui/unsized-locals/box-fnonce.rs
+++ b/tests/ui/unsized-locals/box-fnonce.rs
diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs b/tests/ui/unsized-locals/by-value-trait-object-safety-rpass.rs
index b9881defa..b9881defa 100644
--- a/src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs
+++ b/tests/ui/unsized-locals/by-value-trait-object-safety-rpass.rs
diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs b/tests/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs
index 957991f85..957991f85 100644
--- a/src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs
+++ b/tests/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs
diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety.rs b/tests/ui/unsized-locals/by-value-trait-object-safety.rs
index d0ba6944a..d0ba6944a 100644
--- a/src/test/ui/unsized-locals/by-value-trait-object-safety.rs
+++ b/tests/ui/unsized-locals/by-value-trait-object-safety.rs
diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety.stderr b/tests/ui/unsized-locals/by-value-trait-object-safety.stderr
index 4f13ec7ac..4f13ec7ac 100644
--- a/src/test/ui/unsized-locals/by-value-trait-object-safety.stderr
+++ b/tests/ui/unsized-locals/by-value-trait-object-safety.stderr
diff --git a/src/test/ui/unsized-locals/double-move.rs b/tests/ui/unsized-locals/double-move.rs
index 9e46ef9be..9e46ef9be 100644
--- a/src/test/ui/unsized-locals/double-move.rs
+++ b/tests/ui/unsized-locals/double-move.rs
diff --git a/src/test/ui/unsized-locals/double-move.stderr b/tests/ui/unsized-locals/double-move.stderr
index 715348181..49b906bbe 100644
--- a/src/test/ui/unsized-locals/double-move.stderr
+++ b/tests/ui/unsized-locals/double-move.stderr
@@ -55,7 +55,7 @@ LL | y.foo();
LL | y.foo();
| ^ value used here after move
|
-note: this function takes ownership of the receiver `self`, which moves `y`
+note: `Foo::foo` takes ownership of the receiver `self`, which moves `y`
--> $DIR/double-move.rs:5:12
|
LL | fn foo(self) -> String;
diff --git a/src/test/ui/unsized-locals/issue-30276-feature-flagged.rs b/tests/ui/unsized-locals/issue-30276-feature-flagged.rs
index 635d34f82..635d34f82 100644
--- a/src/test/ui/unsized-locals/issue-30276-feature-flagged.rs
+++ b/tests/ui/unsized-locals/issue-30276-feature-flagged.rs
diff --git a/src/test/ui/unsized-locals/issue-30276-feature-flagged.stderr b/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr
index b6002cf89..b6002cf89 100644
--- a/src/test/ui/unsized-locals/issue-30276-feature-flagged.stderr
+++ b/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr
diff --git a/src/test/ui/unsized-locals/issue-30276.rs b/tests/ui/unsized-locals/issue-30276.rs
index 9c4bf062a..9c4bf062a 100644
--- a/src/test/ui/unsized-locals/issue-30276.rs
+++ b/tests/ui/unsized-locals/issue-30276.rs
diff --git a/src/test/ui/unsized-locals/issue-30276.stderr b/tests/ui/unsized-locals/issue-30276.stderr
index 8cccbd792..8cccbd792 100644
--- a/src/test/ui/unsized-locals/issue-30276.stderr
+++ b/tests/ui/unsized-locals/issue-30276.stderr
diff --git a/src/test/ui/unsized-locals/issue-50940-with-feature.rs b/tests/ui/unsized-locals/issue-50940-with-feature.rs
index 63b0e830b..63b0e830b 100644
--- a/src/test/ui/unsized-locals/issue-50940-with-feature.rs
+++ b/tests/ui/unsized-locals/issue-50940-with-feature.rs
diff --git a/src/test/ui/unsized-locals/issue-50940-with-feature.stderr b/tests/ui/unsized-locals/issue-50940-with-feature.stderr
index 8bbe317ec..8bbe317ec 100644
--- a/src/test/ui/unsized-locals/issue-50940-with-feature.stderr
+++ b/tests/ui/unsized-locals/issue-50940-with-feature.stderr
diff --git a/src/test/ui/unsized-locals/issue-50940.rs b/tests/ui/unsized-locals/issue-50940.rs
index 7ba809b7e..7ba809b7e 100644
--- a/src/test/ui/unsized-locals/issue-50940.rs
+++ b/tests/ui/unsized-locals/issue-50940.rs
diff --git a/src/test/ui/unsized-locals/issue-50940.stderr b/tests/ui/unsized-locals/issue-50940.stderr
index 8f09b460e..8f09b460e 100644
--- a/src/test/ui/unsized-locals/issue-50940.stderr
+++ b/tests/ui/unsized-locals/issue-50940.stderr
diff --git a/src/test/ui/unsized-locals/reference-unsized-locals.rs b/tests/ui/unsized-locals/reference-unsized-locals.rs
index 4e887f327..4e887f327 100644
--- a/src/test/ui/unsized-locals/reference-unsized-locals.rs
+++ b/tests/ui/unsized-locals/reference-unsized-locals.rs
diff --git a/src/test/ui/unsized-locals/simple-unsized-locals.rs b/tests/ui/unsized-locals/simple-unsized-locals.rs
index 02b7c299a..02b7c299a 100644
--- a/src/test/ui/unsized-locals/simple-unsized-locals.rs
+++ b/tests/ui/unsized-locals/simple-unsized-locals.rs
diff --git a/tests/ui/unsized-locals/suggest-borrow.rs b/tests/ui/unsized-locals/suggest-borrow.rs
new file mode 100644
index 000000000..086948579
--- /dev/null
+++ b/tests/ui/unsized-locals/suggest-borrow.rs
@@ -0,0 +1,7 @@
+fn main() {
+ let x: [u8] = vec!(1, 2, 3)[..]; //~ ERROR E0277
+ let x: &[u8] = vec!(1, 2, 3)[..]; //~ ERROR E0308
+ let x: [u8] = &vec!(1, 2, 3)[..]; //~ ERROR E0308
+ //~^ ERROR E0277
+ let x: &[u8] = &vec!(1, 2, 3)[..];
+}
diff --git a/tests/ui/unsized-locals/suggest-borrow.stderr b/tests/ui/unsized-locals/suggest-borrow.stderr
new file mode 100644
index 000000000..08745eab2
--- /dev/null
+++ b/tests/ui/unsized-locals/suggest-borrow.stderr
@@ -0,0 +1,60 @@
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/suggest-borrow.rs:2:9
+ |
+LL | let x: [u8] = vec!(1, 2, 3)[..];
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+help: consider borrowing here
+ |
+LL | let x: &[u8] = vec!(1, 2, 3)[..];
+ | +
+
+error[E0308]: mismatched types
+ --> $DIR/suggest-borrow.rs:3:20
+ |
+LL | let x: &[u8] = vec!(1, 2, 3)[..];
+ | ----- ^^^^^^^^^^^^^^^^^
+ | | |
+ | | expected `&[u8]`, found slice `[{integer}]`
+ | | help: consider borrowing here: `&vec!(1, 2, 3)[..]`
+ | expected due to this
+
+error[E0308]: mismatched types
+ --> $DIR/suggest-borrow.rs:4:19
+ |
+LL | let x: [u8] = &vec!(1, 2, 3)[..];
+ | ---- ^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `&[{integer}]`
+ | |
+ | expected due to this
+ |
+help: consider removing the borrow
+ |
+LL - let x: [u8] = &vec!(1, 2, 3)[..];
+LL + let x: [u8] = vec!(1, 2, 3)[..];
+ |
+help: alternatively, consider changing the type annotation
+ |
+LL | let x: &[u8] = &vec!(1, 2, 3)[..];
+ | +
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/suggest-borrow.rs:4:9
+ |
+LL | let x: [u8] = &vec!(1, 2, 3)[..];
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+help: consider borrowing here
+ |
+LL | let x: &[u8] = &vec!(1, 2, 3)[..];
+ | +
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/unsized-locals/unsized-exprs-rpass.rs b/tests/ui/unsized-locals/unsized-exprs-rpass.rs
index 175b02fcb..175b02fcb 100644
--- a/src/test/ui/unsized-locals/unsized-exprs-rpass.rs
+++ b/tests/ui/unsized-locals/unsized-exprs-rpass.rs
diff --git a/src/test/ui/unsized-locals/unsized-exprs.rs b/tests/ui/unsized-locals/unsized-exprs.rs
index 1729b9ffa..1729b9ffa 100644
--- a/src/test/ui/unsized-locals/unsized-exprs.rs
+++ b/tests/ui/unsized-locals/unsized-exprs.rs
diff --git a/src/test/ui/unsized-locals/unsized-exprs.stderr b/tests/ui/unsized-locals/unsized-exprs.stderr
index a7f57e3fd..a7f57e3fd 100644
--- a/src/test/ui/unsized-locals/unsized-exprs.stderr
+++ b/tests/ui/unsized-locals/unsized-exprs.stderr
diff --git a/src/test/ui/unsized-locals/unsized-exprs2.rs b/tests/ui/unsized-locals/unsized-exprs2.rs
index 127d8717e..127d8717e 100644
--- a/src/test/ui/unsized-locals/unsized-exprs2.rs
+++ b/tests/ui/unsized-locals/unsized-exprs2.rs
diff --git a/src/test/ui/unsized-locals/unsized-exprs2.stderr b/tests/ui/unsized-locals/unsized-exprs2.stderr
index 88269f237..88269f237 100644
--- a/src/test/ui/unsized-locals/unsized-exprs2.stderr
+++ b/tests/ui/unsized-locals/unsized-exprs2.stderr
diff --git a/src/test/ui/unsized-locals/unsized-exprs3.rs b/tests/ui/unsized-locals/unsized-exprs3.rs
index 2133b01e0..2133b01e0 100644
--- a/src/test/ui/unsized-locals/unsized-exprs3.rs
+++ b/tests/ui/unsized-locals/unsized-exprs3.rs
diff --git a/src/test/ui/unsized-locals/unsized-exprs3.stderr b/tests/ui/unsized-locals/unsized-exprs3.stderr
index 57d997822..57d997822 100644
--- a/src/test/ui/unsized-locals/unsized-exprs3.stderr
+++ b/tests/ui/unsized-locals/unsized-exprs3.stderr
diff --git a/src/test/ui/unsized-locals/unsized-index.rs b/tests/ui/unsized-locals/unsized-index.rs
index e8782e894..e8782e894 100644
--- a/src/test/ui/unsized-locals/unsized-index.rs
+++ b/tests/ui/unsized-locals/unsized-index.rs
diff --git a/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs b/tests/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs
index 15263954c..15263954c 100644
--- a/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs
+++ b/tests/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs
diff --git a/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr b/tests/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr
index da7702667..ace5a8718 100644
--- a/src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr
+++ b/tests/ui/unsized-locals/unsized-locals-using-unsized-fn-params.stderr
@@ -27,6 +27,10 @@ LL | let _foo: [u8] = *foo;
= help: the trait `Sized` is not implemented for `[u8]`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
+help: consider borrowing here
+ |
+LL | let _foo: &[u8] = *foo;
+ | +
error: aborting due to 3 previous errors
diff --git a/src/test/ui/unsized-locals/unsized-parameters.rs b/tests/ui/unsized-locals/unsized-parameters.rs
index a1b772a7e..a1b772a7e 100644
--- a/src/test/ui/unsized-locals/unsized-parameters.rs
+++ b/tests/ui/unsized-locals/unsized-parameters.rs
diff --git a/src/test/ui/unsized/box-instead-of-dyn-fn.rs b/tests/ui/unsized/box-instead-of-dyn-fn.rs
index 2fa741bc1..2fa741bc1 100644
--- a/src/test/ui/unsized/box-instead-of-dyn-fn.rs
+++ b/tests/ui/unsized/box-instead-of-dyn-fn.rs
diff --git a/src/test/ui/unsized/box-instead-of-dyn-fn.stderr b/tests/ui/unsized/box-instead-of-dyn-fn.stderr
index c96c59afc..c96c59afc 100644
--- a/src/test/ui/unsized/box-instead-of-dyn-fn.stderr
+++ b/tests/ui/unsized/box-instead-of-dyn-fn.stderr
diff --git a/src/test/ui/unsized/issue-30355.rs b/tests/ui/unsized/issue-30355.rs
index 6ff5b37f6..6ff5b37f6 100644
--- a/src/test/ui/unsized/issue-30355.rs
+++ b/tests/ui/unsized/issue-30355.rs
diff --git a/src/test/ui/unsized/issue-30355.stderr b/tests/ui/unsized/issue-30355.stderr
index 71bbdf5de..71bbdf5de 100644
--- a/src/test/ui/unsized/issue-30355.stderr
+++ b/tests/ui/unsized/issue-30355.stderr
diff --git a/src/test/ui/unsized/issue-40231-1.rs b/tests/ui/unsized/issue-40231-1.rs
index 999399ec8..999399ec8 100644
--- a/src/test/ui/unsized/issue-40231-1.rs
+++ b/tests/ui/unsized/issue-40231-1.rs
diff --git a/src/test/ui/unsized/issue-40231-2.rs b/tests/ui/unsized/issue-40231-2.rs
index 780433b28..780433b28 100644
--- a/src/test/ui/unsized/issue-40231-2.rs
+++ b/tests/ui/unsized/issue-40231-2.rs
diff --git a/src/test/ui/unsized/issue-71659.rs b/tests/ui/unsized/issue-71659.rs
index 3524ca02b..3524ca02b 100644
--- a/src/test/ui/unsized/issue-71659.rs
+++ b/tests/ui/unsized/issue-71659.rs
diff --git a/tests/ui/unsized/issue-71659.stderr b/tests/ui/unsized/issue-71659.stderr
new file mode 100644
index 000000000..d7b95f557
--- /dev/null
+++ b/tests/ui/unsized/issue-71659.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied
+ --> $DIR/issue-71659.rs:30:15
+ |
+LL | let x = x.cast::<[i32]>();
+ | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo`
+ |
+note: required by a bound in `Cast::cast`
+ --> $DIR/issue-71659.rs:19:15
+ |
+LL | fn cast<T: ?Sized>(&self) -> &T
+ | ---- required by a bound in this
+LL | where
+LL | Self: CastTo<T>,
+ | ^^^^^^^^^ required by this bound in `Cast::cast`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/unsized/issue-75707.rs b/tests/ui/unsized/issue-75707.rs
index 9f04cdbb9..9f04cdbb9 100644
--- a/src/test/ui/unsized/issue-75707.rs
+++ b/tests/ui/unsized/issue-75707.rs
diff --git a/src/test/ui/unsized/issue-75707.stderr b/tests/ui/unsized/issue-75707.stderr
index 97618ed05..97618ed05 100644
--- a/src/test/ui/unsized/issue-75707.stderr
+++ b/tests/ui/unsized/issue-75707.stderr
diff --git a/src/test/ui/unsized/issue-75899-but-gats.rs b/tests/ui/unsized/issue-75899-but-gats.rs
index 5716817f4..5716817f4 100644
--- a/src/test/ui/unsized/issue-75899-but-gats.rs
+++ b/tests/ui/unsized/issue-75899-but-gats.rs
diff --git a/src/test/ui/unsized/issue-75899.rs b/tests/ui/unsized/issue-75899.rs
index abff17e11..abff17e11 100644
--- a/src/test/ui/unsized/issue-75899.rs
+++ b/tests/ui/unsized/issue-75899.rs
diff --git a/src/test/ui/unsized/issue-91801.rs b/tests/ui/unsized/issue-91801.rs
index 096b1a935..096b1a935 100644
--- a/src/test/ui/unsized/issue-91801.rs
+++ b/tests/ui/unsized/issue-91801.rs
diff --git a/src/test/ui/unsized/issue-91801.stderr b/tests/ui/unsized/issue-91801.stderr
index 8795aa168..8795aa168 100644
--- a/src/test/ui/unsized/issue-91801.stderr
+++ b/tests/ui/unsized/issue-91801.stderr
diff --git a/src/test/ui/unsized/issue-91803.rs b/tests/ui/unsized/issue-91803.rs
index c74897cc4..c74897cc4 100644
--- a/src/test/ui/unsized/issue-91803.rs
+++ b/tests/ui/unsized/issue-91803.rs
diff --git a/src/test/ui/unsized/issue-91803.stderr b/tests/ui/unsized/issue-91803.stderr
index 2dad9e892..2dad9e892 100644
--- a/src/test/ui/unsized/issue-91803.stderr
+++ b/tests/ui/unsized/issue-91803.stderr
diff --git a/src/test/ui/unsized/issue-97732.rs b/tests/ui/unsized/issue-97732.rs
index 72f765033..72f765033 100644
--- a/src/test/ui/unsized/issue-97732.rs
+++ b/tests/ui/unsized/issue-97732.rs
diff --git a/src/test/ui/unsized/maybe-bounds-where-cpass.rs b/tests/ui/unsized/maybe-bounds-where-cpass.rs
index 0e018cdab..0e018cdab 100644
--- a/src/test/ui/unsized/maybe-bounds-where-cpass.rs
+++ b/tests/ui/unsized/maybe-bounds-where-cpass.rs
diff --git a/src/test/ui/unsized/maybe-bounds-where.rs b/tests/ui/unsized/maybe-bounds-where.rs
index d7af0c424..d7af0c424 100644
--- a/src/test/ui/unsized/maybe-bounds-where.rs
+++ b/tests/ui/unsized/maybe-bounds-where.rs
diff --git a/src/test/ui/unsized/maybe-bounds-where.stderr b/tests/ui/unsized/maybe-bounds-where.stderr
index 39bc1b88e..39bc1b88e 100644
--- a/src/test/ui/unsized/maybe-bounds-where.stderr
+++ b/tests/ui/unsized/maybe-bounds-where.stderr
diff --git a/src/test/ui/unsized/param-mentioned-by-different-field.rs b/tests/ui/unsized/param-mentioned-by-different-field.rs
index cda94b306..cda94b306 100644
--- a/src/test/ui/unsized/param-mentioned-by-different-field.rs
+++ b/tests/ui/unsized/param-mentioned-by-different-field.rs
diff --git a/src/test/ui/unsized/param-mentioned-by-different-field.stderr b/tests/ui/unsized/param-mentioned-by-different-field.stderr
index d18fa6456..d18fa6456 100644
--- a/src/test/ui/unsized/param-mentioned-by-different-field.stderr
+++ b/tests/ui/unsized/param-mentioned-by-different-field.stderr
diff --git a/src/test/ui/unsized/return-unsized-from-trait-method.rs b/tests/ui/unsized/return-unsized-from-trait-method.rs
index f053f4b0a..f053f4b0a 100644
--- a/src/test/ui/unsized/return-unsized-from-trait-method.rs
+++ b/tests/ui/unsized/return-unsized-from-trait-method.rs
diff --git a/src/test/ui/unsized/return-unsized-from-trait-method.stderr b/tests/ui/unsized/return-unsized-from-trait-method.stderr
index 671d40993..671d40993 100644
--- a/src/test/ui/unsized/return-unsized-from-trait-method.stderr
+++ b/tests/ui/unsized/return-unsized-from-trait-method.stderr
diff --git a/src/test/ui/unsized/unchanged-param.rs b/tests/ui/unsized/unchanged-param.rs
index 6bdc89310..6bdc89310 100644
--- a/src/test/ui/unsized/unchanged-param.rs
+++ b/tests/ui/unsized/unchanged-param.rs
diff --git a/src/test/ui/unsized/unsized-bare-typaram.rs b/tests/ui/unsized/unsized-bare-typaram.rs
index e611da915..e611da915 100644
--- a/src/test/ui/unsized/unsized-bare-typaram.rs
+++ b/tests/ui/unsized/unsized-bare-typaram.rs
diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/tests/ui/unsized/unsized-bare-typaram.stderr
index 1eff14be8..1eff14be8 100644
--- a/src/test/ui/unsized/unsized-bare-typaram.stderr
+++ b/tests/ui/unsized/unsized-bare-typaram.stderr
diff --git a/src/test/ui/unsized/unsized-enum.rs b/tests/ui/unsized/unsized-enum.rs
index 02ad1c878..02ad1c878 100644
--- a/src/test/ui/unsized/unsized-enum.rs
+++ b/tests/ui/unsized/unsized-enum.rs
diff --git a/src/test/ui/unsized/unsized-enum.stderr b/tests/ui/unsized/unsized-enum.stderr
index 5f2e22430..5f2e22430 100644
--- a/src/test/ui/unsized/unsized-enum.stderr
+++ b/tests/ui/unsized/unsized-enum.stderr
diff --git a/src/test/ui/unsized/unsized-enum2.rs b/tests/ui/unsized/unsized-enum2.rs
index d589f5ae5..d589f5ae5 100644
--- a/src/test/ui/unsized/unsized-enum2.rs
+++ b/tests/ui/unsized/unsized-enum2.rs
diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/tests/ui/unsized/unsized-enum2.stderr
index 00b80327c..00b80327c 100644
--- a/src/test/ui/unsized/unsized-enum2.stderr
+++ b/tests/ui/unsized/unsized-enum2.stderr
diff --git a/src/test/ui/unsized/unsized-fn-arg.fixed b/tests/ui/unsized/unsized-fn-arg.fixed
index fd9b159a4..fd9b159a4 100644
--- a/src/test/ui/unsized/unsized-fn-arg.fixed
+++ b/tests/ui/unsized/unsized-fn-arg.fixed
diff --git a/src/test/ui/unsized/unsized-fn-arg.rs b/tests/ui/unsized/unsized-fn-arg.rs
index 9fc08bd6d..9fc08bd6d 100644
--- a/src/test/ui/unsized/unsized-fn-arg.rs
+++ b/tests/ui/unsized/unsized-fn-arg.rs
diff --git a/src/test/ui/unsized/unsized-fn-arg.stderr b/tests/ui/unsized/unsized-fn-arg.stderr
index 404fa5291..404fa5291 100644
--- a/src/test/ui/unsized/unsized-fn-arg.stderr
+++ b/tests/ui/unsized/unsized-fn-arg.stderr
diff --git a/src/test/ui/unsized/unsized-fn-param.rs b/tests/ui/unsized/unsized-fn-param.rs
index 32efc7e17..32efc7e17 100644
--- a/src/test/ui/unsized/unsized-fn-param.rs
+++ b/tests/ui/unsized/unsized-fn-param.rs
diff --git a/src/test/ui/unsized/unsized-fn-param.stderr b/tests/ui/unsized/unsized-fn-param.stderr
index b47726054..b47726054 100644
--- a/src/test/ui/unsized/unsized-fn-param.stderr
+++ b/tests/ui/unsized/unsized-fn-param.stderr
diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.rs b/tests/ui/unsized/unsized-inherent-impl-self-type.rs
index 8bdf80c94..8bdf80c94 100644
--- a/src/test/ui/unsized/unsized-inherent-impl-self-type.rs
+++ b/tests/ui/unsized/unsized-inherent-impl-self-type.rs
diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/tests/ui/unsized/unsized-inherent-impl-self-type.stderr
index a952aa063..a952aa063 100644
--- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr
+++ b/tests/ui/unsized/unsized-inherent-impl-self-type.stderr
diff --git a/src/test/ui/unsized/unsized-struct.rs b/tests/ui/unsized/unsized-struct.rs
index bfa5aa0a5..bfa5aa0a5 100644
--- a/src/test/ui/unsized/unsized-struct.rs
+++ b/tests/ui/unsized/unsized-struct.rs
diff --git a/src/test/ui/unsized/unsized-struct.stderr b/tests/ui/unsized/unsized-struct.stderr
index dff1b0a51..dff1b0a51 100644
--- a/src/test/ui/unsized/unsized-struct.stderr
+++ b/tests/ui/unsized/unsized-struct.stderr
diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.rs b/tests/ui/unsized/unsized-trait-impl-self-type.rs
index df571a833..df571a833 100644
--- a/src/test/ui/unsized/unsized-trait-impl-self-type.rs
+++ b/tests/ui/unsized/unsized-trait-impl-self-type.rs
diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
index f6ba9a80c..f6ba9a80c 100644
--- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.rs b/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
index 96e7e371f..96e7e371f 100644
--- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.rs
+++ b/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
index f81487d52..f81487d52 100644
--- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
diff --git a/src/test/ui/unsized/unsized-tuple-impls.rs b/tests/ui/unsized/unsized-tuple-impls.rs
index 5e385f33b..5e385f33b 100644
--- a/src/test/ui/unsized/unsized-tuple-impls.rs
+++ b/tests/ui/unsized/unsized-tuple-impls.rs
diff --git a/src/test/ui/unsized/unsized.rs b/tests/ui/unsized/unsized.rs
index 54304834d..54304834d 100644
--- a/src/test/ui/unsized/unsized.rs
+++ b/tests/ui/unsized/unsized.rs
diff --git a/src/test/ui/unsized/unsized2.rs b/tests/ui/unsized/unsized2.rs
index bbeb00d5f..bbeb00d5f 100644
--- a/src/test/ui/unsized/unsized2.rs
+++ b/tests/ui/unsized/unsized2.rs
diff --git a/src/test/ui/unsized/unsized3-rpass.rs b/tests/ui/unsized/unsized3-rpass.rs
index 4d5e89575..4d5e89575 100644
--- a/src/test/ui/unsized/unsized3-rpass.rs
+++ b/tests/ui/unsized/unsized3-rpass.rs
diff --git a/src/test/ui/unsized/unsized3.rs b/tests/ui/unsized/unsized3.rs
index af76aca2c..af76aca2c 100644
--- a/src/test/ui/unsized/unsized3.rs
+++ b/tests/ui/unsized/unsized3.rs
diff --git a/src/test/ui/unsized/unsized3.stderr b/tests/ui/unsized/unsized3.stderr
index 9ad1ac6b4..9ad1ac6b4 100644
--- a/src/test/ui/unsized/unsized3.stderr
+++ b/tests/ui/unsized/unsized3.stderr
diff --git a/src/test/ui/unsized/unsized5.rs b/tests/ui/unsized/unsized5.rs
index befd2244d..befd2244d 100644
--- a/src/test/ui/unsized/unsized5.rs
+++ b/tests/ui/unsized/unsized5.rs
diff --git a/src/test/ui/unsized/unsized5.stderr b/tests/ui/unsized/unsized5.stderr
index 03ed0c457..03ed0c457 100644
--- a/src/test/ui/unsized/unsized5.stderr
+++ b/tests/ui/unsized/unsized5.stderr
diff --git a/src/test/ui/unsized/unsized6.rs b/tests/ui/unsized/unsized6.rs
index 79133554d..79133554d 100644
--- a/src/test/ui/unsized/unsized6.rs
+++ b/tests/ui/unsized/unsized6.rs
diff --git a/src/test/ui/unsized/unsized6.stderr b/tests/ui/unsized/unsized6.stderr
index 011f2b426..18ac1ea18 100644
--- a/src/test/ui/unsized/unsized6.stderr
+++ b/tests/ui/unsized/unsized6.stderr
@@ -14,6 +14,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
LL - fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
LL + fn f1<W: ?Sized, X: ?Sized, Y, Z: ?Sized>(x: &X) {
|
+help: consider borrowing here
+ |
+LL | let y: &Y;
+ | +
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized6.rs:7:12
@@ -62,6 +66,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
LL - fn f2<X: ?Sized, Y: ?Sized>(x: &X) {
LL + fn f2<X, Y: ?Sized>(x: &X) {
|
+help: consider borrowing here
+ |
+LL | let y: &X;
+ | +
error[E0277]: the size for values of type `Y` cannot be known at compilation time
--> $DIR/unsized6.rs:17:12
@@ -94,6 +102,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
+help: consider borrowing here
+ |
+LL | let y: &X = *x1;
+ | +
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized6.rs:24:9
@@ -144,6 +156,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
+help: consider borrowing here
+ |
+LL | let y: &X = *x1;
+ | +
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized6.rs:32:9
diff --git a/src/test/ui/unsized/unsized7.rs b/tests/ui/unsized/unsized7.rs
index 422a78481..422a78481 100644
--- a/src/test/ui/unsized/unsized7.rs
+++ b/tests/ui/unsized/unsized7.rs
diff --git a/src/test/ui/unsized/unsized7.stderr b/tests/ui/unsized/unsized7.stderr
index 1555b9df4..1555b9df4 100644
--- a/src/test/ui/unsized/unsized7.stderr
+++ b/tests/ui/unsized/unsized7.stderr