summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/bad-interpolated-block.rs2
-rw-r--r--src/test/ui/parser/bad-interpolated-block.stderr6
-rw-r--r--src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs4
-rw-r--r--src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr24
-rw-r--r--src/test/ui/parser/do-not-suggest-semicolon-before-array.rs8
-rw-r--r--src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr10
-rw-r--r--src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs3
-rw-r--r--src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr8
-rw-r--r--src/test/ui/parser/fn-defined-using-def.rs10
-rw-r--r--src/test/ui/parser/fn-defined-using-def.stderr10
-rw-r--r--src/test/ui/parser/fn-defined-using-fun.rs10
-rw-r--r--src/test/ui/parser/fn-defined-using-fun.stderr10
-rw-r--r--src/test/ui/parser/fn-defined-using-func.rs10
-rw-r--r--src/test/ui/parser/fn-defined-using-func.stderr10
-rw-r--r--src/test/ui/parser/fn-defined-using-function.rs10
-rw-r--r--src/test/ui/parser/fn-defined-using-function.stderr10
-rw-r--r--src/test/ui/parser/fn-header-semantic-fail.rs2
-rw-r--r--src/test/ui/parser/fn-header-semantic-fail.stderr184
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs2
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr20
-rw-r--r--src/test/ui/parser/increment-notfixed.stderr30
-rw-r--r--src/test/ui/parser/issue-100197-mut-let.fixed6
-rw-r--r--src/test/ui/parser/issue-100197-mut-let.rs6
-rw-r--r--src/test/ui/parser/issue-100197-mut-let.stderr8
-rw-r--r--src/test/ui/parser/issue-101477-enum.fixed10
-rw-r--r--src/test/ui/parser/issue-101477-enum.rs10
-rw-r--r--src/test/ui/parser/issue-101477-enum.stderr14
-rw-r--r--src/test/ui/parser/issue-101477-let.fixed6
-rw-r--r--src/test/ui/parser/issue-101477-let.rs6
-rw-r--r--src/test/ui/parser/issue-101477-let.stderr8
-rw-r--r--src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed8
-rw-r--r--src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs8
-rw-r--r--src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr14
-rw-r--r--src/test/ui/parser/issues/issue-14303-enum.rs6
-rw-r--r--src/test/ui/parser/issues/issue-14303-enum.stderr8
-rw-r--r--src/test/ui/parser/issues/issue-14303-fn-def.rs4
-rw-r--r--src/test/ui/parser/issues/issue-14303-fn-def.stderr8
-rw-r--r--src/test/ui/parser/issues/issue-14303-impl.rs6
-rw-r--r--src/test/ui/parser/issues/issue-14303-impl.stderr8
-rw-r--r--src/test/ui/parser/issues/issue-14303-path.rs13
-rw-r--r--src/test/ui/parser/issues/issue-14303-path.stderr9
-rw-r--r--src/test/ui/parser/issues/issue-14303-struct.rs6
-rw-r--r--src/test/ui/parser/issues/issue-14303-struct.stderr8
-rw-r--r--src/test/ui/parser/issues/issue-14303-trait.rs4
-rw-r--r--src/test/ui/parser/issues/issue-14303-trait.stderr8
-rw-r--r--src/test/ui/parser/issues/issue-14303.rs33
-rw-r--r--src/test/ui/parser/issues/issue-14303.stderr39
-rw-r--r--src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr4
-rw-r--r--src/test/ui/parser/issues/issue-89574.stderr4
-rw-r--r--src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr4
-rw-r--r--src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr8
-rw-r--r--src/test/ui/parser/kw-in-trait-bounds.rs47
-rw-r--r--src/test/ui/parser/kw-in-trait-bounds.stderr171
-rw-r--r--src/test/ui/parser/labeled-no-colon-expr.rs2
-rw-r--r--src/test/ui/parser/labeled-no-colon-expr.stderr16
-rw-r--r--src/test/ui/parser/public-instead-of-pub-1.fixed11
-rw-r--r--src/test/ui/parser/public-instead-of-pub-1.rs11
-rw-r--r--src/test/ui/parser/public-instead-of-pub-1.stderr13
-rw-r--r--src/test/ui/parser/public-instead-of-pub-2.rs7
-rw-r--r--src/test/ui/parser/public-instead-of-pub-2.stderr8
-rw-r--r--src/test/ui/parser/public-instead-of-pub-3.fixed9
-rw-r--r--src/test/ui/parser/public-instead-of-pub-3.rs9
-rw-r--r--src/test/ui/parser/public-instead-of-pub-3.stderr13
-rw-r--r--src/test/ui/parser/recover-field-semi.rs16
-rw-r--r--src/test/ui/parser/recover-field-semi.stderr29
-rw-r--r--src/test/ui/parser/recover-labeled-non-block-expr.fixed1
-rw-r--r--src/test/ui/parser/recover-labeled-non-block-expr.rs1
-rw-r--r--src/test/ui/parser/recover-labeled-non-block-expr.stderr12
-rw-r--r--src/test/ui/parser/recover-missing-semi-before-item.fixed61
-rw-r--r--src/test/ui/parser/recover-missing-semi-before-item.rs61
-rw-r--r--src/test/ui/parser/recover-missing-semi-before-item.stderr83
-rw-r--r--src/test/ui/parser/removed-syntax-field-semicolon.rs2
-rw-r--r--src/test/ui/parser/removed-syntax-field-semicolon.stderr4
-rw-r--r--src/test/ui/parser/removed-syntax-static-fn.stderr4
-rw-r--r--src/test/ui/parser/struct-filed-with-attr.fixed18
-rw-r--r--src/test/ui/parser/struct-filed-with-attr.rs18
-rw-r--r--src/test/ui/parser/struct-filed-with-attr.stderr8
-rw-r--r--src/test/ui/parser/struct-literal-in-for.stderr2
-rw-r--r--src/test/ui/parser/suggest-assoc-const.fixed10
-rw-r--r--src/test/ui/parser/suggest-assoc-const.rs10
-rw-r--r--src/test/ui/parser/suggest-assoc-const.stderr8
-rw-r--r--src/test/ui/parser/suggest-const-for-global-var.rs6
-rw-r--r--src/test/ui/parser/suggest-const-for-global-var.stderr8
-rw-r--r--src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed7
-rw-r--r--src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs7
-rw-r--r--src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr15
-rw-r--r--src/test/ui/parser/suggest-semicolon-before-array.fixed11
-rw-r--r--src/test/ui/parser/suggest-semicolon-before-array.rs11
-rw-r--r--src/test/ui/parser/suggest-semicolon-before-array.stderr13
-rw-r--r--src/test/ui/parser/trait-object-delimiters.rs2
-rw-r--r--src/test/ui/parser/trait-object-delimiters.stderr4
-rw-r--r--src/test/ui/parser/trait-object-trait-parens.stderr15
-rw-r--r--src/test/ui/parser/type-alias-where-fixable.fixed2
-rw-r--r--src/test/ui/parser/type-alias-where-fixable.rs2
-rw-r--r--src/test/ui/parser/type-alias-where-fixable.stderr6
-rw-r--r--src/test/ui/parser/type-alias-where.rs2
-rw-r--r--src/test/ui/parser/type-alias-where.stderr4
-rw-r--r--src/test/ui/parser/unnecessary-let.rs11
-rw-r--r--src/test/ui/parser/unnecessary-let.stderr20
99 files changed, 1190 insertions, 288 deletions
diff --git a/src/test/ui/parser/bad-interpolated-block.rs b/src/test/ui/parser/bad-interpolated-block.rs
index 38d53a14b..c6d7ae383 100644
--- a/src/test/ui/parser/bad-interpolated-block.rs
+++ b/src/test/ui/parser/bad-interpolated-block.rs
@@ -1,5 +1,3 @@
-#![feature(label_break_value)]
-
fn main() {}
macro_rules! m {
diff --git a/src/test/ui/parser/bad-interpolated-block.stderr b/src/test/ui/parser/bad-interpolated-block.stderr
index 77933b1bc..2a0999afd 100644
--- a/src/test/ui/parser/bad-interpolated-block.stderr
+++ b/src/test/ui/parser/bad-interpolated-block.stderr
@@ -1,5 +1,5 @@
error: cannot use a `block` macro fragment here
- --> $DIR/bad-interpolated-block.rs:7:15
+ --> $DIR/bad-interpolated-block.rs:5:15
|
LL | 'lab: $b;
| ------^^
@@ -12,7 +12,7 @@ LL | m!({});
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot use a `block` macro fragment here
- --> $DIR/bad-interpolated-block.rs:8:16
+ --> $DIR/bad-interpolated-block.rs:6:16
|
LL | unsafe $b;
| -------^^
@@ -25,7 +25,7 @@ LL | m!({});
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot use a `block` macro fragment here
- --> $DIR/bad-interpolated-block.rs:9:23
+ --> $DIR/bad-interpolated-block.rs:7:23
|
LL | |x: u8| -> () $b;
| ^^ the `block` fragment is within this context
diff --git a/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs
index afbd13e6f..d8346653c 100644
--- a/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs
+++ b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs
@@ -3,7 +3,11 @@
#[cfg(FALSE)]
fn syntax() {
foo::<T = u8, T: Ord, String>();
+ //~^ WARN associated type bounds are unstable
+ //~| WARN unstable syntax
foo::<T = u8, 'a, T: Ord>();
+ //~^ WARN associated type bounds are unstable
+ //~| WARN unstable syntax
}
fn main() {}
diff --git a/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr
new file mode 100644
index 000000000..7e843c7f4
--- /dev/null
+++ b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr
@@ -0,0 +1,24 @@
+warning: associated type bounds are unstable
+ --> $DIR/constraints-before-generic-args-syntactic-pass.rs:5:19
+ |
+LL | foo::<T = u8, T: Ord, String>();
+ | ^^^^^^
+ |
+ = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
+ = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
+ = warning: unstable syntax can change at any point in the future, causing a hard error!
+ = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
+
+warning: associated type bounds are unstable
+ --> $DIR/constraints-before-generic-args-syntactic-pass.rs:8:23
+ |
+LL | foo::<T = u8, 'a, T: Ord>();
+ | ^^^^^^
+ |
+ = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
+ = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
+ = warning: unstable syntax can change at any point in the future, causing a hard error!
+ = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
+
+warning: 2 warnings emitted
+
diff --git a/src/test/ui/parser/do-not-suggest-semicolon-before-array.rs b/src/test/ui/parser/do-not-suggest-semicolon-before-array.rs
new file mode 100644
index 000000000..7ebf3f6b0
--- /dev/null
+++ b/src/test/ui/parser/do-not-suggest-semicolon-before-array.rs
@@ -0,0 +1,8 @@
+fn foo() {}
+
+fn bar() -> [u8; 2] {
+ foo()
+ [1, 3) //~ ERROR expected one of `.`, `?`, `]`, or an operator, found `,`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr b/src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr
new file mode 100644
index 000000000..a9dd52632
--- /dev/null
+++ b/src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr
@@ -0,0 +1,10 @@
+error: expected one of `.`, `?`, `]`, or an operator, found `,`
+ --> $DIR/do-not-suggest-semicolon-before-array.rs:5:5
+ |
+LL | [1, 3)
+ | ^ ^ help: `]` may belong here
+ | |
+ | unclosed delimiter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs
new file mode 100644
index 000000000..d6f798181
--- /dev/null
+++ b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs
@@ -0,0 +1,3 @@
+fn main() {
+ let _x = vec[1, 2, 3]; //~ ERROR expected one of `.`, `?`, `]`, or an operator
+}
diff --git a/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr
new file mode 100644
index 000000000..2fe6a28ee
--- /dev/null
+++ b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr
@@ -0,0 +1,8 @@
+error: expected one of `.`, `?`, `]`, or an operator, found `,`
+ --> $DIR/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs:2:19
+ |
+LL | let _x = vec[1, 2, 3];
+ | ^ expected one of `.`, `?`, `]`, or an operator
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/fn-defined-using-def.rs b/src/test/ui/parser/fn-defined-using-def.rs
new file mode 100644
index 000000000..21da34c47
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-def.rs
@@ -0,0 +1,10 @@
+// Check what happens when `def` is used to define a function, instead of `fn`
+// edition:2021
+
+#![allow(dead_code)]
+
+def foo() {}
+//~^ ERROR expected one of `!` or `::`, found `foo`
+//~^^ HELP write `fn` instead of `def` to declare a function
+
+fn main() {}
diff --git a/src/test/ui/parser/fn-defined-using-def.stderr b/src/test/ui/parser/fn-defined-using-def.stderr
new file mode 100644
index 000000000..f34329012
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-def.stderr
@@ -0,0 +1,10 @@
+error: expected one of `!` or `::`, found `foo`
+ --> $DIR/fn-defined-using-def.rs:6:5
+ |
+LL | def foo() {}
+ | --- ^^^ expected one of `!` or `::`
+ | |
+ | help: write `fn` instead of `def` to declare a function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/fn-defined-using-fun.rs b/src/test/ui/parser/fn-defined-using-fun.rs
new file mode 100644
index 000000000..4f7460504
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-fun.rs
@@ -0,0 +1,10 @@
+// Check what happens when `fun` is used to define a function, instead of `fn`
+// edition:2021
+
+#![allow(dead_code)]
+
+fun foo() {}
+//~^ ERROR expected one of `!` or `::`, found `foo`
+//~^^ HELP write `fn` instead of `fun` to declare a function
+
+fn main() {}
diff --git a/src/test/ui/parser/fn-defined-using-fun.stderr b/src/test/ui/parser/fn-defined-using-fun.stderr
new file mode 100644
index 000000000..2f6cfff35
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-fun.stderr
@@ -0,0 +1,10 @@
+error: expected one of `!` or `::`, found `foo`
+ --> $DIR/fn-defined-using-fun.rs:6:5
+ |
+LL | fun foo() {}
+ | --- ^^^ expected one of `!` or `::`
+ | |
+ | help: write `fn` instead of `fun` to declare a function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/fn-defined-using-func.rs b/src/test/ui/parser/fn-defined-using-func.rs
new file mode 100644
index 000000000..2dce96fdc
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-func.rs
@@ -0,0 +1,10 @@
+// Check what happens when `func` is used to define a function, instead of `fn`
+// edition:2021
+
+#![allow(dead_code)]
+
+func foo() {}
+//~^ ERROR expected one of `!` or `::`, found `foo`
+//~^^ HELP write `fn` instead of `func` to declare a function
+
+fn main() {}
diff --git a/src/test/ui/parser/fn-defined-using-func.stderr b/src/test/ui/parser/fn-defined-using-func.stderr
new file mode 100644
index 000000000..355741e89
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-func.stderr
@@ -0,0 +1,10 @@
+error: expected one of `!` or `::`, found `foo`
+ --> $DIR/fn-defined-using-func.rs:6:6
+ |
+LL | func foo() {}
+ | ---- ^^^ expected one of `!` or `::`
+ | |
+ | help: write `fn` instead of `func` to declare a function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/fn-defined-using-function.rs b/src/test/ui/parser/fn-defined-using-function.rs
new file mode 100644
index 000000000..fd8782728
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-function.rs
@@ -0,0 +1,10 @@
+// Check what happens when `function` is used to define a function, instead of `fn`
+// edition:2021
+
+#![allow(dead_code)]
+
+function foo() {}
+//~^ ERROR expected one of `!` or `::`, found `foo`
+//~^^ HELP write `fn` instead of `function` to declare a function
+
+fn main() {}
diff --git a/src/test/ui/parser/fn-defined-using-function.stderr b/src/test/ui/parser/fn-defined-using-function.stderr
new file mode 100644
index 000000000..43c33a2cd
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-function.stderr
@@ -0,0 +1,10 @@
+error: expected one of `!` or `::`, found `foo`
+ --> $DIR/fn-defined-using-function.rs:6:10
+ |
+LL | function foo() {}
+ | -------- ^^^ expected one of `!` or `::`
+ | |
+ | help: write `fn` instead of `function` to declare a function
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/fn-header-semantic-fail.rs b/src/test/ui/parser/fn-header-semantic-fail.rs
index 8ff14fb1f..cf5d3dab4 100644
--- a/src/test/ui/parser/fn-header-semantic-fail.rs
+++ b/src/test/ui/parser/fn-header-semantic-fail.rs
@@ -27,7 +27,6 @@ fn main() {
struct Y;
impl X for Y {
async fn ft1() {} //~ ERROR functions in traits cannot be declared `async`
- //~^ ERROR has an incompatible type for trait
unsafe fn ft2() {} // OK.
const fn ft3() {} //~ ERROR functions in traits cannot be declared const
extern "C" fn ft4() {}
@@ -36,7 +35,6 @@ fn main() {
//~| ERROR functions in traits cannot be declared const
//~| ERROR functions cannot be both `const` and `async`
//~| ERROR cycle detected
- //~| ERROR has an incompatible type for trait
}
impl Y {
diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr
index bc51ba8b8..36304779d 100644
--- a/src/test/ui/parser/fn-header-semantic-fail.stderr
+++ b/src/test/ui/parser/fn-header-semantic-fail.stderr
@@ -7,17 +7,6 @@ LL | const async unsafe extern "C" fn ff5() {}
| | `async` because of this
| `const` because of this
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:17:9
- |
-LL | async fn ft1();
- | -----^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
-
error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:19:9
|
@@ -30,17 +19,6 @@ error[E0379]: functions in traits cannot be declared const
LL | const async unsafe extern "C" fn ft5();
| ^^^^^ functions in traits cannot be const
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:21:9
- |
-LL | const async unsafe extern "C" fn ft5();
- | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
-
error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:21:9
|
@@ -50,42 +28,20 @@ LL | const async unsafe extern "C" fn ft5();
| | `async` because of this
| `const` because of this
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:29:9
- |
-LL | async fn ft1() {}
- | -----^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
-
error[E0379]: functions in traits cannot be declared const
- --> $DIR/fn-header-semantic-fail.rs:32:9
+ --> $DIR/fn-header-semantic-fail.rs:31:9
|
LL | const fn ft3() {}
| ^^^^^ functions in traits cannot be const
error[E0379]: functions in traits cannot be declared const
- --> $DIR/fn-header-semantic-fail.rs:34:9
+ --> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^ functions in traits cannot be const
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:34:9
- |
-LL | const async unsafe extern "C" fn ft5() {}
- | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
-
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:34:9
+ --> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^-^^^^^------------------------------
@@ -94,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5() {}
| `const` because of this
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:47:9
+ --> $DIR/fn-header-semantic-fail.rs:45:9
|
LL | const async unsafe extern "C" fn fi5() {}
| ^^^^^-^^^^^------------------------------
@@ -103,7 +59,7 @@ LL | const async unsafe extern "C" fn fi5() {}
| `const` because of this
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:53:18
+ --> $DIR/fn-header-semantic-fail.rs:51:18
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -116,7 +72,7 @@ LL | fn fe1();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:54:19
+ --> $DIR/fn-header-semantic-fail.rs:52:19
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -130,7 +86,7 @@ LL | fn fe2();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:55:18
+ --> $DIR/fn-header-semantic-fail.rs:53:18
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -144,7 +100,7 @@ LL | fn fe3();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:56:23
+ --> $DIR/fn-header-semantic-fail.rs:54:23
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -158,7 +114,7 @@ LL | fn fe4();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:57:42
+ --> $DIR/fn-header-semantic-fail.rs:55:42
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -172,7 +128,7 @@ LL | fn fe5();
| ~~
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:57:9
+ --> $DIR/fn-header-semantic-fail.rs:55:9
|
LL | const async unsafe extern "C" fn fe5();
| ^^^^^-^^^^^----------------------------
@@ -180,6 +136,58 @@ LL | const async unsafe extern "C" fn fe5();
| | `async` because of this
| `const` because of this
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/fn-header-semantic-fail.rs:17:9
+ |
+LL | async fn ft1();
+ | -----^^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/fn-header-semantic-fail.rs:21:9
+ |
+LL | const async unsafe extern "C" fn ft5();
+ | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/fn-header-semantic-fail.rs:29:9
+ |
+LL | async fn ft1() {}
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/fn-header-semantic-fail.rs:33:9
+ |
+LL | const async unsafe extern "C" fn ft5() {}
+ | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
+
error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}`
--> $DIR/fn-header-semantic-fail.rs:12:44
|
@@ -216,60 +224,24 @@ LL | | }
LL | | }
| |_^
-error[E0053]: method `ft1` has an incompatible type for trait
- --> $DIR/fn-header-semantic-fail.rs:29:24
- |
-LL | async fn ft1() {}
- | ^
- | |
- | checked the `Output` of this `async fn`, found opaque type
- | expected `()`, found opaque type
- |
- = note: while checking the return type of the `async fn`
-note: type in trait
- --> $DIR/fn-header-semantic-fail.rs:17:23
- |
-LL | async fn ft1();
- | ^
- = note: expected fn pointer `fn()`
- found fn pointer `fn() -> impl Future<Output = ()>`
-
-error[E0053]: method `ft5` has an incompatible type for trait
- --> $DIR/fn-header-semantic-fail.rs:34:48
- |
-LL | const async unsafe extern "C" fn ft5() {}
- | ^
- | |
- | checked the `Output` of this `async fn`, found opaque type
- | expected `()`, found opaque type
- |
- = note: while checking the return type of the `async fn`
-note: type in trait
- --> $DIR/fn-header-semantic-fail.rs:21:47
- |
-LL | const async unsafe extern "C" fn ft5();
- | ^
- = note: expected fn pointer `unsafe extern "C" fn()`
- found fn pointer `unsafe extern "C" fn() -> impl Future<Output = ()>`
-
error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}`
- --> $DIR/fn-header-semantic-fail.rs:34:48
+ --> $DIR/fn-header-semantic-fail.rs:33:48
|
LL | const async unsafe extern "C" fn ft5() {}
| ^
|
note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
- --> $DIR/fn-header-semantic-fail.rs:34:9
+ --> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
- --> $DIR/fn-header-semantic-fail.rs:34:9
+ --> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
- --> $DIR/fn-header-semantic-fail.rs:34:9
+ --> $DIR/fn-header-semantic-fail.rs:33:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -288,30 +260,30 @@ LL | | }
LL | | }
| |_^
-error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5::{opaque#0}`
- --> $DIR/fn-header-semantic-fail.rs:47:48
+error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5::{opaque#0}`
+ --> $DIR/fn-header-semantic-fail.rs:45:48
|
LL | const async unsafe extern "C" fn fi5() {}
| ^
|
-note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`...
- --> $DIR/fn-header-semantic-fail.rs:47:9
+note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`...
+ --> $DIR/fn-header-semantic-fail.rs:45:9
|
LL | const async unsafe extern "C" fn fi5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`...
- --> $DIR/fn-header-semantic-fail.rs:47:9
+note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`...
+ --> $DIR/fn-header-semantic-fail.rs:45:9
|
LL | const async unsafe extern "C" fn fi5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`...
- --> $DIR/fn-header-semantic-fail.rs:47:9
+note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`...
+ --> $DIR/fn-header-semantic-fail.rs:45:9
|
LL | const async unsafe extern "C" fn fi5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze...
= note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`...
- = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5::{opaque#0}`, completing the cycle
+ = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
--> $DIR/fn-header-semantic-fail.rs:5:1
|
@@ -324,7 +296,7 @@ LL | | }
LL | | }
| |_^
-error: aborting due to 23 previous errors
+error: aborting due to 21 previous errors
-Some errors have detailed explanations: E0053, E0379, E0391, E0706.
-For more information about an error, try `rustc --explain E0053`.
+Some errors have detailed explanations: E0379, E0391, E0706.
+For more information about an error, try `rustc --explain E0379`.
diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
index 9871cb8fe..1291a021b 100644
--- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
+++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
@@ -1,5 +1,3 @@
-#![feature(generic_associated_types)]
-
fn main() {}
struct X;
diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
index 4b398d791..3856754e0 100644
--- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
+++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
@@ -1,5 +1,5 @@
error: associated type in `impl` without body
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:8:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:6:5
|
LL | type Y;
| ^^^^^^-
@@ -7,7 +7,7 @@ LL | type Y;
| help: provide a definition for the type: `= <type>;`
error: associated type in `impl` without body
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:11:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5
|
LL | type Z: Ord;
| ^^^^^^^^^^^-
@@ -15,13 +15,13 @@ LL | type Z: Ord;
| help: provide a definition for the type: `= <type>;`
error: bounds on `type`s in `impl`s have no effect
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:11:13
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:13
|
LL | type Z: Ord;
| ^^^
error: associated type in `impl` without body
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:15:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:5
|
LL | type W: Ord where Self: Eq;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^-
@@ -29,13 +29,13 @@ LL | type W: Ord where Self: Eq;
| help: provide a definition for the type: `= <type>;`
error: bounds on `type`s in `impl`s have no effect
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:15:13
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:13
|
LL | type W: Ord where Self: Eq;
| ^^^
error: associated type in `impl` without body
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:19:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:17:5
|
LL | type W where Self: Eq;
| ^^^^^^^^^^^^^^^^^^^^^-
@@ -43,7 +43,7 @@ LL | type W where Self: Eq;
| help: provide a definition for the type: `= <type>;`
error[E0658]: inherent associated types are unstable
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:8:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:6:5
|
LL | type Y;
| ^^^^^^^
@@ -52,7 +52,7 @@ LL | type Y;
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
error[E0658]: inherent associated types are unstable
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:11:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5
|
LL | type Z: Ord;
| ^^^^^^^^^^^^
@@ -61,7 +61,7 @@ LL | type Z: Ord;
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
error[E0658]: inherent associated types are unstable
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:15:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:5
|
LL | type W: Ord where Self: Eq;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -70,7 +70,7 @@ LL | type W: Ord where Self: Eq;
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
error[E0658]: inherent associated types are unstable
- --> $DIR/impl-item-type-no-body-semantic-fail.rs:19:5
+ --> $DIR/impl-item-type-no-body-semantic-fail.rs:17:5
|
LL | type W where Self: Eq;
| ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/parser/increment-notfixed.stderr b/src/test/ui/parser/increment-notfixed.stderr
index 352d98cf8..ae55ae067 100644
--- a/src/test/ui/parser/increment-notfixed.stderr
+++ b/src/test/ui/parser/increment-notfixed.stderr
@@ -8,9 +8,8 @@ help: use `+= 1` instead
|
LL | { let tmp = i; i += 1; tmp };
| +++++++++++ ~~~~~~~~~~~~~~~
-LL - i++;
-LL + i += 1;
- |
+LL | i += 1;
+ | ~~~~
error: Rust has no postfix increment operator
--> $DIR/increment-notfixed.rs:17:12
@@ -24,9 +23,8 @@ help: use `+= 1` instead
|
LL | while { let tmp = i; i += 1; tmp } < 5 {
| +++++++++++ ~~~~~~~~~~~~~~~
-LL - while i++ < 5 {
-LL + while i += 1 < 5 {
- |
+LL | while i += 1 < 5 {
+ | ~~~~
error: Rust has no postfix increment operator
--> $DIR/increment-notfixed.rs:25:8
@@ -38,9 +36,8 @@ help: use `+= 1` instead
|
LL | { let tmp_ = tmp; tmp += 1; tmp_ };
| ++++++++++++ ~~~~~~~~~~~~~~~~~~
-LL - tmp++;
-LL + tmp += 1;
- |
+LL | tmp += 1;
+ | ~~~~
error: Rust has no postfix increment operator
--> $DIR/increment-notfixed.rs:31:14
@@ -54,9 +51,8 @@ help: use `+= 1` instead
|
LL | while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 {
| ++++++++++++ ~~~~~~~~~~~~~~~~~~
-LL - while tmp++ < 5 {
-LL + while tmp += 1 < 5 {
- |
+LL | while tmp += 1 < 5 {
+ | ~~~~
error: Rust has no postfix increment operator
--> $DIR/increment-notfixed.rs:39:16
@@ -68,9 +64,8 @@ help: use `+= 1` instead
|
LL | { let tmp = foo.bar.qux; foo.bar.qux += 1; tmp };
| +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~
-LL - foo.bar.qux++;
-LL + foo.bar.qux += 1;
- |
+LL | foo.bar.qux += 1;
+ | ~~~~
error: Rust has no postfix increment operator
--> $DIR/increment-notfixed.rs:49:10
@@ -82,9 +77,8 @@ help: use `+= 1` instead
|
LL | { let tmp = s.tmp; s.tmp += 1; tmp };
| +++++++++++ ~~~~~~~~~~~~~~~~~~~
-LL - s.tmp++;
-LL + s.tmp += 1;
- |
+LL | s.tmp += 1;
+ | ~~~~
error: Rust has no prefix increment operator
--> $DIR/increment-notfixed.rs:56:5
diff --git a/src/test/ui/parser/issue-100197-mut-let.fixed b/src/test/ui/parser/issue-100197-mut-let.fixed
new file mode 100644
index 000000000..5a8956222
--- /dev/null
+++ b/src/test/ui/parser/issue-100197-mut-let.fixed
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ let mut _x = 123;
+ //~^ ERROR invalid variable declaration
+}
diff --git a/src/test/ui/parser/issue-100197-mut-let.rs b/src/test/ui/parser/issue-100197-mut-let.rs
new file mode 100644
index 000000000..71103813a
--- /dev/null
+++ b/src/test/ui/parser/issue-100197-mut-let.rs
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ mut let _x = 123;
+ //~^ ERROR invalid variable declaration
+}
diff --git a/src/test/ui/parser/issue-100197-mut-let.stderr b/src/test/ui/parser/issue-100197-mut-let.stderr
new file mode 100644
index 000000000..86658e4f3
--- /dev/null
+++ b/src/test/ui/parser/issue-100197-mut-let.stderr
@@ -0,0 +1,8 @@
+error: invalid variable declaration
+ --> $DIR/issue-100197-mut-let.rs:4:5
+ |
+LL | mut let _x = 123;
+ | ^^^^^^^ help: switch the order of `mut` and `let`: `let mut`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issue-101477-enum.fixed b/src/test/ui/parser/issue-101477-enum.fixed
new file mode 100644
index 000000000..1dfeae22a
--- /dev/null
+++ b/src/test/ui/parser/issue-101477-enum.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+
+#[allow(dead_code)]
+enum Demo {
+ A = 1,
+ B = 2 //~ ERROR unexpected `==`
+ //~^ expected item, found `==`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issue-101477-enum.rs b/src/test/ui/parser/issue-101477-enum.rs
new file mode 100644
index 000000000..ea7051d69
--- /dev/null
+++ b/src/test/ui/parser/issue-101477-enum.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+
+#[allow(dead_code)]
+enum Demo {
+ A = 1,
+ B == 2 //~ ERROR unexpected `==`
+ //~^ expected item, found `==`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issue-101477-enum.stderr b/src/test/ui/parser/issue-101477-enum.stderr
new file mode 100644
index 000000000..bffc881bd
--- /dev/null
+++ b/src/test/ui/parser/issue-101477-enum.stderr
@@ -0,0 +1,14 @@
+error: unexpected `==`
+ --> $DIR/issue-101477-enum.rs:6:7
+ |
+LL | B == 2
+ | ^^ help: try using `=` instead
+
+error: expected item, found `==`
+ --> $DIR/issue-101477-enum.rs:6:7
+ |
+LL | B == 2
+ | ^^ expected item
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issue-101477-let.fixed b/src/test/ui/parser/issue-101477-let.fixed
new file mode 100644
index 000000000..9989ad815
--- /dev/null
+++ b/src/test/ui/parser/issue-101477-let.fixed
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ let x = 2; //~ ERROR unexpected `==`
+ println!("x: {}", x)
+}
diff --git a/src/test/ui/parser/issue-101477-let.rs b/src/test/ui/parser/issue-101477-let.rs
new file mode 100644
index 000000000..8b0e8bee1
--- /dev/null
+++ b/src/test/ui/parser/issue-101477-let.rs
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ let x == 2; //~ ERROR unexpected `==`
+ println!("x: {}", x)
+}
diff --git a/src/test/ui/parser/issue-101477-let.stderr b/src/test/ui/parser/issue-101477-let.stderr
new file mode 100644
index 000000000..1b30d4b17
--- /dev/null
+++ b/src/test/ui/parser/issue-101477-let.stderr
@@ -0,0 +1,8 @@
+error: unexpected `==`
+ --> $DIR/issue-101477-let.rs:4:11
+ |
+LL | let x == 2;
+ | ^^ help: try using `=` instead
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed
new file mode 100644
index 000000000..64ab6f62b
--- /dev/null
+++ b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed
@@ -0,0 +1,8 @@
+// run-rustfix
+
+fn main() {
+ const _FOO: i32 = 123;
+ //~^ ERROR const` and `let` are mutually exclusive
+ const _BAR: i32 = 123;
+ //~^ ERROR `const` and `let` are mutually exclusive
+}
diff --git a/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs
new file mode 100644
index 000000000..50520971f
--- /dev/null
+++ b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs
@@ -0,0 +1,8 @@
+// run-rustfix
+
+fn main() {
+ const let _FOO: i32 = 123;
+ //~^ ERROR const` and `let` are mutually exclusive
+ let const _BAR: i32 = 123;
+ //~^ ERROR `const` and `let` are mutually exclusive
+}
diff --git a/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr
new file mode 100644
index 000000000..72377fc37
--- /dev/null
+++ b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr
@@ -0,0 +1,14 @@
+error: `const` and `let` are mutually exclusive
+ --> $DIR/issue-99910-const-let-mutually-exclusive.rs:4:5
+ |
+LL | const let _FOO: i32 = 123;
+ | ^^^^^^^^^ help: remove `let`: `const`
+
+error: `const` and `let` are mutually exclusive
+ --> $DIR/issue-99910-const-let-mutually-exclusive.rs:6:5
+ |
+LL | let const _BAR: i32 = 123;
+ | ^^^^^^^^^ help: remove `let`: `const`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-14303-enum.rs b/src/test/ui/parser/issues/issue-14303-enum.rs
deleted file mode 100644
index a61061598..000000000
--- a/src/test/ui/parser/issues/issue-14303-enum.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-enum X<'a, T, 'b> {
-//~^ ERROR lifetime parameters must be declared prior to type parameters
- A(&'a &'b T)
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-enum.stderr b/src/test/ui/parser/issues/issue-14303-enum.stderr
deleted file mode 100644
index 55cef4cab..000000000
--- a/src/test/ui/parser/issues/issue-14303-enum.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
- --> $DIR/issue-14303-enum.rs:1:15
- |
-LL | enum X<'a, T, 'b> {
- | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.rs b/src/test/ui/parser/issues/issue-14303-fn-def.rs
deleted file mode 100644
index 221bd311e..000000000
--- a/src/test/ui/parser/issues/issue-14303-fn-def.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-fn foo<'a, T, 'b>(x: &'a T) {}
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-
-fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.stderr b/src/test/ui/parser/issues/issue-14303-fn-def.stderr
deleted file mode 100644
index bacc92296..000000000
--- a/src/test/ui/parser/issues/issue-14303-fn-def.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
- --> $DIR/issue-14303-fn-def.rs:1:15
- |
-LL | fn foo<'a, T, 'b>(x: &'a T) {}
- | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issues/issue-14303-impl.rs b/src/test/ui/parser/issues/issue-14303-impl.rs
deleted file mode 100644
index 4dc2c6660..000000000
--- a/src/test/ui/parser/issues/issue-14303-impl.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-struct X<T>(T);
-
-impl<'a, T, 'b> X<T> {}
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-
-fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-impl.stderr b/src/test/ui/parser/issues/issue-14303-impl.stderr
deleted file mode 100644
index d6be02f70..000000000
--- a/src/test/ui/parser/issues/issue-14303-impl.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
- --> $DIR/issue-14303-impl.rs:3:13
- |
-LL | impl<'a, T, 'b> X<T> {}
- | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issues/issue-14303-path.rs b/src/test/ui/parser/issues/issue-14303-path.rs
deleted file mode 100644
index 89ef914ab..000000000
--- a/src/test/ui/parser/issues/issue-14303-path.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-mod foo {
- pub struct X<'a, 'b, 'c, T> {
- a: &'a str,
- b: &'b str,
- c: &'c str,
- t: T,
- }
-}
-
-fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
-//~^ ERROR type provided when a lifetime was expected
-
-fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-path.stderr b/src/test/ui/parser/issues/issue-14303-path.stderr
deleted file mode 100644
index 841e63ecb..000000000
--- a/src/test/ui/parser/issues/issue-14303-path.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0747]: type provided when a lifetime was expected
- --> $DIR/issue-14303-path.rs:10:37
- |
-LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
- | ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issues/issue-14303-struct.rs b/src/test/ui/parser/issues/issue-14303-struct.rs
deleted file mode 100644
index 0bd10b4d0..000000000
--- a/src/test/ui/parser/issues/issue-14303-struct.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-struct X<'a, T, 'b> {
-//~^ ERROR lifetime parameters must be declared prior to type parameters
- x: &'a &'b T
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-struct.stderr b/src/test/ui/parser/issues/issue-14303-struct.stderr
deleted file mode 100644
index fa62a39f2..000000000
--- a/src/test/ui/parser/issues/issue-14303-struct.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
- --> $DIR/issue-14303-struct.rs:1:17
- |
-LL | struct X<'a, T, 'b> {
- | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issues/issue-14303-trait.rs b/src/test/ui/parser/issues/issue-14303-trait.rs
deleted file mode 100644
index f253de92d..000000000
--- a/src/test/ui/parser/issues/issue-14303-trait.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-trait Foo<'a, T, 'b> {}
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-
-fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-trait.stderr b/src/test/ui/parser/issues/issue-14303-trait.stderr
deleted file mode 100644
index 75cd67a9d..000000000
--- a/src/test/ui/parser/issues/issue-14303-trait.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
- --> $DIR/issue-14303-trait.rs:1:18
- |
-LL | trait Foo<'a, T, 'b> {}
- | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issues/issue-14303.rs b/src/test/ui/parser/issues/issue-14303.rs
new file mode 100644
index 000000000..82850d77a
--- /dev/null
+++ b/src/test/ui/parser/issues/issue-14303.rs
@@ -0,0 +1,33 @@
+enum Enum<'a, T, 'b> {
+//~^ ERROR lifetime parameters must be declared prior to type and const parameters
+ A(&'a &'b T)
+}
+
+struct Struct<'a, T, 'b> {
+//~^ ERROR lifetime parameters must be declared prior to type and const parameters
+ x: &'a &'b T
+}
+
+trait Trait<'a, T, 'b> {}
+//~^ ERROR lifetime parameters must be declared prior to type and const parameters
+
+fn foo<'a, T, 'b>(x: &'a T) {}
+//~^ ERROR lifetime parameters must be declared prior to type and const parameters
+
+struct Y<T>(T);
+impl<'a, T, 'b> Y<T> {}
+//~^ ERROR lifetime parameters must be declared prior to type and const parameters
+
+mod bar {
+ pub struct X<'a, 'b, 'c, T> {
+ a: &'a str,
+ b: &'b str,
+ c: &'c str,
+ t: T,
+ }
+}
+
+fn bar<'a, 'b, 'c, T>(x: bar::X<'a, T, 'b, 'c>) {}
+//~^ ERROR type provided when a lifetime was expected
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303.stderr b/src/test/ui/parser/issues/issue-14303.stderr
new file mode 100644
index 000000000..f121107c0
--- /dev/null
+++ b/src/test/ui/parser/issues/issue-14303.stderr
@@ -0,0 +1,39 @@
+error: lifetime parameters must be declared prior to type and const parameters
+ --> $DIR/issue-14303.rs:1:18
+ |
+LL | enum Enum<'a, T, 'b> {
+ | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
+
+error: lifetime parameters must be declared prior to type and const parameters
+ --> $DIR/issue-14303.rs:6:22
+ |
+LL | struct Struct<'a, T, 'b> {
+ | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
+
+error: lifetime parameters must be declared prior to type and const parameters
+ --> $DIR/issue-14303.rs:11:20
+ |
+LL | trait Trait<'a, T, 'b> {}
+ | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
+
+error: lifetime parameters must be declared prior to type and const parameters
+ --> $DIR/issue-14303.rs:14:15
+ |
+LL | fn foo<'a, T, 'b>(x: &'a T) {}
+ | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
+
+error: lifetime parameters must be declared prior to type and const parameters
+ --> $DIR/issue-14303.rs:18:13
+ |
+LL | impl<'a, T, 'b> Y<T> {}
+ | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>`
+
+error[E0747]: type provided when a lifetime was expected
+ --> $DIR/issue-14303.rs:30:37
+ |
+LL | fn bar<'a, 'b, 'c, T>(x: bar::X<'a, T, 'b, 'c>) {}
+ | ^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
index 85c9fe409..a00f37ed6 100644
--- a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
+++ b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
@@ -107,10 +107,10 @@ LL | V = [Vec::new; { [0].len() ].len() as isize,
| closing delimiter possibly meant for this
error[E0282]: type annotations needed
- --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:29
+ --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:26
|
LL | V = [Vec::new; { [].len() ].len() as isize,
- | ^^^ cannot infer type for type parameter `T`
+ | ^^ cannot infer type for type parameter `T`
error[E0282]: type annotations needed
--> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14
diff --git a/src/test/ui/parser/issues/issue-89574.stderr b/src/test/ui/parser/issues/issue-89574.stderr
index cbee3d351..fb1312c78 100644
--- a/src/test/ui/parser/issues/issue-89574.stderr
+++ b/src/test/ui/parser/issues/issue-89574.stderr
@@ -1,8 +1,8 @@
error: missing type for `const` item
- --> $DIR/issue-89574.rs:2:11
+ --> $DIR/issue-89574.rs:2:22
|
LL | const EMPTY_ARRAY = [];
- | ^^^^^^^^^^^ help: provide a type for the item: `EMPTY_ARRAY: <type>`
+ | ^ help: provide a type for the item: `: <type>`
error: aborting due to previous error
diff --git a/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr b/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr
index c340e958e..5365b0a1f 100644
--- a/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr
+++ b/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr
@@ -15,10 +15,10 @@ LL | const B;
| help: provide a definition for the constant: `= <expr>;`
error: missing type for `const` item
- --> $DIR/item-free-const-no-body-semantic-fail.rs:6:7
+ --> $DIR/item-free-const-no-body-semantic-fail.rs:6:8
|
LL | const B;
- | ^ help: provide a type for the item: `B: <type>`
+ | ^ help: provide a type for the item: `: <type>`
error: aborting due to 3 previous errors
diff --git a/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr b/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr
index 4d542b798..1b61e4305 100644
--- a/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr
+++ b/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr
@@ -31,16 +31,16 @@ LL | static mut D;
| help: provide a definition for the static: `= <expr>;`
error: missing type for `static` item
- --> $DIR/item-free-static-no-body-semantic-fail.rs:6:8
+ --> $DIR/item-free-static-no-body-semantic-fail.rs:6:9
|
LL | static B;
- | ^ help: provide a type for the item: `B: <type>`
+ | ^ help: provide a type for the item: `: <type>`
error: missing type for `static mut` item
- --> $DIR/item-free-static-no-body-semantic-fail.rs:10:12
+ --> $DIR/item-free-static-no-body-semantic-fail.rs:10:13
|
LL | static mut D;
- | ^ help: provide a type for the item: `D: <type>`
+ | ^ help: provide a type for the item: `: <type>`
error: aborting due to 6 previous errors
diff --git a/src/test/ui/parser/kw-in-trait-bounds.rs b/src/test/ui/parser/kw-in-trait-bounds.rs
new file mode 100644
index 000000000..fa037e593
--- /dev/null
+++ b/src/test/ui/parser/kw-in-trait-bounds.rs
@@ -0,0 +1,47 @@
+// edition:2018
+
+fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
+//~^ ERROR expected identifier, found keyword `fn`
+//~| ERROR expected identifier, found keyword `fn`
+//~| ERROR expected identifier, found keyword `fn`
+//~| ERROR cannot find trait `r#fn` in this scope
+//~| ERROR cannot find trait `r#fn` in this scope
+//~| ERROR cannot find trait `r#fn` in this scope
+//~| HELP a trait with a similar name exists
+//~| HELP a trait with a similar name exists
+//~| HELP a trait with a similar name exists
+//~| HELP escape `fn` to use it as an identifier
+//~| HELP escape `fn` to use it as an identifier
+//~| HELP escape `fn` to use it as an identifier
+where
+G: fn(),
+ //~^ ERROR expected identifier, found keyword `fn`
+ //~| ERROR cannot find trait `r#fn` in this scope
+ //~| HELP a trait with a similar name exists
+ //~| HELP escape `fn` to use it as an identifier
+{}
+
+fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
+//~^ ERROR expected identifier, found keyword `struct`
+//~| ERROR expected identifier, found keyword `struct`
+//~| ERROR expected identifier, found keyword `struct`
+//~| ERROR cannot find trait `r#struct` in this scope
+//~| ERROR cannot find trait `r#struct` in this scope
+//~| ERROR cannot find trait `r#struct` in this scope
+//~| HELP a trait with a similar name exists
+//~| HELP a trait with a similar name exists
+//~| HELP a trait with a similar name exists
+//~| HELP escape `struct` to use it as an identifier
+//~| HELP escape `struct` to use it as an identifier
+//~| HELP escape `struct` to use it as an identifier
+where
+ B: struct,
+ //~^ ERROR expected identifier, found keyword `struct`
+ //~| ERROR cannot find trait `r#struct` in this scope
+ //~| HELP a trait with a similar name exists
+ //~| HELP escape `struct` to use it as an identifier
+{}
+
+trait Struct {}
+
+fn main() {}
diff --git a/src/test/ui/parser/kw-in-trait-bounds.stderr b/src/test/ui/parser/kw-in-trait-bounds.stderr
new file mode 100644
index 000000000..28196c7ce
--- /dev/null
+++ b/src/test/ui/parser/kw-in-trait-bounds.stderr
@@ -0,0 +1,171 @@
+error: expected identifier, found keyword `fn`
+ --> $DIR/kw-in-trait-bounds.rs:3:10
+ |
+LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
+ | ^^ expected identifier, found keyword
+ |
+help: escape `fn` to use it as an identifier
+ |
+LL | fn _f<F: r#fn(), G>(_: impl fn(), _: &dyn fn())
+ | ++
+
+error: expected identifier, found keyword `fn`
+ --> $DIR/kw-in-trait-bounds.rs:3:27
+ |
+LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
+ | ^^ expected identifier, found keyword
+ |
+help: escape `fn` to use it as an identifier
+ |
+LL | fn _f<F: fn(), G>(_: impl r#fn(), _: &dyn fn())
+ | ++
+
+error: expected identifier, found keyword `fn`
+ --> $DIR/kw-in-trait-bounds.rs:3:41
+ |
+LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
+ | ^^ expected identifier, found keyword
+ |
+help: escape `fn` to use it as an identifier
+ |
+LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn r#fn())
+ | ++
+
+error: expected identifier, found keyword `fn`
+ --> $DIR/kw-in-trait-bounds.rs:17:4
+ |
+LL | G: fn(),
+ | ^^ expected identifier, found keyword
+ |
+help: escape `fn` to use it as an identifier
+ |
+LL | G: r#fn(),
+ | ++
+
+error: expected identifier, found keyword `struct`
+ --> $DIR/kw-in-trait-bounds.rs:24:10
+ |
+LL | fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
+ | ^^^^^^ expected identifier, found keyword
+ |
+help: escape `struct` to use it as an identifier
+ |
+LL | fn _g<A: r#struct, B>(_: impl struct, _: &dyn struct)
+ | ++
+
+error: expected identifier, found keyword `struct`
+ --> $DIR/kw-in-trait-bounds.rs:24:29
+ |
+LL | fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
+ | ^^^^^^ expected identifier, found keyword
+ |
+help: escape `struct` to use it as an identifier
+ |
+LL | fn _g<A: struct, B>(_: impl r#struct, _: &dyn struct)
+ | ++
+
+error: expected identifier, found keyword `struct`
+ --> $DIR/kw-in-trait-bounds.rs:24:45
+ |
+LL | fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
+ | ^^^^^^ expected identifier, found keyword
+ |
+help: escape `struct` to use it as an identifier
+ |
+LL | fn _g<A: struct, B>(_: impl struct, _: &dyn r#struct)
+ | ++
+
+error: expected identifier, found keyword `struct`
+ --> $DIR/kw-in-trait-bounds.rs:38:8
+ |
+LL | B: struct,
+ | ^^^^^^ expected identifier, found keyword
+ |
+help: escape `struct` to use it as an identifier
+ |
+LL | B: r#struct,
+ | ++
+
+error[E0405]: cannot find trait `r#fn` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:3:10
+ |
+LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
+ | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn`
+ |
+ ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
+ |
+LL | pub trait Fn<Args>: FnMut<Args> {
+ | ------------------------------- similarly named trait `Fn` defined here
+
+error[E0405]: cannot find trait `r#fn` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:17:4
+ |
+LL | G: fn(),
+ | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn`
+ |
+ ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
+ |
+LL | pub trait Fn<Args>: FnMut<Args> {
+ | ------------------------------- similarly named trait `Fn` defined here
+
+error[E0405]: cannot find trait `r#fn` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:3:27
+ |
+LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
+ | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn`
+ |
+ ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
+ |
+LL | pub trait Fn<Args>: FnMut<Args> {
+ | ------------------------------- similarly named trait `Fn` defined here
+
+error[E0405]: cannot find trait `r#fn` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:3:41
+ |
+LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
+ | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn`
+ |
+ ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
+ |
+LL | pub trait Fn<Args>: FnMut<Args> {
+ | ------------------------------- similarly named trait `Fn` defined here
+
+error[E0405]: cannot find trait `r#struct` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:24:10
+ |
+LL | fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
+ | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct`
+...
+LL | trait Struct {}
+ | ------------ similarly named trait `Struct` defined here
+
+error[E0405]: cannot find trait `r#struct` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:38:8
+ |
+LL | B: struct,
+ | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct`
+...
+LL | trait Struct {}
+ | ------------ similarly named trait `Struct` defined here
+
+error[E0405]: cannot find trait `r#struct` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:24:29
+ |
+LL | fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
+ | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct`
+...
+LL | trait Struct {}
+ | ------------ similarly named trait `Struct` defined here
+
+error[E0405]: cannot find trait `r#struct` in this scope
+ --> $DIR/kw-in-trait-bounds.rs:24:45
+ |
+LL | fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
+ | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct`
+...
+LL | trait Struct {}
+ | ------------ similarly named trait `Struct` defined here
+
+error: aborting due to 16 previous errors
+
+For more information about this error, try `rustc --explain E0405`.
diff --git a/src/test/ui/parser/labeled-no-colon-expr.rs b/src/test/ui/parser/labeled-no-colon-expr.rs
index db9ef52c1..d9ebd7473 100644
--- a/src/test/ui/parser/labeled-no-colon-expr.rs
+++ b/src/test/ui/parser/labeled-no-colon-expr.rs
@@ -1,5 +1,3 @@
-#![feature(label_break_value)]
-
fn main() {
'l0 while false {} //~ ERROR labeled expression must be followed by `:`
'l1 for _ in 0..1 {} //~ ERROR labeled expression must be followed by `:`
diff --git a/src/test/ui/parser/labeled-no-colon-expr.stderr b/src/test/ui/parser/labeled-no-colon-expr.stderr
index a258bd3cc..62288fe15 100644
--- a/src/test/ui/parser/labeled-no-colon-expr.stderr
+++ b/src/test/ui/parser/labeled-no-colon-expr.stderr
@@ -1,5 +1,5 @@
error: labeled expression must be followed by `:`
- --> $DIR/labeled-no-colon-expr.rs:4:5
+ --> $DIR/labeled-no-colon-expr.rs:2:5
|
LL | 'l0 while false {}
| ----^^^^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | 'l0 while false {}
= note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
error: labeled expression must be followed by `:`
- --> $DIR/labeled-no-colon-expr.rs:5:5
+ --> $DIR/labeled-no-colon-expr.rs:3:5
|
LL | 'l1 for _ in 0..1 {}
| ----^^^^^^^^^^^^^^^^
@@ -21,7 +21,7 @@ LL | 'l1 for _ in 0..1 {}
= note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
error: labeled expression must be followed by `:`
- --> $DIR/labeled-no-colon-expr.rs:6:5
+ --> $DIR/labeled-no-colon-expr.rs:4:5
|
LL | 'l2 loop {}
| ----^^^^^^^
@@ -32,7 +32,7 @@ LL | 'l2 loop {}
= note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
error: labeled expression must be followed by `:`
- --> $DIR/labeled-no-colon-expr.rs:7:5
+ --> $DIR/labeled-no-colon-expr.rs:5:5
|
LL | 'l3 {}
| ----^^
@@ -43,7 +43,7 @@ LL | 'l3 {}
= note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
error: expected `while`, `for`, `loop` or `{` after a label
- --> $DIR/labeled-no-colon-expr.rs:8:9
+ --> $DIR/labeled-no-colon-expr.rs:6:9
|
LL | 'l4 0;
| ^ expected `while`, `for`, `loop` or `{` after a label
@@ -55,7 +55,7 @@ LL + 0;
|
error: labeled expression must be followed by `:`
- --> $DIR/labeled-no-colon-expr.rs:8:9
+ --> $DIR/labeled-no-colon-expr.rs:6:9
|
LL | 'l4 0;
| ----^
@@ -66,7 +66,7 @@ LL | 'l4 0;
= note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
error: cannot use a `block` macro fragment here
- --> $DIR/labeled-no-colon-expr.rs:13:17
+ --> $DIR/labeled-no-colon-expr.rs:11:17
|
LL | 'l5 $b;
| ----^^
@@ -79,7 +79,7 @@ LL | m!({});
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: labeled expression must be followed by `:`
- --> $DIR/labeled-no-colon-expr.rs:16:8
+ --> $DIR/labeled-no-colon-expr.rs:14:8
|
LL | 'l5 $b;
| ---- help: add `:` after the label
diff --git a/src/test/ui/parser/public-instead-of-pub-1.fixed b/src/test/ui/parser/public-instead-of-pub-1.fixed
new file mode 100644
index 000000000..a4fa68ba5
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-1.fixed
@@ -0,0 +1,11 @@
+// Checks what happens when `public` is used instead of the correct, `pub`
+// run-rustfix
+
+pub enum Test {
+ //~^ ERROR expected one of `!` or `::`, found keyword `enum`
+ //~^^ HELP write `pub` instead of `public` to make the item public
+ A,
+ B,
+}
+
+fn main() { }
diff --git a/src/test/ui/parser/public-instead-of-pub-1.rs b/src/test/ui/parser/public-instead-of-pub-1.rs
new file mode 100644
index 000000000..43565c9b1
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-1.rs
@@ -0,0 +1,11 @@
+// Checks what happens when `public` is used instead of the correct, `pub`
+// run-rustfix
+
+public enum Test {
+ //~^ ERROR expected one of `!` or `::`, found keyword `enum`
+ //~^^ HELP write `pub` instead of `public` to make the item public
+ A,
+ B,
+}
+
+fn main() { }
diff --git a/src/test/ui/parser/public-instead-of-pub-1.stderr b/src/test/ui/parser/public-instead-of-pub-1.stderr
new file mode 100644
index 000000000..795a5bcf5
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-1.stderr
@@ -0,0 +1,13 @@
+error: expected one of `!` or `::`, found keyword `enum`
+ --> $DIR/public-instead-of-pub-1.rs:4:8
+ |
+LL | public enum Test {
+ | ^^^^ expected one of `!` or `::`
+ |
+help: write `pub` instead of `public` to make the item public
+ |
+LL | pub enum Test {
+ | ~~~
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/public-instead-of-pub-2.rs b/src/test/ui/parser/public-instead-of-pub-2.rs
new file mode 100644
index 000000000..8a43c361e
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-2.rs
@@ -0,0 +1,7 @@
+// Checks what happens when `public` is used instead of the correct, `pub`
+// Won't give help message for this case
+
+public let x = 1;
+//~^ ERROR expected one of `!` or `::`, found keyword `let`
+
+fn main() { }
diff --git a/src/test/ui/parser/public-instead-of-pub-2.stderr b/src/test/ui/parser/public-instead-of-pub-2.stderr
new file mode 100644
index 000000000..efe225656
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-2.stderr
@@ -0,0 +1,8 @@
+error: expected one of `!` or `::`, found keyword `let`
+ --> $DIR/public-instead-of-pub-2.rs:4:8
+ |
+LL | public let x = 1;
+ | ^^^ expected one of `!` or `::`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/public-instead-of-pub-3.fixed b/src/test/ui/parser/public-instead-of-pub-3.fixed
new file mode 100644
index 000000000..14f620f41
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-3.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+mod test {
+ pub const X: i32 = 123;
+ //~^ ERROR expected one of `!` or `::`, found keyword `const`
+}
+
+fn main() {
+ println!("{}", test::X);
+}
diff --git a/src/test/ui/parser/public-instead-of-pub-3.rs b/src/test/ui/parser/public-instead-of-pub-3.rs
new file mode 100644
index 000000000..ee27cb1a1
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-3.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+mod test {
+ public const X: i32 = 123;
+ //~^ ERROR expected one of `!` or `::`, found keyword `const`
+}
+
+fn main() {
+ println!("{}", test::X);
+}
diff --git a/src/test/ui/parser/public-instead-of-pub-3.stderr b/src/test/ui/parser/public-instead-of-pub-3.stderr
new file mode 100644
index 000000000..72efae08d
--- /dev/null
+++ b/src/test/ui/parser/public-instead-of-pub-3.stderr
@@ -0,0 +1,13 @@
+error: expected one of `!` or `::`, found keyword `const`
+ --> $DIR/public-instead-of-pub-3.rs:3:12
+ |
+LL | public const X: i32 = 123;
+ | ^^^^^ expected one of `!` or `::`
+ |
+help: write `pub` instead of `public` to make the item public
+ |
+LL | pub const X: i32 = 123;
+ | ~~~
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/recover-field-semi.rs b/src/test/ui/parser/recover-field-semi.rs
new file mode 100644
index 000000000..b70357886
--- /dev/null
+++ b/src/test/ui/parser/recover-field-semi.rs
@@ -0,0 +1,16 @@
+struct Foo {
+ foo: i32;
+ //~^ ERROR struct fields are separated by `,`
+}
+
+union Bar { //~ ERROR
+ foo: i32;
+ //~^ ERROR union fields are separated by `,`
+}
+
+enum Baz {
+ Qux { foo: i32; }
+ //~^ ERROR struct fields are separated by `,`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/recover-field-semi.stderr b/src/test/ui/parser/recover-field-semi.stderr
new file mode 100644
index 000000000..657366db9
--- /dev/null
+++ b/src/test/ui/parser/recover-field-semi.stderr
@@ -0,0 +1,29 @@
+error: struct fields are separated by `,`
+ --> $DIR/recover-field-semi.rs:2:13
+ |
+LL | foo: i32;
+ | ^ help: replace `;` with `,`
+
+error: union fields are separated by `,`
+ --> $DIR/recover-field-semi.rs:7:13
+ |
+LL | foo: i32;
+ | ^ help: replace `;` with `,`
+
+error: struct fields are separated by `,`
+ --> $DIR/recover-field-semi.rs:12:19
+ |
+LL | Qux { foo: i32; }
+ | ^ help: replace `;` with `,`
+
+error: unions cannot have zero fields
+ --> $DIR/recover-field-semi.rs:6:1
+ |
+LL | / union Bar {
+LL | | foo: i32;
+LL | |
+LL | | }
+ | |_^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.fixed b/src/test/ui/parser/recover-labeled-non-block-expr.fixed
index fe546a719..c2e76444d 100644
--- a/src/test/ui/parser/recover-labeled-non-block-expr.fixed
+++ b/src/test/ui/parser/recover-labeled-non-block-expr.fixed
@@ -1,5 +1,4 @@
// run-rustfix
-#![feature(label_break_value)]
fn main() {
let _ = 1 + 1; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.rs b/src/test/ui/parser/recover-labeled-non-block-expr.rs
index 35862e2ee..fc11c646a 100644
--- a/src/test/ui/parser/recover-labeled-non-block-expr.rs
+++ b/src/test/ui/parser/recover-labeled-non-block-expr.rs
@@ -1,5 +1,4 @@
// run-rustfix
-#![feature(label_break_value)]
fn main() {
let _ = 'label: 1 + 1; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.stderr b/src/test/ui/parser/recover-labeled-non-block-expr.stderr
index 04fc1203e..d66ce6950 100644
--- a/src/test/ui/parser/recover-labeled-non-block-expr.stderr
+++ b/src/test/ui/parser/recover-labeled-non-block-expr.stderr
@@ -1,5 +1,5 @@
error: expected `while`, `for`, `loop` or `{` after a label
- --> $DIR/recover-labeled-non-block-expr.rs:4:21
+ --> $DIR/recover-labeled-non-block-expr.rs:3:21
|
LL | let _ = 'label: 1 + 1;
| ^ expected `while`, `for`, `loop` or `{` after a label
@@ -11,7 +11,7 @@ LL + let _ = 1 + 1;
|
error: expected `while`, `for`, `loop` or `{` after a label
- --> $DIR/recover-labeled-non-block-expr.rs:6:13
+ --> $DIR/recover-labeled-non-block-expr.rs:5:13
|
LL | 'label: match () { () => {}, };
| ^^^^^ expected `while`, `for`, `loop` or `{` after a label
@@ -23,7 +23,7 @@ LL + match () { () => {}, };
|
error: expected `while`, `for`, `loop` or `{` after a label
- --> $DIR/recover-labeled-non-block-expr.rs:7:13
+ --> $DIR/recover-labeled-non-block-expr.rs:6:13
|
LL | 'label: match () { () => break 'label, };
| ^^^^^ expected `while`, `for`, `loop` or `{` after a label
@@ -34,7 +34,7 @@ LL | 'label: { match () { () => break 'label, } };
| + +
error: expected `while`, `for`, `loop` or `{` after a label
- --> $DIR/recover-labeled-non-block-expr.rs:9:13
+ --> $DIR/recover-labeled-non-block-expr.rs:8:13
|
LL | 'label: match () { () => 'lp: loop { break 'lp 0 }, };
| ^^^^^ expected `while`, `for`, `loop` or `{` after a label
@@ -45,7 +45,7 @@ LL | 'label: { match () { () => 'lp: loop { break 'lp 0 }, } };
| + +
error: expected `while`, `for`, `loop` or `{` after a label
- --> $DIR/recover-labeled-non-block-expr.rs:12:22
+ --> $DIR/recover-labeled-non-block-expr.rs:11:22
|
LL | let _i = 'label: match x {
| ^^^^^ expected `while`, `for`, `loop` or `{` after a label
@@ -60,7 +60,7 @@ LL ~ } };
|
error: expected `while`, `for`, `loop` or `{` after a label
- --> $DIR/recover-labeled-non-block-expr.rs:26:24
+ --> $DIR/recover-labeled-non-block-expr.rs:25:24
|
LL | let _val = 'label: (1, if other == 3 { break 'label (2, 3) } else { other });
| ^ expected `while`, `for`, `loop` or `{` after a label
diff --git a/src/test/ui/parser/recover-missing-semi-before-item.fixed b/src/test/ui/parser/recover-missing-semi-before-item.fixed
new file mode 100644
index 000000000..0be17e69e
--- /dev/null
+++ b/src/test/ui/parser/recover-missing-semi-before-item.fixed
@@ -0,0 +1,61 @@
+// run-rustfix
+
+#![allow(unused_variables, dead_code)]
+
+fn for_struct() {
+ let foo = 3; //~ ERROR expected `;`, found keyword `struct`
+ struct Foo;
+}
+
+fn for_union() {
+ let foo = 3; //~ ERROR expected `;`, found `union`
+ union Foo {
+ foo: usize,
+ }
+}
+
+fn for_enum() {
+ let foo = 3; //~ ERROR expected `;`, found keyword `enum`
+ enum Foo {
+ Bar,
+ }
+}
+
+fn for_fn() {
+ let foo = 3; //~ ERROR expected `;`, found keyword `fn`
+ fn foo() {}
+}
+
+fn for_extern() {
+ let foo = 3; //~ ERROR expected `;`, found keyword `extern`
+ extern fn foo() {}
+}
+
+fn for_impl() {
+ struct Foo;
+ let foo = 3; //~ ERROR expected `;`, found keyword `impl`
+ impl Foo {}
+}
+
+fn for_use() {
+ let foo = 3; //~ ERROR expected `;`, found keyword `pub`
+ pub use bar::Bar;
+}
+
+fn for_mod() {
+ let foo = 3; //~ ERROR expected `;`, found keyword `mod`
+ mod foo {}
+}
+
+fn for_type() {
+ let foo = 3; //~ ERROR expected `;`, found keyword `type`
+ type Foo = usize;
+}
+
+mod bar {
+ pub struct Bar;
+}
+
+const X: i32 = 123; //~ ERROR expected `;`, found keyword `fn`
+
+fn main() {}
diff --git a/src/test/ui/parser/recover-missing-semi-before-item.rs b/src/test/ui/parser/recover-missing-semi-before-item.rs
new file mode 100644
index 000000000..867b7b749
--- /dev/null
+++ b/src/test/ui/parser/recover-missing-semi-before-item.rs
@@ -0,0 +1,61 @@
+// run-rustfix
+
+#![allow(unused_variables, dead_code)]
+
+fn for_struct() {
+ let foo = 3 //~ ERROR expected `;`, found keyword `struct`
+ struct Foo;
+}
+
+fn for_union() {
+ let foo = 3 //~ ERROR expected `;`, found `union`
+ union Foo {
+ foo: usize,
+ }
+}
+
+fn for_enum() {
+ let foo = 3 //~ ERROR expected `;`, found keyword `enum`
+ enum Foo {
+ Bar,
+ }
+}
+
+fn for_fn() {
+ let foo = 3 //~ ERROR expected `;`, found keyword `fn`
+ fn foo() {}
+}
+
+fn for_extern() {
+ let foo = 3 //~ ERROR expected `;`, found keyword `extern`
+ extern fn foo() {}
+}
+
+fn for_impl() {
+ struct Foo;
+ let foo = 3 //~ ERROR expected `;`, found keyword `impl`
+ impl Foo {}
+}
+
+fn for_use() {
+ let foo = 3 //~ ERROR expected `;`, found keyword `pub`
+ pub use bar::Bar;
+}
+
+fn for_mod() {
+ let foo = 3 //~ ERROR expected `;`, found keyword `mod`
+ mod foo {}
+}
+
+fn for_type() {
+ let foo = 3 //~ ERROR expected `;`, found keyword `type`
+ type Foo = usize;
+}
+
+mod bar {
+ pub struct Bar;
+}
+
+const X: i32 = 123 //~ ERROR expected `;`, found keyword `fn`
+
+fn main() {}
diff --git a/src/test/ui/parser/recover-missing-semi-before-item.stderr b/src/test/ui/parser/recover-missing-semi-before-item.stderr
new file mode 100644
index 000000000..61c43f2f1
--- /dev/null
+++ b/src/test/ui/parser/recover-missing-semi-before-item.stderr
@@ -0,0 +1,83 @@
+error: expected `;`, found keyword `struct`
+ --> $DIR/recover-missing-semi-before-item.rs:6:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | struct Foo;
+ | ------ unexpected token
+
+error: expected `;`, found `union`
+ --> $DIR/recover-missing-semi-before-item.rs:11:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | union Foo {
+ | ----- unexpected token
+
+error: expected `;`, found keyword `enum`
+ --> $DIR/recover-missing-semi-before-item.rs:18:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | enum Foo {
+ | ---- unexpected token
+
+error: expected `;`, found keyword `fn`
+ --> $DIR/recover-missing-semi-before-item.rs:25:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | fn foo() {}
+ | -- unexpected token
+
+error: expected `;`, found keyword `extern`
+ --> $DIR/recover-missing-semi-before-item.rs:30:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | extern fn foo() {}
+ | ------ unexpected token
+
+error: expected `;`, found keyword `impl`
+ --> $DIR/recover-missing-semi-before-item.rs:36:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | impl Foo {}
+ | ---- unexpected token
+
+error: expected `;`, found keyword `pub`
+ --> $DIR/recover-missing-semi-before-item.rs:41:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | pub use bar::Bar;
+ | --- unexpected token
+
+error: expected `;`, found keyword `mod`
+ --> $DIR/recover-missing-semi-before-item.rs:46:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | mod foo {}
+ | --- unexpected token
+
+error: expected `;`, found keyword `type`
+ --> $DIR/recover-missing-semi-before-item.rs:51:16
+ |
+LL | let foo = 3
+ | ^ help: add `;` here
+LL | type Foo = usize;
+ | ---- unexpected token
+
+error: expected `;`, found keyword `fn`
+ --> $DIR/recover-missing-semi-before-item.rs:59:19
+ |
+LL | const X: i32 = 123
+ | ^ help: add `;` here
+LL |
+LL | fn main() {}
+ | -- unexpected token
+
+error: aborting due to 10 previous errors
+
diff --git a/src/test/ui/parser/removed-syntax-field-semicolon.rs b/src/test/ui/parser/removed-syntax-field-semicolon.rs
index ac28e21ae..808f2a5cc 100644
--- a/src/test/ui/parser/removed-syntax-field-semicolon.rs
+++ b/src/test/ui/parser/removed-syntax-field-semicolon.rs
@@ -1,6 +1,6 @@
struct S {
bar: ();
- //~^ ERROR expected `,`, or `}`, found `;`
+ //~^ ERROR struct fields are separated by `,`
}
fn main() {}
diff --git a/src/test/ui/parser/removed-syntax-field-semicolon.stderr b/src/test/ui/parser/removed-syntax-field-semicolon.stderr
index fbefeb26a..e4f75f672 100644
--- a/src/test/ui/parser/removed-syntax-field-semicolon.stderr
+++ b/src/test/ui/parser/removed-syntax-field-semicolon.stderr
@@ -1,8 +1,8 @@
-error: expected `,`, or `}`, found `;`
+error: struct fields are separated by `,`
--> $DIR/removed-syntax-field-semicolon.rs:2:12
|
LL | bar: ();
- | ^
+ | ^ help: replace `;` with `,`
error: aborting due to previous error
diff --git a/src/test/ui/parser/removed-syntax-static-fn.stderr b/src/test/ui/parser/removed-syntax-static-fn.stderr
index 04e34dc16..52e065894 100644
--- a/src/test/ui/parser/removed-syntax-static-fn.stderr
+++ b/src/test/ui/parser/removed-syntax-static-fn.stderr
@@ -16,10 +16,10 @@ LL | }
| - the item list ends here
error: missing type for `static` item
- --> $DIR/removed-syntax-static-fn.rs:4:12
+ --> $DIR/removed-syntax-static-fn.rs:4:14
|
LL | static fn f() {}
- | ^^ help: provide a type for the item: `r#fn: <type>`
+ | ^ help: provide a type for the item: `: <type>`
error: aborting due to 3 previous errors
diff --git a/src/test/ui/parser/struct-filed-with-attr.fixed b/src/test/ui/parser/struct-filed-with-attr.fixed
new file mode 100644
index 000000000..a799ec8ca
--- /dev/null
+++ b/src/test/ui/parser/struct-filed-with-attr.fixed
@@ -0,0 +1,18 @@
+// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute.
+// run-rustfix
+
+struct Feelings {
+ owo: bool,
+ //~^ ERROR expected `,`, or `}`, found `#`
+ #[allow(unused)]
+ uwu: bool,
+}
+
+impl Feelings {
+ #[allow(unused)]
+ fn hmm(&self) -> bool {
+ self.owo
+ }
+}
+
+fn main() { }
diff --git a/src/test/ui/parser/struct-filed-with-attr.rs b/src/test/ui/parser/struct-filed-with-attr.rs
new file mode 100644
index 000000000..bfc78e15b
--- /dev/null
+++ b/src/test/ui/parser/struct-filed-with-attr.rs
@@ -0,0 +1,18 @@
+// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute.
+// run-rustfix
+
+struct Feelings {
+ owo: bool
+ //~^ ERROR expected `,`, or `}`, found `#`
+ #[allow(unused)]
+ uwu: bool,
+}
+
+impl Feelings {
+ #[allow(unused)]
+ fn hmm(&self) -> bool {
+ self.owo
+ }
+}
+
+fn main() { }
diff --git a/src/test/ui/parser/struct-filed-with-attr.stderr b/src/test/ui/parser/struct-filed-with-attr.stderr
new file mode 100644
index 000000000..c2cd7e82e
--- /dev/null
+++ b/src/test/ui/parser/struct-filed-with-attr.stderr
@@ -0,0 +1,8 @@
+error: expected `,`, or `}`, found `#`
+ --> $DIR/struct-filed-with-attr.rs:5:14
+ |
+LL | owo: bool
+ | ^ help: try adding a comma: `,`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr
index 4b191710c..1c91eba68 100644
--- a/src/test/ui/parser/struct-literal-in-for.stderr
+++ b/src/test/ui/parser/struct-literal-in-for.stderr
@@ -24,7 +24,7 @@ LL | | }.hi() {
| |__________^ `bool` is not an iterator
|
= help: the trait `Iterator` is not implemented for `bool`
- = note: required because of the requirements on the impl of `IntoIterator` for `bool`
+ = note: required for `bool` to implement `IntoIterator`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/parser/suggest-assoc-const.fixed b/src/test/ui/parser/suggest-assoc-const.fixed
new file mode 100644
index 000000000..259f37b23
--- /dev/null
+++ b/src/test/ui/parser/suggest-assoc-const.fixed
@@ -0,0 +1,10 @@
+// Issue: 101797, Suggest associated const for incorrect use of let in traits
+// run-rustfix
+trait Trait {
+ const _X: i32;
+ //~^ ERROR non-item in item list
+}
+
+fn main() {
+
+}
diff --git a/src/test/ui/parser/suggest-assoc-const.rs b/src/test/ui/parser/suggest-assoc-const.rs
new file mode 100644
index 000000000..c7be712ec
--- /dev/null
+++ b/src/test/ui/parser/suggest-assoc-const.rs
@@ -0,0 +1,10 @@
+// Issue: 101797, Suggest associated const for incorrect use of let in traits
+// run-rustfix
+trait Trait {
+ let _X: i32;
+ //~^ ERROR non-item in item list
+}
+
+fn main() {
+
+}
diff --git a/src/test/ui/parser/suggest-assoc-const.stderr b/src/test/ui/parser/suggest-assoc-const.stderr
new file mode 100644
index 000000000..2ddfa07c5
--- /dev/null
+++ b/src/test/ui/parser/suggest-assoc-const.stderr
@@ -0,0 +1,8 @@
+error: non-item in item list
+ --> $DIR/suggest-assoc-const.rs:4:5
+ |
+LL | let _X: i32;
+ | ^^^ help: consider using `const` instead of `let` for associated const: `const`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/suggest-const-for-global-var.rs b/src/test/ui/parser/suggest-const-for-global-var.rs
new file mode 100644
index 000000000..d6216cb7a
--- /dev/null
+++ b/src/test/ui/parser/suggest-const-for-global-var.rs
@@ -0,0 +1,6 @@
+let X: i32 = 12;
+//~^ ERROR expected item, found keyword `let`
+
+fn main() {
+ println!("{}", X);
+}
diff --git a/src/test/ui/parser/suggest-const-for-global-var.stderr b/src/test/ui/parser/suggest-const-for-global-var.stderr
new file mode 100644
index 000000000..94e44ec7f
--- /dev/null
+++ b/src/test/ui/parser/suggest-const-for-global-var.stderr
@@ -0,0 +1,8 @@
+error: expected item, found keyword `let`
+ --> $DIR/suggest-const-for-global-var.rs:1:1
+ |
+LL | let X: i32 = 12;
+ | ^^^ consider using `const` or `static` instead of `let` for global variables
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed
new file mode 100644
index 000000000..637047354
--- /dev/null
+++ b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed
@@ -0,0 +1,7 @@
+// run-rustfix
+
+trait Foo {
+ fn bar() {} //~ ERROR non-item in item list
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs
new file mode 100644
index 000000000..4650b05e2
--- /dev/null
+++ b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs
@@ -0,0 +1,7 @@
+// run-rustfix
+
+trait Foo {
+ fn bar() {}; //~ ERROR non-item in item list
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr
new file mode 100644
index 000000000..396e0c130
--- /dev/null
+++ b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr
@@ -0,0 +1,15 @@
+error: non-item in item list
+ --> $DIR/suggest-removing-semicolon-after-impl-trait-items.rs:4:16
+ |
+LL | trait Foo {
+ | - item list starts here
+LL | fn bar() {};
+ | ^
+ | |
+ | non-item starts here
+ | help: consider removing this semicolon
+LL | }
+ | - item list ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/suggest-semicolon-before-array.fixed b/src/test/ui/parser/suggest-semicolon-before-array.fixed
new file mode 100644
index 000000000..a06b58b27
--- /dev/null
+++ b/src/test/ui/parser/suggest-semicolon-before-array.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+#![allow(dead_code)]
+
+fn foo() {}
+
+fn bar() -> [u8; 2] {
+ foo();
+ [1, 3] //~ ERROR expected `;`, found `[`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/suggest-semicolon-before-array.rs b/src/test/ui/parser/suggest-semicolon-before-array.rs
new file mode 100644
index 000000000..f601ca2ae
--- /dev/null
+++ b/src/test/ui/parser/suggest-semicolon-before-array.rs
@@ -0,0 +1,11 @@
+// run-rustfix
+#![allow(dead_code)]
+
+fn foo() {}
+
+fn bar() -> [u8; 2] {
+ foo()
+ [1, 3] //~ ERROR expected `;`, found `[`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/suggest-semicolon-before-array.stderr b/src/test/ui/parser/suggest-semicolon-before-array.stderr
new file mode 100644
index 000000000..8a33321fb
--- /dev/null
+++ b/src/test/ui/parser/suggest-semicolon-before-array.stderr
@@ -0,0 +1,13 @@
+error: expected `;`, found `[`
+ --> $DIR/suggest-semicolon-before-array.rs:8:5
+ |
+LL | [1, 3]
+ | ^
+ |
+help: consider adding `;` here
+ |
+LL | foo();
+ | +
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/trait-object-delimiters.rs b/src/test/ui/parser/trait-object-delimiters.rs
index b5258eebb..cc04ac052 100644
--- a/src/test/ui/parser/trait-object-delimiters.rs
+++ b/src/test/ui/parser/trait-object-delimiters.rs
@@ -6,7 +6,7 @@ fn foo1(_: &dyn Drop + AsRef<str>) {} //~ ERROR ambiguous `+` in a type
fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds
fn foo3(_: &dyn {Drop + AsRef<str>}) {} //~ ERROR expected parameter name, found `{`
-//~^ ERROR expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
+//~^ ERROR expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
//~| ERROR at least one trait is required for an object type
fn foo4(_: &dyn <Drop + AsRef<str>>) {} //~ ERROR expected identifier, found `<`
diff --git a/src/test/ui/parser/trait-object-delimiters.stderr b/src/test/ui/parser/trait-object-delimiters.stderr
index 6eb9c7238..99c451545 100644
--- a/src/test/ui/parser/trait-object-delimiters.stderr
+++ b/src/test/ui/parser/trait-object-delimiters.stderr
@@ -22,11 +22,11 @@ error: expected parameter name, found `{`
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
| ^ expected parameter name
-error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
+error: expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
--> $DIR/trait-object-delimiters.rs:8:17
|
LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {}
- | -^ expected one of 9 possible tokens
+ | -^ expected one of 10 possible tokens
| |
| help: missing `,`
diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr
index 7ee965bd2..823f75bfa 100644
--- a/src/test/ui/parser/trait-object-trait-parens.stderr
+++ b/src/test/ui/parser/trait-object-trait-parens.stderr
@@ -27,9 +27,8 @@ LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
-LL - let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
-LL + let _: Box<dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)>;
- |
+LL | let _: Box<dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)>;
+ | +++
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:8:35
@@ -52,9 +51,8 @@ LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
-LL - let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
-LL + let _: Box<dyn ?Sized + (for<'a> Trait<'a>) + (Obj)>;
- |
+LL | let _: Box<dyn ?Sized + (for<'a> Trait<'a>) + (Obj)>;
+ | +++
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:13:47
@@ -77,9 +75,8 @@ LL | let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
|
-LL - let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
-LL + let _: Box<dyn for<'a> Trait<'a> + (Obj) + (?Sized)>;
- |
+LL | let _: Box<dyn for<'a> Trait<'a> + (Obj) + (?Sized)>;
+ | +++
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:18:36
diff --git a/src/test/ui/parser/type-alias-where-fixable.fixed b/src/test/ui/parser/type-alias-where-fixable.fixed
index 41dd10676..2f47c0d91 100644
--- a/src/test/ui/parser/type-alias-where-fixable.fixed
+++ b/src/test/ui/parser/type-alias-where-fixable.fixed
@@ -1,8 +1,6 @@
// check-pass
// run-rustfix
-#![feature(generic_associated_types)]
-
trait Trait {
// Fine.
type Assoc where u32: Copy;
diff --git a/src/test/ui/parser/type-alias-where-fixable.rs b/src/test/ui/parser/type-alias-where-fixable.rs
index 562a530a7..b20aa9398 100644
--- a/src/test/ui/parser/type-alias-where-fixable.rs
+++ b/src/test/ui/parser/type-alias-where-fixable.rs
@@ -1,8 +1,6 @@
// check-pass
// run-rustfix
-#![feature(generic_associated_types)]
-
trait Trait {
// Fine.
type Assoc where u32: Copy;
diff --git a/src/test/ui/parser/type-alias-where-fixable.stderr b/src/test/ui/parser/type-alias-where-fixable.stderr
index abfeb62fc..2e516d5c4 100644
--- a/src/test/ui/parser/type-alias-where-fixable.stderr
+++ b/src/test/ui/parser/type-alias-where-fixable.stderr
@@ -1,5 +1,5 @@
warning: where clause not allowed here
- --> $DIR/type-alias-where-fixable.rs:15:16
+ --> $DIR/type-alias-where-fixable.rs:13:16
|
LL | type Assoc where u32: Copy = ();
| ^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL + type Assoc = () where u32: Copy;
|
warning: where clause not allowed here
- --> $DIR/type-alias-where-fixable.rs:18:17
+ --> $DIR/type-alias-where-fixable.rs:16:17
|
LL | type Assoc2 where u32: Copy = () where i32: Copy;
| ^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL + type Assoc2 = () where i32: Copy, u32: Copy;
|
warning: where clause not allowed here
- --> $DIR/type-alias-where-fixable.rs:26:17
+ --> $DIR/type-alias-where-fixable.rs:24:17
|
LL | type Assoc2 where u32: Copy, i32: Copy = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/parser/type-alias-where.rs b/src/test/ui/parser/type-alias-where.rs
index f6e7dfb7b..62e301cb4 100644
--- a/src/test/ui/parser/type-alias-where.rs
+++ b/src/test/ui/parser/type-alias-where.rs
@@ -1,7 +1,5 @@
// check-fail
-#![feature(generic_associated_types)]
-
// Fine, but lints as unused
type Foo where u32: Copy = ();
// Not fine.
diff --git a/src/test/ui/parser/type-alias-where.stderr b/src/test/ui/parser/type-alias-where.stderr
index 8789d2665..fb8381792 100644
--- a/src/test/ui/parser/type-alias-where.stderr
+++ b/src/test/ui/parser/type-alias-where.stderr
@@ -1,5 +1,5 @@
error: where clauses are not allowed after the type for type aliases
- --> $DIR/type-alias-where.rs:8:15
+ --> $DIR/type-alias-where.rs:6:15
|
LL | type Bar = () where u32: Copy;
| ^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | type Bar = () where u32: Copy;
= note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
error: where clauses are not allowed after the type for type aliases
- --> $DIR/type-alias-where.rs:10:15
+ --> $DIR/type-alias-where.rs:8:15
|
LL | type Baz = () where;
| ^^^^^
diff --git a/src/test/ui/parser/unnecessary-let.rs b/src/test/ui/parser/unnecessary-let.rs
new file mode 100644
index 000000000..627910962
--- /dev/null
+++ b/src/test/ui/parser/unnecessary-let.rs
@@ -0,0 +1,11 @@
+fn main() {
+ for let x of [1, 2, 3] {}
+ //~^ ERROR expected pattern, found `let`
+ //~| ERROR missing `in` in `for` loop
+
+ match 1 {
+ let 1 => {}
+ //~^ ERROR expected pattern, found `let`
+ _ => {}
+ }
+}
diff --git a/src/test/ui/parser/unnecessary-let.stderr b/src/test/ui/parser/unnecessary-let.stderr
new file mode 100644
index 000000000..952119cae
--- /dev/null
+++ b/src/test/ui/parser/unnecessary-let.stderr
@@ -0,0 +1,20 @@
+error: expected pattern, found `let`
+ --> $DIR/unnecessary-let.rs:2:9
+ |
+LL | for let x of [1, 2, 3] {}
+ | ^^^ help: remove the unnecessary `let` keyword
+
+error: missing `in` in `for` loop
+ --> $DIR/unnecessary-let.rs:2:15
+ |
+LL | for let x of [1, 2, 3] {}
+ | ^^ help: try using `in` here instead
+
+error: expected pattern, found `let`
+ --> $DIR/unnecessary-let.rs:7:9
+ |
+LL | let 1 => {}
+ | ^^^ help: remove the unnecessary `let` keyword
+
+error: aborting due to 3 previous errors
+