summaryrefslogtreecommitdiffstats
path: root/tests/ui/mut
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/mut
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/mut-function-arguments.rs (renamed from src/test/ui/mut-function-arguments.rs)0
-rw-r--r--tests/ui/mut/mut-cant-alias.rs (renamed from src/test/ui/mut/mut-cant-alias.rs)0
-rw-r--r--tests/ui/mut/mut-cant-alias.stderr (renamed from src/test/ui/mut/mut-cant-alias.stderr)0
-rw-r--r--tests/ui/mut/mut-cross-borrowing.rs (renamed from src/test/ui/mut/mut-cross-borrowing.rs)0
-rw-r--r--tests/ui/mut/mut-cross-borrowing.stderr (renamed from src/test/ui/mut/mut-cross-borrowing.stderr)0
-rw-r--r--tests/ui/mut/mut-pattern-internal-mutability.rs (renamed from src/test/ui/mut/mut-pattern-internal-mutability.rs)0
-rw-r--r--tests/ui/mut/mut-pattern-internal-mutability.stderr (renamed from src/test/ui/mut/mut-pattern-internal-mutability.stderr)0
-rw-r--r--tests/ui/mut/mut-pattern-mismatched.rs (renamed from src/test/ui/mut/mut-pattern-mismatched.rs)0
-rw-r--r--tests/ui/mut/mut-pattern-mismatched.stderr (renamed from src/test/ui/mut/mut-pattern-mismatched.stderr)0
-rw-r--r--tests/ui/mut/mut-ref.rs (renamed from src/test/ui/mut/mut-ref.rs)0
-rw-r--r--tests/ui/mut/mut-ref.stderr (renamed from src/test/ui/mut/mut-ref.stderr)0
-rw-r--r--tests/ui/mut/mut-suggestion.rs (renamed from src/test/ui/mut/mut-suggestion.rs)4
-rw-r--r--tests/ui/mut/mut-suggestion.stderr25
-rw-r--r--tests/ui/mut/mutable-class-fields-2.rs (renamed from src/test/ui/mut/mutable-class-fields-2.rs)0
-rw-r--r--tests/ui/mut/mutable-class-fields-2.stderr14
-rw-r--r--tests/ui/mut/mutable-class-fields.rs (renamed from src/test/ui/mut/mutable-class-fields.rs)0
-rw-r--r--tests/ui/mut/mutable-class-fields.stderr14
-rw-r--r--tests/ui/mut/mutable-enum-indirect.rs (renamed from src/test/ui/mut/mutable-enum-indirect.rs)0
-rw-r--r--tests/ui/mut/mutable-enum-indirect.stderr (renamed from src/test/ui/mut/mutable-enum-indirect.stderr)0
-rw-r--r--tests/ui/mut/no-mut-lint-for-desugared-mut.rs (renamed from src/test/ui/mut/no-mut-lint-for-desugared-mut.rs)0
-rw-r--r--tests/ui/mutexguard-sync.rs (renamed from src/test/ui/mutexguard-sync.rs)0
-rw-r--r--tests/ui/mutexguard-sync.stderr (renamed from src/test/ui/mutexguard-sync.stderr)0
-rw-r--r--tests/ui/mutual-recursion-group.rs (renamed from src/test/ui/mutual-recursion-group.rs)0
23 files changed, 55 insertions, 2 deletions
diff --git a/src/test/ui/mut-function-arguments.rs b/tests/ui/mut-function-arguments.rs
index 1e682fc4b..1e682fc4b 100644
--- a/src/test/ui/mut-function-arguments.rs
+++ b/tests/ui/mut-function-arguments.rs
diff --git a/src/test/ui/mut/mut-cant-alias.rs b/tests/ui/mut/mut-cant-alias.rs
index 9146b931a..9146b931a 100644
--- a/src/test/ui/mut/mut-cant-alias.rs
+++ b/tests/ui/mut/mut-cant-alias.rs
diff --git a/src/test/ui/mut/mut-cant-alias.stderr b/tests/ui/mut/mut-cant-alias.stderr
index 6046c076f..6046c076f 100644
--- a/src/test/ui/mut/mut-cant-alias.stderr
+++ b/tests/ui/mut/mut-cant-alias.stderr
diff --git a/src/test/ui/mut/mut-cross-borrowing.rs b/tests/ui/mut/mut-cross-borrowing.rs
index 080faab73..080faab73 100644
--- a/src/test/ui/mut/mut-cross-borrowing.rs
+++ b/tests/ui/mut/mut-cross-borrowing.rs
diff --git a/src/test/ui/mut/mut-cross-borrowing.stderr b/tests/ui/mut/mut-cross-borrowing.stderr
index ee739d628..ee739d628 100644
--- a/src/test/ui/mut/mut-cross-borrowing.stderr
+++ b/tests/ui/mut/mut-cross-borrowing.stderr
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.rs b/tests/ui/mut/mut-pattern-internal-mutability.rs
index bcee878e3..bcee878e3 100644
--- a/src/test/ui/mut/mut-pattern-internal-mutability.rs
+++ b/tests/ui/mut/mut-pattern-internal-mutability.rs
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.stderr b/tests/ui/mut/mut-pattern-internal-mutability.stderr
index 6583546aa..6583546aa 100644
--- a/src/test/ui/mut/mut-pattern-internal-mutability.stderr
+++ b/tests/ui/mut/mut-pattern-internal-mutability.stderr
diff --git a/src/test/ui/mut/mut-pattern-mismatched.rs b/tests/ui/mut/mut-pattern-mismatched.rs
index 700261fe4..700261fe4 100644
--- a/src/test/ui/mut/mut-pattern-mismatched.rs
+++ b/tests/ui/mut/mut-pattern-mismatched.rs
diff --git a/src/test/ui/mut/mut-pattern-mismatched.stderr b/tests/ui/mut/mut-pattern-mismatched.stderr
index cad1cef51..cad1cef51 100644
--- a/src/test/ui/mut/mut-pattern-mismatched.stderr
+++ b/tests/ui/mut/mut-pattern-mismatched.stderr
diff --git a/src/test/ui/mut/mut-ref.rs b/tests/ui/mut/mut-ref.rs
index 80990b2bf..80990b2bf 100644
--- a/src/test/ui/mut/mut-ref.rs
+++ b/tests/ui/mut/mut-ref.rs
diff --git a/src/test/ui/mut/mut-ref.stderr b/tests/ui/mut/mut-ref.stderr
index e6d4901aa..e6d4901aa 100644
--- a/src/test/ui/mut/mut-ref.stderr
+++ b/tests/ui/mut/mut-ref.stderr
diff --git a/src/test/ui/mut/mut-suggestion.rs b/tests/ui/mut/mut-suggestion.rs
index 3104b20ac..8c269d1e7 100644
--- a/src/test/ui/mut/mut-suggestion.rs
+++ b/tests/ui/mut/mut-suggestion.rs
@@ -8,7 +8,7 @@ impl S {
fn func(arg: S) {
//~^ HELP consider changing this to be mutable
- //~| SUGGESTION mut arg
+ //~| SUGGESTION mut
arg.mutate();
//~^ ERROR cannot borrow `arg` as mutable, as it is not declared as mutable
}
@@ -16,7 +16,7 @@ fn func(arg: S) {
fn main() {
let local = S;
//~^ HELP consider changing this to be mutable
- //~| SUGGESTION mut local
+ //~| SUGGESTION mut
local.mutate();
//~^ ERROR cannot borrow `local` as mutable, as it is not declared as mutable
}
diff --git a/tests/ui/mut/mut-suggestion.stderr b/tests/ui/mut/mut-suggestion.stderr
new file mode 100644
index 000000000..d89c8b413
--- /dev/null
+++ b/tests/ui/mut/mut-suggestion.stderr
@@ -0,0 +1,25 @@
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
+ --> $DIR/mut-suggestion.rs:12:5
+ |
+LL | arg.mutate();
+ | ^^^^^^^^^^^^ cannot borrow as mutable
+ |
+help: consider changing this to be mutable
+ |
+LL | fn func(mut arg: S) {
+ | +++
+
+error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable
+ --> $DIR/mut-suggestion.rs:20:5
+ |
+LL | local.mutate();
+ | ^^^^^^^^^^^^^^ cannot borrow as mutable
+ |
+help: consider changing this to be mutable
+ |
+LL | let mut local = S;
+ | +++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/mut/mutable-class-fields-2.rs b/tests/ui/mut/mutable-class-fields-2.rs
index 30e54dfc9..30e54dfc9 100644
--- a/src/test/ui/mut/mutable-class-fields-2.rs
+++ b/tests/ui/mut/mutable-class-fields-2.rs
diff --git a/tests/ui/mut/mutable-class-fields-2.stderr b/tests/ui/mut/mutable-class-fields-2.stderr
new file mode 100644
index 000000000..c53c6ea30
--- /dev/null
+++ b/tests/ui/mut/mutable-class-fields-2.stderr
@@ -0,0 +1,14 @@
+error[E0594]: cannot assign to `self.how_hungry`, which is behind a `&` reference
+ --> $DIR/mutable-class-fields-2.rs:9:5
+ |
+LL | self.how_hungry -= 5;
+ | ^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this to be a mutable reference
+ |
+LL | pub fn eat(&mut self) {
+ | ~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/mut/mutable-class-fields.rs b/tests/ui/mut/mutable-class-fields.rs
index 30768a1ec..30768a1ec 100644
--- a/src/test/ui/mut/mutable-class-fields.rs
+++ b/tests/ui/mut/mutable-class-fields.rs
diff --git a/tests/ui/mut/mutable-class-fields.stderr b/tests/ui/mut/mutable-class-fields.stderr
new file mode 100644
index 000000000..1d731be8a
--- /dev/null
+++ b/tests/ui/mut/mutable-class-fields.stderr
@@ -0,0 +1,14 @@
+error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
+ --> $DIR/mutable-class-fields.rs:15:3
+ |
+LL | nyan.how_hungry = 0;
+ | ^^^^^^^^^^^^^^^^^^^ cannot assign
+ |
+help: consider changing this to be mutable
+ |
+LL | let mut nyan : Cat = cat(52, 99);
+ | +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/mut/mutable-enum-indirect.rs b/tests/ui/mut/mutable-enum-indirect.rs
index 502859c04..502859c04 100644
--- a/src/test/ui/mut/mutable-enum-indirect.rs
+++ b/tests/ui/mut/mutable-enum-indirect.rs
diff --git a/src/test/ui/mut/mutable-enum-indirect.stderr b/tests/ui/mut/mutable-enum-indirect.stderr
index 9e1f4e1fe..9e1f4e1fe 100644
--- a/src/test/ui/mut/mutable-enum-indirect.stderr
+++ b/tests/ui/mut/mutable-enum-indirect.stderr
diff --git a/src/test/ui/mut/no-mut-lint-for-desugared-mut.rs b/tests/ui/mut/no-mut-lint-for-desugared-mut.rs
index 419d58041..419d58041 100644
--- a/src/test/ui/mut/no-mut-lint-for-desugared-mut.rs
+++ b/tests/ui/mut/no-mut-lint-for-desugared-mut.rs
diff --git a/src/test/ui/mutexguard-sync.rs b/tests/ui/mutexguard-sync.rs
index b56418383..b56418383 100644
--- a/src/test/ui/mutexguard-sync.rs
+++ b/tests/ui/mutexguard-sync.rs
diff --git a/src/test/ui/mutexguard-sync.stderr b/tests/ui/mutexguard-sync.stderr
index 3fbb2ddf1..3fbb2ddf1 100644
--- a/src/test/ui/mutexguard-sync.stderr
+++ b/tests/ui/mutexguard-sync.stderr
diff --git a/src/test/ui/mutual-recursion-group.rs b/tests/ui/mutual-recursion-group.rs
index 86b0f1d84..86b0f1d84 100644
--- a/src/test/ui/mutual-recursion-group.rs
+++ b/tests/ui/mutual-recursion-group.rs