diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2022-03-23 19:47:45 -0700 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2022-03-27 13:54:34 -0700 |
| commit | 4943688e9d0d0f34f2fda188e9a9d2777f90d186 (patch) | |
| tree | a7313add5d3d8bc590453d7180347562324b8b39 /src/test/ui/parser | |
| parent | 86220d6e517225d13c145fd12acfc96f78358170 (diff) | |
| download | rust-4943688e9d0d0f34f2fda188e9a9d2777f90d186.tar.gz rust-4943688e9d0d0f34f2fda188e9a9d2777f90d186.zip | |
Fix from rebase
I changed the test functions to be `pub` rather than called from a `main` function too, for easier future modification of tests.
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/increment-autofix.fixed | 8 | ||||
| -rw-r--r-- | src/test/ui/parser/increment-autofix.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/parser/increment-autofix.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/parser/increment-notfixed.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/parser/increment-notfixed.stderr | 8 |
5 files changed, 27 insertions, 19 deletions
diff --git a/src/test/ui/parser/increment-autofix.fixed b/src/test/ui/parser/increment-autofix.fixed index 24a5ac42ca6..7a426badfc2 100644 --- a/src/test/ui/parser/increment-autofix.fixed +++ b/src/test/ui/parser/increment-autofix.fixed @@ -1,12 +1,12 @@ // run-rustfix -fn pre_regular() { +pub fn pre_regular() { let mut i = 0; i += 1; //~ ERROR Rust has no prefix increment operator println!("{}", i); } -fn pre_while() { +pub fn pre_while() { let mut i = 0; while { i += 1; i } < 5 { //~^ ERROR Rust has no prefix increment operator @@ -14,13 +14,13 @@ fn pre_while() { } } -fn pre_regular_tmp() { +pub fn pre_regular_tmp() { let mut tmp = 0; tmp += 1; //~ ERROR Rust has no prefix increment operator println!("{}", tmp); } -fn pre_while_tmp() { +pub fn pre_while_tmp() { let mut tmp = 0; while { tmp += 1; tmp } < 5 { //~^ ERROR Rust has no prefix increment operator diff --git a/src/test/ui/parser/increment-autofix.rs b/src/test/ui/parser/increment-autofix.rs index b1cfd09e9ec..d38603697a7 100644 --- a/src/test/ui/parser/increment-autofix.rs +++ b/src/test/ui/parser/increment-autofix.rs @@ -1,12 +1,12 @@ // run-rustfix -fn pre_regular() { +pub fn pre_regular() { let mut i = 0; ++i; //~ ERROR Rust has no prefix increment operator println!("{}", i); } -fn pre_while() { +pub fn pre_while() { let mut i = 0; while ++i < 5 { //~^ ERROR Rust has no prefix increment operator @@ -14,13 +14,13 @@ fn pre_while() { } } -fn pre_regular_tmp() { +pub fn pre_regular_tmp() { let mut tmp = 0; ++tmp; //~ ERROR Rust has no prefix increment operator println!("{}", tmp); } -fn pre_while_tmp() { +pub fn pre_while_tmp() { let mut tmp = 0; while ++tmp < 5 { //~^ ERROR Rust has no prefix increment operator diff --git a/src/test/ui/parser/increment-autofix.stderr b/src/test/ui/parser/increment-autofix.stderr index a9dc70ad0d6..593592ba4ab 100644 --- a/src/test/ui/parser/increment-autofix.stderr +++ b/src/test/ui/parser/increment-autofix.stderr @@ -14,7 +14,9 @@ error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:11:11 | LL | while ++i < 5 { - | ^^ not a valid prefix operator + | ----- ^^ not a valid prefix operator + | | + | while parsing the condition of this `while` expression | help: use `+= 1` instead | @@ -37,7 +39,9 @@ error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:25:11 | LL | while ++tmp < 5 { - | ^^ not a valid prefix operator + | ----- ^^ not a valid prefix operator + | | + | while parsing the condition of this `while` expression | help: use `+= 1` instead | diff --git a/src/test/ui/parser/increment-notfixed.rs b/src/test/ui/parser/increment-notfixed.rs index 543f73bf772..15f159e53d2 100644 --- a/src/test/ui/parser/increment-notfixed.rs +++ b/src/test/ui/parser/increment-notfixed.rs @@ -6,13 +6,13 @@ struct Bar { qux: i32, } -fn post_regular() { +pub fn post_regular() { let mut i = 0; i++; //~ ERROR Rust has no postfix increment operator println!("{}", i); } -fn post_while() { +pub fn post_while() { let mut i = 0; while i++ < 5 { //~^ ERROR Rust has no postfix increment operator @@ -20,13 +20,13 @@ fn post_while() { } } -fn post_regular_tmp() { +pub fn post_regular_tmp() { let mut tmp = 0; tmp++; //~ ERROR Rust has no postfix increment operator println!("{}", tmp); } -fn post_while_tmp() { +pub fn post_while_tmp() { let mut tmp = 0; while tmp++ < 5 { //~^ ERROR Rust has no postfix increment operator @@ -34,14 +34,14 @@ fn post_while_tmp() { } } -fn post_field() { +pub fn post_field() { let foo = Foo { bar: Bar { qux: 0 } }; foo.bar.qux++; //~^ ERROR Rust has no postfix increment operator println!("{}", foo.bar.qux); } -fn post_field_tmp() { +pub fn post_field_tmp() { struct S { tmp: i32 } @@ -51,7 +51,7 @@ fn post_field_tmp() { println!("{}", s.tmp); } -fn pre_field() { +pub fn pre_field() { let foo = Foo { bar: Bar { qux: 0 } }; ++foo.bar.qux; //~^ ERROR Rust has no prefix increment operator diff --git a/src/test/ui/parser/increment-notfixed.stderr b/src/test/ui/parser/increment-notfixed.stderr index 75fce91c6ef..f23595da32a 100644 --- a/src/test/ui/parser/increment-notfixed.stderr +++ b/src/test/ui/parser/increment-notfixed.stderr @@ -16,7 +16,9 @@ error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:17:12 | LL | while i++ < 5 { - | ^^ not a valid postfix operator + | ----- ^^ not a valid postfix operator + | | + | while parsing the condition of this `while` expression | help: use `+= 1` instead | @@ -44,7 +46,9 @@ error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:31:14 | LL | while tmp++ < 5 { - | ^^ not a valid postfix operator + | ----- ^^ not a valid postfix operator + | | + | while parsing the condition of this `while` expression | help: use `+= 1` instead | |
