about summary refs log tree commit diff
path: root/src/test/ui/parser/increment-autofix.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/parser/increment-autofix.fixed')
-rw-r--r--src/test/ui/parser/increment-autofix.fixed36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/parser/increment-autofix.fixed b/src/test/ui/parser/increment-autofix.fixed
new file mode 100644
index 00000000000..ad61c4e66d2
--- /dev/null
+++ b/src/test/ui/parser/increment-autofix.fixed
@@ -0,0 +1,36 @@
+// run-rustfix
+
+fn post_regular() {
+    let mut i = 0;
+    { let tmp = i; i += 1; tmp }; //~ ERROR Rust has no postfix increment operator
+    println!("{}", i);
+}
+
+fn post_while() {
+    let mut i = 0;
+    while { let tmp = i; i += 1; tmp } < 5 {
+        //~^ ERROR Rust has no postfix increment operator
+        println!("{}", i);
+    }
+}
+
+fn pre_regular() {
+    let mut i = 0;
+    i += 1; //~ ERROR Rust has no prefix increment operator
+    println!("{}", i);
+}
+
+fn pre_while() {
+    let mut i = 0;
+    while { i += 1; i } < 5 {
+        //~^ ERROR Rust has no prefix increment operator
+        println!("{}", i);
+    }
+}
+
+fn main() {
+    post_regular();
+    post_while();
+    pre_regular();
+    pre_while();
+}