summaryrefslogtreecommitdiffstats
path: root/tests/ui/binop
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/binop')
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.fixed10
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.rs10
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.stderr17
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.fixed b/tests/ui/binop/false-binop-caused-by-missing-semi.fixed
new file mode 100644
index 000000000..b47372c90
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+fn foo() {}
+fn main() {
+ let mut y = 42;
+ let x = &mut y;
+ foo();
+ *x = 0; //~ ERROR invalid left-hand side of assignment
+ let _ = x;
+ println!("{y}");
+}
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.rs b/tests/ui/binop/false-binop-caused-by-missing-semi.rs
new file mode 100644
index 000000000..14671de7e
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+fn foo() {}
+fn main() {
+ let mut y = 42;
+ let x = &mut y;
+ foo()
+ *x = 0; //~ ERROR invalid left-hand side of assignment
+ let _ = x;
+ println!("{y}");
+}
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.stderr b/tests/ui/binop/false-binop-caused-by-missing-semi.stderr
new file mode 100644
index 000000000..fca042b1c
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.stderr
@@ -0,0 +1,17 @@
+error[E0070]: invalid left-hand side of assignment
+ --> $DIR/false-binop-caused-by-missing-semi.rs:7:8
+ |
+LL | / foo()
+LL | | *x = 0;
+ | | - ^
+ | |______|
+ | cannot assign to this expression
+ |
+help: you might have meant to write a semicolon here
+ |
+LL | foo();
+ | +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0070`.