summaryrefslogtreecommitdiffstats
path: root/tests/ui/unsized
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/ui/unsized
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/unsized')
-rw-r--r--tests/ui/unsized/issue-115203.rs11
-rw-r--r--tests/ui/unsized/issue-115203.stderr19
-rw-r--r--tests/ui/unsized/issue-115809.rs13
-rw-r--r--tests/ui/unsized/issue-115809.stderr19
-rw-r--r--tests/ui/unsized/issue-75707.stderr5
-rw-r--r--tests/ui/unsized/unsized3.stderr12
6 files changed, 71 insertions, 8 deletions
diff --git a/tests/ui/unsized/issue-115203.rs b/tests/ui/unsized/issue-115203.rs
new file mode 100644
index 000000000..5fe7bd642
--- /dev/null
+++ b/tests/ui/unsized/issue-115203.rs
@@ -0,0 +1,11 @@
+// compile-flags: --emit link
+
+fn main() {
+ let a: [i32; 0] = [];
+ match [a[..]] {
+ //~^ ERROR cannot move a value of type `[i32]
+ //~| ERROR cannot move out of type `[i32]`, a non-copy slice
+ [[]] => (),
+ _ => (),
+ }
+}
diff --git a/tests/ui/unsized/issue-115203.stderr b/tests/ui/unsized/issue-115203.stderr
new file mode 100644
index 000000000..3ee734988
--- /dev/null
+++ b/tests/ui/unsized/issue-115203.stderr
@@ -0,0 +1,19 @@
+error[E0161]: cannot move a value of type `[i32]`
+ --> $DIR/issue-115203.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^ the size of `[i32]` cannot be statically determined
+
+error[E0508]: cannot move out of type `[i32]`, a non-copy slice
+ --> $DIR/issue-115203.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^
+ | |
+ | cannot move out of here
+ | move occurs because value has type `[i32]`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/tests/ui/unsized/issue-115809.rs b/tests/ui/unsized/issue-115809.rs
new file mode 100644
index 000000000..ff25365ea
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.rs
@@ -0,0 +1,13 @@
+// compile-flags: --emit=link -Zmir-opt-level=2 -Zpolymorphize=on
+
+fn foo<T>() {
+ let a: [i32; 0] = [];
+ match [a[..]] {
+ //~^ ERROR cannot move a value of type `[i32]
+ //~| ERROR cannot move out of type `[i32]`, a non-copy slice
+ [[x]] => {}
+ _ => (),
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/unsized/issue-115809.stderr b/tests/ui/unsized/issue-115809.stderr
new file mode 100644
index 000000000..a92554b79
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.stderr
@@ -0,0 +1,19 @@
+error[E0161]: cannot move a value of type `[i32]`
+ --> $DIR/issue-115809.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^ the size of `[i32]` cannot be statically determined
+
+error[E0508]: cannot move out of type `[i32]`, a non-copy slice
+ --> $DIR/issue-115809.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^
+ | |
+ | cannot move out of here
+ | move occurs because value has type `[i32]`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/tests/ui/unsized/issue-75707.stderr b/tests/ui/unsized/issue-75707.stderr
index 97618ed05..aa7f9c78f 100644
--- a/tests/ui/unsized/issue-75707.stderr
+++ b/tests/ui/unsized/issue-75707.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `MyCall: Callback` is not satisfied
LL | f::<dyn Processing<Call = MyCall>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-75707.rs:1:1
+ |
+LL | pub trait Callback {
+ | ^^^^^^^^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/issue-75707.rs:9:9
|
diff --git a/tests/ui/unsized/unsized3.stderr b/tests/ui/unsized/unsized3.stderr
index 3ef9a8753..a11243980 100644
--- a/tests/ui/unsized/unsized3.stderr
+++ b/tests/ui/unsized/unsized3.stderr
@@ -1,12 +1,10 @@
error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized3.rs:7:13
+ --> $DIR/unsized3.rs:7:10
|
LL | fn f1<X: ?Sized>(x: &X) {
| - this type parameter needs to be `Sized`
LL | f2::<X>(x);
- | ------- ^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `f2`
--> $DIR/unsized3.rs:10:7
@@ -24,14 +22,12 @@ LL | fn f2<X: ?Sized>(x: &X) {
| ++++++++
error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized3.rs:18:13
+ --> $DIR/unsized3.rs:18:10
|
LL | fn f3<X: ?Sized + T>(x: &X) {
| - this type parameter needs to be `Sized`
LL | f4::<X>(x);
- | ------- ^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `f4`
--> $DIR/unsized3.rs:21:7