summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/issues
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/issues')
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.fixed6
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.rs6
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.stderr8
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.fixed10
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.rs10
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.stderr18
-rw-r--r--tests/ui/parser/issues/issue-101477-let.fixed6
-rw-r--r--tests/ui/parser/issues/issue-101477-let.rs6
-rw-r--r--tests/ui/parser/issues/issue-101477-let.stderr8
-rw-r--r--tests/ui/parser/issues/issue-102806.rs25
-rw-r--r--tests/ui/parser/issues/issue-102806.stderr50
-rw-r--r--tests/ui/parser/issues/issue-103143.rs5
-rw-r--r--tests/ui/parser/issues/issue-103143.stderr20
-rw-r--r--tests/ui/parser/issues/issue-103381.fixed59
-rw-r--r--tests/ui/parser/issues/issue-103381.rs59
-rw-r--r--tests/ui/parser/issues/issue-103381.stderr50
-rw-r--r--tests/ui/parser/issues/issue-103425.rs15
-rw-r--r--tests/ui/parser/issues/issue-103425.stderr29
-rw-r--r--tests/ui/parser/issues/issue-103451.rs4
-rw-r--r--tests/ui/parser/issues/issue-103451.stderr12
-rw-r--r--tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs8
-rw-r--r--tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr51
-rw-r--r--tests/ui/parser/issues/issue-104620.rs4
-rw-r--r--tests/ui/parser/issues/issue-104620.stderr8
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec-2.rs52
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec-2.stderr107
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec.rs45
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec.stderr81
-rw-r--r--tests/ui/parser/issues/issue-105366.fixed12
-rw-r--r--tests/ui/parser/issues/issue-105366.rs12
-rw-r--r--tests/ui/parser/issues/issue-105366.stderr13
-rw-r--r--tests/ui/parser/issues/issue-105634.rs8
-rw-r--r--tests/ui/parser/issues/issue-107705.rs3
-rw-r--r--tests/ui/parser/issues/issue-107705.stderr10
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.fixed9
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.rs9
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.stderr14
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed8
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs8
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr11
-rw-r--r--tests/ui/parser/issues/issue-108495-dec.rs39
-rw-r--r--tests/ui/parser/issues/issue-108495-dec.stderr69
-rw-r--r--tests/ui/parser/issues/issue-112188.fixed14
-rw-r--r--tests/ui/parser/issues/issue-112188.rs14
-rw-r--r--tests/ui/parser/issues/issue-112188.stderr37
-rw-r--r--tests/ui/parser/issues/issue-113342.rs9
-rw-r--r--tests/ui/parser/issues/issue-113342.stderr11
-rw-r--r--tests/ui/parser/issues/issue-15980.rs3
-rw-r--r--tests/ui/parser/issues/issue-15980.stderr13
-rw-r--r--tests/ui/parser/issues/issue-17718-parse-const.rs7
-rw-r--r--tests/ui/parser/issues/issue-32505.rs1
-rw-r--r--tests/ui/parser/issues/issue-32505.stderr18
-rw-r--r--tests/ui/parser/issues/issue-39616.rs3
-rw-r--r--tests/ui/parser/issues/issue-39616.stderr8
-rw-r--r--tests/ui/parser/issues/issue-49257.rs14
-rw-r--r--tests/ui/parser/issues/issue-49257.stderr42
-rw-r--r--tests/ui/parser/issues/issue-52496.stderr9
-rw-r--r--tests/ui/parser/issues/issue-61858.rs3
-rw-r--r--tests/ui/parser/issues/issue-61858.stderr14
-rw-r--r--tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs10
-rw-r--r--tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr10
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs9
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr8
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs12
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr16
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs14
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr19
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs8
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr19
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue.rs12
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue.stderr16
-rw-r--r--tests/ui/parser/issues/issue-81804.rs6
-rw-r--r--tests/ui/parser/issues/issue-81804.stderr19
-rw-r--r--tests/ui/parser/issues/issue-81827.rs10
-rw-r--r--tests/ui/parser/issues/issue-81827.stderr21
-rw-r--r--tests/ui/parser/issues/issue-84117.stderr3
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs5
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr11
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs22
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr28
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs5
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr11
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs2
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs2
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs2
-rw-r--r--tests/ui/parser/issues/issue-87694-duplicated-pub.rs5
-rw-r--r--tests/ui/parser/issues/issue-87694-duplicated-pub.stderr17
-rw-r--r--tests/ui/parser/issues/issue-87694-misplaced-pub.rs5
-rw-r--r--tests/ui/parser/issues/issue-87694-misplaced-pub.stderr11
-rw-r--r--tests/ui/parser/issues/issue-89396.fixed4
-rw-r--r--tests/ui/parser/issues/issue-89396.rs4
-rw-r--r--tests/ui/parser/issues/issue-89396.stderr4
-rw-r--r--tests/ui/parser/issues/issue-90728.rs6
-rw-r--r--tests/ui/parser/issues/issue-90728.stderr20
-rw-r--r--tests/ui/parser/issues/issue-91421.rs9
-rw-r--r--tests/ui/parser/issues/issue-91421.stderr14
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed13
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs13
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr8
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed8
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs8
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr14
102 files changed, 1646 insertions, 24 deletions
diff --git a/tests/ui/parser/issues/issue-100197-mut-let.fixed b/tests/ui/parser/issues/issue-100197-mut-let.fixed
new file mode 100644
index 000000000..5a8956222
--- /dev/null
+++ b/tests/ui/parser/issues/issue-100197-mut-let.fixed
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ let mut _x = 123;
+ //~^ ERROR invalid variable declaration
+}
diff --git a/tests/ui/parser/issues/issue-100197-mut-let.rs b/tests/ui/parser/issues/issue-100197-mut-let.rs
new file mode 100644
index 000000000..71103813a
--- /dev/null
+++ b/tests/ui/parser/issues/issue-100197-mut-let.rs
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ mut let _x = 123;
+ //~^ ERROR invalid variable declaration
+}
diff --git a/tests/ui/parser/issues/issue-100197-mut-let.stderr b/tests/ui/parser/issues/issue-100197-mut-let.stderr
new file mode 100644
index 000000000..86658e4f3
--- /dev/null
+++ b/tests/ui/parser/issues/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/tests/ui/parser/issues/issue-101477-enum.fixed b/tests/ui/parser/issues/issue-101477-enum.fixed
new file mode 100644
index 000000000..1dfeae22a
--- /dev/null
+++ b/tests/ui/parser/issues/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/tests/ui/parser/issues/issue-101477-enum.rs b/tests/ui/parser/issues/issue-101477-enum.rs
new file mode 100644
index 000000000..ea7051d69
--- /dev/null
+++ b/tests/ui/parser/issues/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/tests/ui/parser/issues/issue-101477-enum.stderr b/tests/ui/parser/issues/issue-101477-enum.stderr
new file mode 100644
index 000000000..94130671f
--- /dev/null
+++ b/tests/ui/parser/issues/issue-101477-enum.stderr
@@ -0,0 +1,18 @@
+error: unexpected `==`
+ --> $DIR/issue-101477-enum.rs:6:7
+ |
+LL | B == 2
+ | ^^ help: try using `=` instead
+ |
+ = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`
+
+error: expected item, found `==`
+ --> $DIR/issue-101477-enum.rs:6:7
+ |
+LL | B == 2
+ | ^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-101477-let.fixed b/tests/ui/parser/issues/issue-101477-let.fixed
new file mode 100644
index 000000000..9989ad815
--- /dev/null
+++ b/tests/ui/parser/issues/issue-101477-let.fixed
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ let x = 2; //~ ERROR unexpected `==`
+ println!("x: {}", x)
+}
diff --git a/tests/ui/parser/issues/issue-101477-let.rs b/tests/ui/parser/issues/issue-101477-let.rs
new file mode 100644
index 000000000..8b0e8bee1
--- /dev/null
+++ b/tests/ui/parser/issues/issue-101477-let.rs
@@ -0,0 +1,6 @@
+// run-rustfix
+
+fn main() {
+ let x == 2; //~ ERROR unexpected `==`
+ println!("x: {}", x)
+}
diff --git a/tests/ui/parser/issues/issue-101477-let.stderr b/tests/ui/parser/issues/issue-101477-let.stderr
new file mode 100644
index 000000000..1b30d4b17
--- /dev/null
+++ b/tests/ui/parser/issues/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/tests/ui/parser/issues/issue-102806.rs b/tests/ui/parser/issues/issue-102806.rs
new file mode 100644
index 000000000..ba297bdc9
--- /dev/null
+++ b/tests/ui/parser/issues/issue-102806.rs
@@ -0,0 +1,25 @@
+#![allow(dead_code)]
+
+#[derive(Default)]
+struct V3 {
+ x: f32,
+ y: f32,
+ z: f32,
+}
+
+fn pz(v: V3) {
+ let _ = V3 { z: 0.0, ...v};
+ //~^ ERROR expected `..`
+
+ let _ = V3 { z: 0.0, ...Default::default() };
+ //~^ ERROR expected `..`
+
+ let _ = V3 { z: 0.0, ... };
+ //~^ expected identifier
+ //~| ERROR missing fields `x` and `y` in initializer of `V3`
+
+ let V3 { z: val, ... } = v;
+ //~^ ERROR expected field pattern
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-102806.stderr b/tests/ui/parser/issues/issue-102806.stderr
new file mode 100644
index 000000000..ba8174a82
--- /dev/null
+++ b/tests/ui/parser/issues/issue-102806.stderr
@@ -0,0 +1,50 @@
+error: expected `..`, found `...`
+ --> $DIR/issue-102806.rs:11:26
+ |
+LL | let _ = V3 { z: 0.0, ...v};
+ | ^^^
+ |
+help: use `..` to fill in the rest of the fields
+ |
+LL | let _ = V3 { z: 0.0, ..v};
+ | ~~
+
+error: expected `..`, found `...`
+ --> $DIR/issue-102806.rs:14:26
+ |
+LL | let _ = V3 { z: 0.0, ...Default::default() };
+ | ^^^
+ |
+help: use `..` to fill in the rest of the fields
+ |
+LL | let _ = V3 { z: 0.0, ..Default::default() };
+ | ~~
+
+error: expected identifier, found `...`
+ --> $DIR/issue-102806.rs:17:26
+ |
+LL | let _ = V3 { z: 0.0, ... };
+ | -- ^^^ expected identifier
+ | |
+ | while parsing this struct
+
+error: expected field pattern, found `...`
+ --> $DIR/issue-102806.rs:21:22
+ |
+LL | let V3 { z: val, ... } = v;
+ | ^^^
+ |
+help: to omit remaining fields, use `..`
+ |
+LL | let V3 { z: val, .. } = v;
+ | ~~
+
+error[E0063]: missing fields `x` and `y` in initializer of `V3`
+ --> $DIR/issue-102806.rs:17:13
+ |
+LL | let _ = V3 { z: 0.0, ... };
+ | ^^ missing `x` and `y`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0063`.
diff --git a/tests/ui/parser/issues/issue-103143.rs b/tests/ui/parser/issues/issue-103143.rs
new file mode 100644
index 000000000..a584274c4
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103143.rs
@@ -0,0 +1,5 @@
+fn main() {
+ x::<#[a]y::<z>>
+ //~^ ERROR invalid const generic expression
+ //~| ERROR cannot find value `x` in this scope
+}
diff --git a/tests/ui/parser/issues/issue-103143.stderr b/tests/ui/parser/issues/issue-103143.stderr
new file mode 100644
index 000000000..4035c69af
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103143.stderr
@@ -0,0 +1,20 @@
+error: invalid const generic expression
+ --> $DIR/issue-103143.rs:2:13
+ |
+LL | x::<#[a]y::<z>>
+ | ^^^^^^
+ |
+help: expressions must be enclosed in braces to be used as const generic arguments
+ |
+LL | x::<#[a]{ y::<z> }>
+ | + +
+
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/issue-103143.rs:2:5
+ |
+LL | x::<#[a]y::<z>>
+ | ^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/parser/issues/issue-103381.fixed b/tests/ui/parser/issues/issue-103381.fixed
new file mode 100644
index 000000000..6a9fb9910
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103381.fixed
@@ -0,0 +1,59 @@
+// run-rustfix
+
+#![feature(let_chains)]
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![allow(irrefutable_let_patterns)]
+
+fn err_some(b: bool, x: Option<u32>) {
+ if b && let Some(x) = x {}
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn err_none(b: bool, x: Option<u32>) {
+ if b && let None = x {}
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn err_bool_1() {
+ if true && true { true } else { false };
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn err_bool_2() {
+ if true && false { true } else { false };
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn should_ok_1() {
+ if true && if let x = 1 { true } else { true } {}
+}
+
+fn should_ok_2() {
+ if true && if let 1 = 1 { true } else { true } {}
+}
+
+fn should_ok_3() {
+ if true && if true { true } else { false } {}
+}
+
+fn shoule_match_ok() {
+ #[cfg(feature = "full")]
+ {
+ let a = 1;
+ let b = 2;
+ if match a {
+ 1 if b == 1 => true,
+ _ => false,
+ } && if a > 1 { true } else { false }
+ {
+ true
+ }
+ }
+}
+
+fn should_ok_in_nested() {
+ if true && if true { true } else { false } { true } else { false };
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-103381.rs b/tests/ui/parser/issues/issue-103381.rs
new file mode 100644
index 000000000..bf79e1010
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103381.rs
@@ -0,0 +1,59 @@
+// run-rustfix
+
+#![feature(let_chains)]
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![allow(irrefutable_let_patterns)]
+
+fn err_some(b: bool, x: Option<u32>) {
+ if b && if let Some(x) = x {}
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn err_none(b: bool, x: Option<u32>) {
+ if b && if let None = x {}
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn err_bool_1() {
+ if true && if true { true } else { false };
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn err_bool_2() {
+ if true && if false { true } else { false };
+ //~^ ERROR unexpected `if` in the condition expression
+}
+
+fn should_ok_1() {
+ if true && if let x = 1 { true } else { true } {}
+}
+
+fn should_ok_2() {
+ if true && if let 1 = 1 { true } else { true } {}
+}
+
+fn should_ok_3() {
+ if true && if true { true } else { false } {}
+}
+
+fn shoule_match_ok() {
+ #[cfg(feature = "full")]
+ {
+ let a = 1;
+ let b = 2;
+ if match a {
+ 1 if b == 1 => true,
+ _ => false,
+ } && if a > 1 { true } else { false }
+ {
+ true
+ }
+ }
+}
+
+fn should_ok_in_nested() {
+ if true && if true { true } else { false } { true } else { false };
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-103381.stderr b/tests/ui/parser/issues/issue-103381.stderr
new file mode 100644
index 000000000..85fcc18e7
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103381.stderr
@@ -0,0 +1,50 @@
+error: unexpected `if` in the condition expression
+ --> $DIR/issue-103381.rs:9:12
+ |
+LL | if b && if let Some(x) = x {}
+ | ^^^^
+ |
+help: remove the `if`
+ |
+LL - if b && if let Some(x) = x {}
+LL + if b && let Some(x) = x {}
+ |
+
+error: unexpected `if` in the condition expression
+ --> $DIR/issue-103381.rs:14:12
+ |
+LL | if b && if let None = x {}
+ | ^^^^
+ |
+help: remove the `if`
+ |
+LL - if b && if let None = x {}
+LL + if b && let None = x {}
+ |
+
+error: unexpected `if` in the condition expression
+ --> $DIR/issue-103381.rs:19:15
+ |
+LL | if true && if true { true } else { false };
+ | ^^^^
+ |
+help: remove the `if`
+ |
+LL - if true && if true { true } else { false };
+LL + if true && true { true } else { false };
+ |
+
+error: unexpected `if` in the condition expression
+ --> $DIR/issue-103381.rs:24:15
+ |
+LL | if true && if false { true } else { false };
+ | ^^^^
+ |
+help: remove the `if`
+ |
+LL - if true && if false { true } else { false };
+LL + if true && false { true } else { false };
+ |
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/parser/issues/issue-103425.rs b/tests/ui/parser/issues/issue-103425.rs
new file mode 100644
index 000000000..c2f8123ca
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103425.rs
@@ -0,0 +1,15 @@
+fn f() -> f32 {
+ 3
+ //~^ ERROR expected `;`
+ 5.0
+}
+
+fn k() -> f32 {
+ 2_u32
+ //~^ ERROR expected `;`
+ 3_i8
+ //~^ ERROR expected `;`
+ 5.0
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-103425.stderr b/tests/ui/parser/issues/issue-103425.stderr
new file mode 100644
index 000000000..0efe3e3ca
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103425.stderr
@@ -0,0 +1,29 @@
+error: expected `;`, found `5.0`
+ --> $DIR/issue-103425.rs:2:6
+ |
+LL | 3
+ | ^ help: add `;` here
+LL |
+LL | 5.0
+ | --- unexpected token
+
+error: expected `;`, found `3_i8`
+ --> $DIR/issue-103425.rs:8:10
+ |
+LL | 2_u32
+ | ^ help: add `;` here
+LL |
+LL | 3_i8
+ | ---- unexpected token
+
+error: expected `;`, found `5.0`
+ --> $DIR/issue-103425.rs:10:9
+ |
+LL | 3_i8
+ | ^ help: add `;` here
+LL |
+LL | 5.0
+ | --- unexpected token
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/parser/issues/issue-103451.rs b/tests/ui/parser/issues/issue-103451.rs
new file mode 100644
index 000000000..be33213f3
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103451.rs
@@ -0,0 +1,4 @@
+// error-pattern: this file contains an unclosed delimiter
+struct R { }
+struct S {
+ x: [u8; R
diff --git a/tests/ui/parser/issues/issue-103451.stderr b/tests/ui/parser/issues/issue-103451.stderr
new file mode 100644
index 000000000..6aacd5012
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103451.stderr
@@ -0,0 +1,12 @@
+error: this file contains an unclosed delimiter
+ --> $DIR/issue-103451.rs:4:15
+ |
+LL | struct S {
+ | - unclosed delimiter
+LL | x: [u8; R
+ | - ^
+ | |
+ | unclosed delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs
new file mode 100644
index 000000000..8012cb652
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs
@@ -0,0 +1,8 @@
+#![crate_type = "lib"]
+
+struct Apple((Apple, Option(Banana ? Citron)));
+//~^ ERROR invalid `?` in type
+//~| ERROR expected one of `)` or `,`, found `Citron`
+//~| ERROR cannot find type `Citron` in this scope [E0412]
+//~| ERROR parenthesized type parameters may only be used with a `Fn` trait [E0214]
+//~| ERROR recursive type `Apple` has infinite size [E0072]
diff --git a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr
new file mode 100644
index 000000000..b0d8b03ae
--- /dev/null
+++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr
@@ -0,0 +1,51 @@
+error: invalid `?` in type
+ --> $DIR/issue-103748-ICE-wrong-braces.rs:3:36
+ |
+LL | struct Apple((Apple, Option(Banana ? Citron)));
+ | ^ `?` is only allowed on expressions, not types
+ |
+help: if you meant to express that the type might not contain a value, use the `Option` wrapper type
+ |
+LL | struct Apple((Apple, Option(Option<Banana > Citron)));
+ | +++++++ ~
+
+error: expected one of `)` or `,`, found `Citron`
+ --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38
+ |
+LL | struct Apple((Apple, Option(Banana ? Citron)));
+ | -^^^^^^ expected one of `)` or `,`
+ | |
+ | help: missing `,`
+
+error[E0412]: cannot find type `Citron` in this scope
+ --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38
+ |
+LL | struct Apple((Apple, Option(Banana ? Citron)));
+ | ^^^^^^ not found in this scope
+
+error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
+ --> $DIR/issue-103748-ICE-wrong-braces.rs:3:22
+ |
+LL | struct Apple((Apple, Option(Banana ? Citron)));
+ | ^^^^^^^^^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses
+ |
+help: use angle brackets instead
+ |
+LL | struct Apple((Apple, Option<Banana ? Citron>));
+ | ~ ~
+
+error[E0072]: recursive type `Apple` has infinite size
+ --> $DIR/issue-103748-ICE-wrong-braces.rs:3:1
+ |
+LL | struct Apple((Apple, Option(Banana ? Citron)));
+ | ^^^^^^^^^^^^ ----- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | struct Apple((Box<Apple>, Option(Banana ? Citron)));
+ | ++++ +
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0072, E0214, E0412.
+For more information about an error, try `rustc --explain E0072`.
diff --git a/tests/ui/parser/issues/issue-104620.rs b/tests/ui/parser/issues/issue-104620.rs
new file mode 100644
index 000000000..f49476c44
--- /dev/null
+++ b/tests/ui/parser/issues/issue-104620.rs
@@ -0,0 +1,4 @@
+#![feature(rustc_attrs)]
+
+#![rustc_dummy=5z] //~ ERROR unexpected expression: `5z`
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-104620.stderr b/tests/ui/parser/issues/issue-104620.stderr
new file mode 100644
index 000000000..d06a6b255
--- /dev/null
+++ b/tests/ui/parser/issues/issue-104620.stderr
@@ -0,0 +1,8 @@
+error: unexpected expression: `5z`
+ --> $DIR/issue-104620.rs:3:16
+ |
+LL | #![rustc_dummy=5z]
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-104867-inc-dec-2.rs b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs
new file mode 100644
index 000000000..a006421a9
--- /dev/null
+++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs
@@ -0,0 +1,52 @@
+fn test1() {
+ let mut i = 0;
+ let _ = i + ++i; //~ ERROR Rust has no prefix increment operator
+}
+
+fn test2() {
+ let mut i = 0;
+ let _ = ++i + i; //~ ERROR Rust has no prefix increment operator
+}
+
+fn test3() {
+ let mut i = 0;
+ let _ = ++i + ++i; //~ ERROR Rust has no prefix increment operator
+}
+
+fn test4() {
+ let mut i = 0;
+ let _ = i + i++; //~ ERROR Rust has no postfix increment operator
+ // won't suggest since we can not handle the precedences
+}
+
+fn test5() {
+ let mut i = 0;
+ let _ = i++ + i; //~ ERROR Rust has no postfix increment operator
+}
+
+fn test6() {
+ let mut i = 0;
+ let _ = i++ + i++; //~ ERROR Rust has no postfix increment operator
+}
+
+fn test7() {
+ let mut i = 0;
+ let _ = ++i + i++; //~ ERROR Rust has no prefix increment operator
+}
+
+fn test8() {
+ let mut i = 0;
+ let _ = i++ + ++i; //~ ERROR Rust has no postfix increment operator
+}
+
+fn test9() {
+ let mut i = 0;
+ let _ = (1 + 2 + i)++; //~ ERROR Rust has no postfix increment operator
+}
+
+fn test10() {
+ let mut i = 0;
+ let _ = (i++ + 1) + 2; //~ ERROR Rust has no postfix increment operator
+}
+
+fn main() { }
diff --git a/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr
new file mode 100644
index 000000000..4e2d05468
--- /dev/null
+++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr
@@ -0,0 +1,107 @@
+error: Rust has no prefix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:3:17
+ |
+LL | let _ = i + ++i;
+ | ^^ not a valid prefix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = i + { i += 1; i };
+ | ~ +++++++++
+
+error: Rust has no prefix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:8:13
+ |
+LL | let _ = ++i + i;
+ | ^^ not a valid prefix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = { i += 1; i } + i;
+ | ~ +++++++++
+
+error: Rust has no prefix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:13:13
+ |
+LL | let _ = ++i + ++i;
+ | ^^ not a valid prefix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = { i += 1; i } + ++i;
+ | ~ +++++++++
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:18:18
+ |
+LL | let _ = i + i++;
+ | ^^ not a valid postfix operator
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:24:14
+ |
+LL | let _ = i++ + i;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = { let tmp = i; i += 1; tmp } + i;
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:29:14
+ |
+LL | let _ = i++ + i++;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = { let tmp = i; i += 1; tmp } + i++;
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: Rust has no prefix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:34:13
+ |
+LL | let _ = ++i + i++;
+ | ^^ not a valid prefix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = { i += 1; i } + i++;
+ | ~ +++++++++
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:39:14
+ |
+LL | let _ = i++ + ++i;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = { let tmp = i; i += 1; tmp } + ++i;
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:44:24
+ |
+LL | let _ = (1 + 2 + i)++;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) += 1; tmp };
+ | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec-2.rs:49:15
+ |
+LL | let _ = (i++ + 1) + 2;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | let _ = ({ let tmp = i; i += 1; tmp } + 1) + 2;
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: aborting due to 10 previous errors
+
diff --git a/tests/ui/parser/issues/issue-104867-inc-dec.rs b/tests/ui/parser/issues/issue-104867-inc-dec.rs
new file mode 100644
index 000000000..760c67b4b
--- /dev/null
+++ b/tests/ui/parser/issues/issue-104867-inc-dec.rs
@@ -0,0 +1,45 @@
+struct S {
+ x: i32,
+}
+
+fn test1() {
+ let mut i = 0;
+ i++; //~ ERROR Rust has no postfix increment operator
+}
+
+fn test2() {
+ let s = S { x: 0 };
+ s.x++; //~ ERROR Rust has no postfix increment operator
+}
+
+fn test3() {
+ let mut i = 0;
+ if i++ == 1 {} //~ ERROR Rust has no postfix increment operator
+}
+
+fn test4() {
+ let mut i = 0;
+ ++i; //~ ERROR Rust has no prefix increment operator
+}
+
+fn test5() {
+ let mut i = 0;
+ if ++i == 1 { } //~ ERROR Rust has no prefix increment operator
+}
+
+fn test6() {
+ let mut i = 0;
+ loop { break; }
+ i++; //~ ERROR Rust has no postfix increment operator
+ loop { break; }
+ ++i;
+}
+
+fn test7() {
+ let mut i = 0;
+ loop { break; }
+ ++i; //~ ERROR Rust has no prefix increment operator
+}
+
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-104867-inc-dec.stderr b/tests/ui/parser/issues/issue-104867-inc-dec.stderr
new file mode 100644
index 000000000..78bfd3e82
--- /dev/null
+++ b/tests/ui/parser/issues/issue-104867-inc-dec.stderr
@@ -0,0 +1,81 @@
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec.rs:7:6
+ |
+LL | i++;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | i += 1;
+ | ~~~~
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec.rs:12:8
+ |
+LL | s.x++;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | s.x += 1;
+ | ~~~~
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec.rs:17:9
+ |
+LL | if i++ == 1 {}
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | if { let tmp = i; i += 1; tmp } == 1 {}
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: Rust has no prefix increment operator
+ --> $DIR/issue-104867-inc-dec.rs:22:5
+ |
+LL | ++i;
+ | ^^ not a valid prefix operator
+ |
+help: use `+= 1` instead
+ |
+LL - ++i;
+LL + i += 1;
+ |
+
+error: Rust has no prefix increment operator
+ --> $DIR/issue-104867-inc-dec.rs:27:8
+ |
+LL | if ++i == 1 { }
+ | ^^ not a valid prefix operator
+ |
+help: use `+= 1` instead
+ |
+LL | if { i += 1; i } == 1 { }
+ | ~ +++++++++
+
+error: Rust has no postfix increment operator
+ --> $DIR/issue-104867-inc-dec.rs:33:6
+ |
+LL | i++;
+ | ^^ not a valid postfix operator
+ |
+help: use `+= 1` instead
+ |
+LL | i += 1;
+ | ~~~~
+
+error: Rust has no prefix increment operator
+ --> $DIR/issue-104867-inc-dec.rs:41:5
+ |
+LL | ++i;
+ | ^^ not a valid prefix operator
+ |
+help: use `+= 1` instead
+ |
+LL - ++i;
+LL + i += 1;
+ |
+
+error: aborting due to 7 previous errors
+
diff --git a/tests/ui/parser/issues/issue-105366.fixed b/tests/ui/parser/issues/issue-105366.fixed
new file mode 100644
index 000000000..ad26643c3
--- /dev/null
+++ b/tests/ui/parser/issues/issue-105366.fixed
@@ -0,0 +1,12 @@
+// run-rustfix
+
+struct Foo;
+
+impl From<i32> for Foo {
+ //~^ ERROR you might have meant to write `impl` instead of `fn`
+ fn from(_a: i32) -> Self {
+ Foo
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-105366.rs b/tests/ui/parser/issues/issue-105366.rs
new file mode 100644
index 000000000..311b6a60f
--- /dev/null
+++ b/tests/ui/parser/issues/issue-105366.rs
@@ -0,0 +1,12 @@
+// run-rustfix
+
+struct Foo;
+
+fn From<i32> for Foo {
+ //~^ ERROR you might have meant to write `impl` instead of `fn`
+ fn from(_a: i32) -> Self {
+ Foo
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-105366.stderr b/tests/ui/parser/issues/issue-105366.stderr
new file mode 100644
index 000000000..0a7408e2c
--- /dev/null
+++ b/tests/ui/parser/issues/issue-105366.stderr
@@ -0,0 +1,13 @@
+error: you might have meant to write `impl` instead of `fn`
+ --> $DIR/issue-105366.rs:5:1
+ |
+LL | fn From<i32> for Foo {
+ | ^^
+ |
+help: replace `fn` with `impl` here
+ |
+LL | impl From<i32> for Foo {
+ | ~~~~
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-105634.rs b/tests/ui/parser/issues/issue-105634.rs
new file mode 100644
index 000000000..579aa6e5b
--- /dev/null
+++ b/tests/ui/parser/issues/issue-105634.rs
@@ -0,0 +1,8 @@
+// check-pass
+
+fn main() {
+ let _a = ..;
+ let _b = ..=10;
+ let _c = &..;
+ let _d = &..=10;
+}
diff --git a/tests/ui/parser/issues/issue-107705.rs b/tests/ui/parser/issues/issue-107705.rs
new file mode 100644
index 000000000..b80984fcd
--- /dev/null
+++ b/tests/ui/parser/issues/issue-107705.rs
@@ -0,0 +1,3 @@
+// compile-flags: -C debug-assertions
+
+fn f() {a(b:&, //~ ERROR this file contains an unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-107705.stderr b/tests/ui/parser/issues/issue-107705.stderr
new file mode 100644
index 000000000..d2d613461
--- /dev/null
+++ b/tests/ui/parser/issues/issue-107705.stderr
@@ -0,0 +1,10 @@
+error: this file contains an unclosed delimiter
+ --> $DIR/issue-107705.rs:3:67
+ |
+LL | fn f() {a(b:&,
+ | - - unclosed delimiter ^
+ | |
+ | unclosed delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed
new file mode 100644
index 000000000..b819aa810
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub fn missing() -> () {}
+//~^ ERROR missing parameters for function definition
+
+pub fn missing2() {}
+//~^ ERROR missing parameters for function definition
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.rs b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs
new file mode 100644
index 000000000..01efe7280
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub fn missing -> () {}
+//~^ ERROR missing parameters for function definition
+
+pub fn missing2 {}
+//~^ ERROR missing parameters for function definition
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr
new file mode 100644
index 000000000..86d3449cc
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr
@@ -0,0 +1,14 @@
+error: missing parameters for function definition
+ --> $DIR/issue-108109-fn-missing-params.rs:3:15
+ |
+LL | pub fn missing -> () {}
+ | ^ help: add a parameter list
+
+error: missing parameters for function definition
+ --> $DIR/issue-108109-fn-missing-params.rs:6:16
+ |
+LL | pub fn missing2 {}
+ | ^ help: add a parameter list
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed
new file mode 100644
index 000000000..eaae28886
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub fn func<F>() where F: FnOnce() -> () {}
+//~^ ERROR expected one of
+//~| NOTE expected one of
+//~| NOTE `Fn` bounds require arguments in parentheses
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs
new file mode 100644
index 000000000..ea5c71150
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub fn func<F>() where F: FnOnce -> () {}
+//~^ ERROR expected one of
+//~| NOTE expected one of
+//~| NOTE `Fn` bounds require arguments in parentheses
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr
new file mode 100644
index 000000000..7cda66757
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr
@@ -0,0 +1,11 @@
+error: expected one of `(`, `+`, `,`, `::`, `<`, or `{`, found `->`
+ --> $DIR/issue-108109-fn-trait-missing-paren.rs:3:34
+ |
+LL | pub fn func<F>() where F: FnOnce -> () {}
+ | -------^^ expected one of `(`, `+`, `,`, `::`, `<`, or `{`
+ | | |
+ | | help: try adding parentheses
+ | `Fn` bounds require arguments in parentheses
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-108495-dec.rs b/tests/ui/parser/issues/issue-108495-dec.rs
new file mode 100644
index 000000000..e0816f84e
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108495-dec.rs
@@ -0,0 +1,39 @@
+fn test0() {
+ let mut i = 0;
+ let _ = i + i--; //~ ERROR Rust has no postfix decrement operator
+ // won't suggest since we can not handle the precedences
+}
+
+fn test1() {
+ let mut i = 0;
+ let _ = i-- + i--; //~ ERROR Rust has no postfix decrement operator
+}
+
+fn test2() {
+ let mut i = 0;
+ let _ = --i + i--; //~ ERROR Rust has no postfix decrement operator
+}
+
+fn test3() {
+ let mut i = 0;
+ let _ = i-- + --i; //~ ERROR Rust has no postfix decrement operator
+}
+
+fn test4() {
+ let mut i = 0;
+ let _ = (1 + 2 + i)--; //~ ERROR Rust has no postfix decrement operator
+}
+
+fn test5() {
+ let mut i = 0;
+ let _ = (i-- + 1) + 2; //~ ERROR Rust has no postfix decrement operator
+}
+
+fn test6(){
+ let i=10;
+ while i != 0 {
+ i--; //~ ERROR Rust has no postfix decrement operator
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108495-dec.stderr b/tests/ui/parser/issues/issue-108495-dec.stderr
new file mode 100644
index 000000000..85b29038f
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108495-dec.stderr
@@ -0,0 +1,69 @@
+error: Rust has no postfix decrement operator
+ --> $DIR/issue-108495-dec.rs:3:18
+ |
+LL | let _ = i + i--;
+ | ^^ not a valid postfix operator
+
+error: Rust has no postfix decrement operator
+ --> $DIR/issue-108495-dec.rs:9:14
+ |
+LL | let _ = i-- + i--;
+ | ^^ not a valid postfix operator
+ |
+help: use `-= 1` instead
+ |
+LL | let _ = { let tmp = i; i -= 1; tmp } + i--;
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: Rust has no postfix decrement operator
+ --> $DIR/issue-108495-dec.rs:14:20
+ |
+LL | let _ = --i + i--;
+ | ^^ not a valid postfix operator
+
+error: Rust has no postfix decrement operator
+ --> $DIR/issue-108495-dec.rs:19:14
+ |
+LL | let _ = i-- + --i;
+ | ^^ not a valid postfix operator
+ |
+help: use `-= 1` instead
+ |
+LL | let _ = { let tmp = i; i -= 1; tmp } + --i;
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: Rust has no postfix decrement operator
+ --> $DIR/issue-108495-dec.rs:24:24
+ |
+LL | let _ = (1 + 2 + i)--;
+ | ^^ not a valid postfix operator
+ |
+help: use `-= 1` instead
+ |
+LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) -= 1; tmp };
+ | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: Rust has no postfix decrement operator
+ --> $DIR/issue-108495-dec.rs:29:15
+ |
+LL | let _ = (i-- + 1) + 2;
+ | ^^ not a valid postfix operator
+ |
+help: use `-= 1` instead
+ |
+LL | let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2;
+ | +++++++++++ ~~~~~~~~~~~~~~~
+
+error: Rust has no postfix decrement operator
+ --> $DIR/issue-108495-dec.rs:35:10
+ |
+LL | i--;
+ | ^^ not a valid postfix operator
+ |
+help: use `-= 1` instead
+ |
+LL | i -= 1;
+ | ~~~~
+
+error: aborting due to 7 previous errors
+
diff --git a/tests/ui/parser/issues/issue-112188.fixed b/tests/ui/parser/issues/issue-112188.fixed
new file mode 100644
index 000000000..5e73d8e38
--- /dev/null
+++ b/tests/ui/parser/issues/issue-112188.fixed
@@ -0,0 +1,14 @@
+// run-rustfix
+
+#![allow(unused)]
+
+struct Foo { x: i32 }
+
+fn main() {
+ let f = Foo { x: 0 };
+ let Foo { .. } = f;
+ let Foo { .. } = f; //~ ERROR expected `}`, found `,`
+ let Foo { x, .. } = f;
+ let Foo { x, .. } = f; //~ ERROR expected `}`, found `,`
+ let Foo { x, .. } = f; //~ ERROR expected `}`, found `,`
+}
diff --git a/tests/ui/parser/issues/issue-112188.rs b/tests/ui/parser/issues/issue-112188.rs
new file mode 100644
index 000000000..27ca192e5
--- /dev/null
+++ b/tests/ui/parser/issues/issue-112188.rs
@@ -0,0 +1,14 @@
+// run-rustfix
+
+#![allow(unused)]
+
+struct Foo { x: i32 }
+
+fn main() {
+ let f = Foo { x: 0 };
+ let Foo { .. } = f;
+ let Foo { .., } = f; //~ ERROR expected `}`, found `,`
+ let Foo { x, .. } = f;
+ let Foo { .., x } = f; //~ ERROR expected `}`, found `,`
+ let Foo { .., x, .. } = f; //~ ERROR expected `}`, found `,`
+}
diff --git a/tests/ui/parser/issues/issue-112188.stderr b/tests/ui/parser/issues/issue-112188.stderr
new file mode 100644
index 000000000..6d2d8e6a3
--- /dev/null
+++ b/tests/ui/parser/issues/issue-112188.stderr
@@ -0,0 +1,37 @@
+error: expected `}`, found `,`
+ --> $DIR/issue-112188.rs:10:17
+ |
+LL | let Foo { .., } = f;
+ | --^
+ | | |
+ | | expected `}`
+ | | help: remove this comma
+ | `..` must be at the end and cannot have a trailing comma
+
+error: expected `}`, found `,`
+ --> $DIR/issue-112188.rs:12:17
+ |
+LL | let Foo { .., x } = f;
+ | --^
+ | | |
+ | | expected `}`
+ | `..` must be at the end and cannot have a trailing comma
+ |
+help: move the `..` to the end of the field list
+ |
+LL - let Foo { .., x } = f;
+LL + let Foo { x, .. } = f;
+ |
+
+error: expected `}`, found `,`
+ --> $DIR/issue-112188.rs:13:17
+ |
+LL | let Foo { .., x, .. } = f;
+ | --^-
+ | | |
+ | | expected `}`
+ | `..` must be at the end and cannot have a trailing comma
+ | help: remove the starting `..`
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/parser/issues/issue-113342.rs b/tests/ui/parser/issues/issue-113342.rs
new file mode 100644
index 000000000..18b502736
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113342.rs
@@ -0,0 +1,9 @@
+#[link(name = "my_c_library")]
+extern "C" {
+ fn my_c_function(x: i32) -> bool;
+}
+
+#[no_mangle]
+extern "C" pub fn id(x: i32) -> i32 { x } //~ ERROR expected `fn`, found keyword `pub`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-113342.stderr b/tests/ui/parser/issues/issue-113342.stderr
new file mode 100644
index 000000000..a0c5e665f
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113342.stderr
@@ -0,0 +1,11 @@
+error: expected `fn`, found keyword `pub`
+ --> $DIR/issue-113342.rs:7:12
+ |
+LL | extern "C" pub fn id(x: i32) -> i32 { x }
+ | -----------^^^
+ | | |
+ | | expected `fn`
+ | help: visibility `pub` must come before `extern "C"`: `pub extern "C"`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-15980.rs b/tests/ui/parser/issues/issue-15980.rs
index 87faa7d5f..eb7b6ca82 100644
--- a/tests/ui/parser/issues/issue-15980.rs
+++ b/tests/ui/parser/issues/issue-15980.rs
@@ -9,9 +9,6 @@ fn main(){
//~^ ERROR expected identifier, found keyword `return`
//~| NOTE expected identifier, found keyword
}
- //~^ NOTE expected one of `.`, `=>`, `?`, or an operator
_ => {}
- //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
- //~| NOTE unexpected token
}
}
diff --git a/tests/ui/parser/issues/issue-15980.stderr b/tests/ui/parser/issues/issue-15980.stderr
index c59c81119..cf8d01147 100644
--- a/tests/ui/parser/issues/issue-15980.stderr
+++ b/tests/ui/parser/issues/issue-15980.stderr
@@ -11,15 +11,10 @@ help: escape `return` to use it as an identifier
|
LL | r#return
| ++
-
-error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
- --> $DIR/issue-15980.rs:13:9
+help: you might have meant to start a match arm after the match guard
|
-LL | }
- | - expected one of `.`, `=>`, `?`, or an operator
-LL |
-LL | _ => {}
- | ^ unexpected token
+LL | Err(ref e) if e.kind == io::EndOfFile => {
+ | ++
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-17718-parse-const.rs b/tests/ui/parser/issues/issue-17718-parse-const.rs
new file mode 100644
index 000000000..d5a5f445d
--- /dev/null
+++ b/tests/ui/parser/issues/issue-17718-parse-const.rs
@@ -0,0 +1,7 @@
+// run-pass
+
+const FOO: usize = 3;
+
+fn main() {
+ assert_eq!(FOO, 3);
+}
diff --git a/tests/ui/parser/issues/issue-32505.rs b/tests/ui/parser/issues/issue-32505.rs
index f31c00e5c..d95e7dc7d 100644
--- a/tests/ui/parser/issues/issue-32505.rs
+++ b/tests/ui/parser/issues/issue-32505.rs
@@ -1,5 +1,6 @@
pub fn test() {
foo(|_|) //~ ERROR expected expression, found `)`
+ //~^ ERROR cannot find function `foo` in this scope
}
fn main() { }
diff --git a/tests/ui/parser/issues/issue-32505.stderr b/tests/ui/parser/issues/issue-32505.stderr
index cdd779a93..27ad2c3e5 100644
--- a/tests/ui/parser/issues/issue-32505.stderr
+++ b/tests/ui/parser/issues/issue-32505.stderr
@@ -2,7 +2,21 @@ error: expected expression, found `)`
--> $DIR/issue-32505.rs:2:12
|
LL | foo(|_|)
- | ^ expected expression
+ | ---^ expected expression
+ | |
+ | while parsing the body of this closure
+ |
+help: you might have meant to open the body of the closure
+ |
+LL | foo(|_| {})
+ | ++
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/issue-32505.rs:2:5
+ |
+LL | foo(|_|)
+ | ^^^ not found in this scope
-error: aborting due to previous error
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/parser/issues/issue-39616.rs b/tests/ui/parser/issues/issue-39616.rs
new file mode 100644
index 000000000..46b5aa334
--- /dev/null
+++ b/tests/ui/parser/issues/issue-39616.rs
@@ -0,0 +1,3 @@
+fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-39616.stderr b/tests/ui/parser/issues/issue-39616.stderr
new file mode 100644
index 000000000..393d1f2e2
--- /dev/null
+++ b/tests/ui/parser/issues/issue-39616.stderr
@@ -0,0 +1,8 @@
+error: expected type, found `0`
+ --> $DIR/issue-39616.rs:1:12
+ |
+LL | fn foo(a: [0; 1]) {}
+ | ^ expected type
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-49257.rs b/tests/ui/parser/issues/issue-49257.rs
new file mode 100644
index 000000000..a7fa19d52
--- /dev/null
+++ b/tests/ui/parser/issues/issue-49257.rs
@@ -0,0 +1,14 @@
+// Test for #49257:
+// emits good diagnostics for `..` pattern fragments not in the last position.
+
+#![allow(unused)]
+
+struct Point { x: u8, y: u8 }
+
+fn main() {
+ let p = Point { x: 0, y: 0 };
+ let Point { .., y, } = p; //~ ERROR expected `}`, found `,`
+ let Point { .., y } = p; //~ ERROR expected `}`, found `,`
+ let Point { .., } = p; //~ ERROR expected `}`, found `,`
+ let Point { .. } = p;
+}
diff --git a/tests/ui/parser/issues/issue-49257.stderr b/tests/ui/parser/issues/issue-49257.stderr
new file mode 100644
index 000000000..97e16f88b
--- /dev/null
+++ b/tests/ui/parser/issues/issue-49257.stderr
@@ -0,0 +1,42 @@
+error: expected `}`, found `,`
+ --> $DIR/issue-49257.rs:10:19
+ |
+LL | let Point { .., y, } = p;
+ | --^
+ | | |
+ | | expected `}`
+ | `..` must be at the end and cannot have a trailing comma
+ |
+help: move the `..` to the end of the field list
+ |
+LL - let Point { .., y, } = p;
+LL + let Point { y, .. } = p;
+ |
+
+error: expected `}`, found `,`
+ --> $DIR/issue-49257.rs:11:19
+ |
+LL | let Point { .., y } = p;
+ | --^
+ | | |
+ | | expected `}`
+ | `..` must be at the end and cannot have a trailing comma
+ |
+help: move the `..` to the end of the field list
+ |
+LL - let Point { .., y } = p;
+LL + let Point { y, .. } = p;
+ |
+
+error: expected `}`, found `,`
+ --> $DIR/issue-49257.rs:12:19
+ |
+LL | let Point { .., } = p;
+ | --^
+ | | |
+ | | expected `}`
+ | | help: remove this comma
+ | `..` must be at the end and cannot have a trailing comma
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/parser/issues/issue-52496.stderr b/tests/ui/parser/issues/issue-52496.stderr
index 77335c64c..78c81bf5b 100644
--- a/tests/ui/parser/issues/issue-52496.stderr
+++ b/tests/ui/parser/issues/issue-52496.stderr
@@ -8,10 +8,15 @@ error: expected one of `,`, `:`, or `}`, found `.`
--> $DIR/issue-52496.rs:8:22
|
LL | let _ = Foo { bar.into(), bat: -1, . };
- | --- - ^ expected one of `,`, `:`, or `}`
+ | --- ---^ expected one of `,`, `:`, or `}`
| | |
- | | help: try naming a field: `bar:`
+ | | while parsing this struct field
| while parsing this struct
+ |
+help: try naming a field
+ |
+LL | let _ = Foo { bar: bar.into(), bat: -1, . };
+ | ++++
error: expected identifier, found `.`
--> $DIR/issue-52496.rs:8:40
diff --git a/tests/ui/parser/issues/issue-61858.rs b/tests/ui/parser/issues/issue-61858.rs
new file mode 100644
index 000000000..6c3b56586
--- /dev/null
+++ b/tests/ui/parser/issues/issue-61858.rs
@@ -0,0 +1,3 @@
+fn main() {
+ (if foobar) //~ ERROR expected `{`, found `)`
+}
diff --git a/tests/ui/parser/issues/issue-61858.stderr b/tests/ui/parser/issues/issue-61858.stderr
new file mode 100644
index 000000000..03f51c6e3
--- /dev/null
+++ b/tests/ui/parser/issues/issue-61858.stderr
@@ -0,0 +1,14 @@
+error: expected `{`, found `)`
+ --> $DIR/issue-61858.rs:2:15
+ |
+LL | (if foobar)
+ | ^ expected `{`
+ |
+note: the `if` expression is missing a block after this condition
+ --> $DIR/issue-61858.rs:2:9
+ |
+LL | (if foobar)
+ | ^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs
new file mode 100644
index 000000000..57d36feb3
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs
@@ -0,0 +1,10 @@
+macro_rules! x {
+ ($($c:tt)*) => {
+ $($c)ö* {}
+ //~^ ERROR missing condition for `if` expression
+ };
+}
+
+fn main() {
+ x!(if);
+}
diff --git a/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
new file mode 100644
index 000000000..6674b924e
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
@@ -0,0 +1,10 @@
+error: missing condition for `if` expression
+ --> $DIR/issue-68091-unicode-ident-after-if.rs:3:14
+ |
+LL | $($c)ö* {}
+ | ^ - if this block is the condition of the `if` expression, then it must be followed by another block
+ | |
+ | expected condition here
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
new file mode 100644
index 000000000..1a90b4724
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
@@ -0,0 +1,9 @@
+macro_rules! x {
+ ($($c:tt)*) => {
+ $($c)ö* //~ ERROR macro expansion ends with an incomplete expression: expected expression
+ };
+}
+
+fn main() {
+ x!(!);
+}
diff --git a/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
new file mode 100644
index 000000000..0b9c364f1
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
@@ -0,0 +1,8 @@
+error: macro expansion ends with an incomplete expression: expected expression
+ --> $DIR/issue-68092-unicode-ident-after-incomplete-expr.rs:3:14
+ |
+LL | $($c)ö*
+ | ^ expected expression
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs
new file mode 100644
index 000000000..30e7ef467
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs
@@ -0,0 +1,12 @@
+// This file has unexpected closing delimiter,
+
+fn func(o: Option<u32>) {
+ match o {
+ Some(_x) => {} // Extra '}'
+ let _ = if true {};
+ }
+ None => {}
+ }
+} //~ ERROR unexpected closing delimiter
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr
new file mode 100644
index 000000000..2d873b461
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr
@@ -0,0 +1,16 @@
+error: unexpected closing delimiter: `}`
+ --> $DIR/issue-68987-unmatch-issue-1.rs:10:1
+ |
+LL | match o {
+ | - this delimiter might not be properly closed...
+LL | Some(_x) => {} // Extra '}'
+ | -- block is empty, you might have not meant to close it
+LL | let _ = if true {};
+LL | }
+ | - ...as it matches this but it has different indentation
+...
+LL | }
+ | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs
new file mode 100644
index 000000000..89aaa68ba
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs
@@ -0,0 +1,14 @@
+// FIXME: this case need more work to fix
+// currently the TokenTree matching ')' with '{', which is not user friendly for diagnostics
+async fn obstest() -> Result<> {
+ let obs_connect = || -> Result<(), MyError) { //~ ERROR mismatched closing delimiter
+ async {
+ }
+ }
+
+ if let Ok(version, scene_list) = obs_connect() {
+
+ } else {
+
+ }
+} //~ ERROR unexpected closing delimiter
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr
new file mode 100644
index 000000000..0ecb748a0
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr
@@ -0,0 +1,19 @@
+error: mismatched closing delimiter: `)`
+ --> $DIR/issue-68987-unmatch-issue-2.rs:3:32
+ |
+LL | async fn obstest() -> Result<> {
+ | ^ unclosed delimiter
+LL | let obs_connect = || -> Result<(), MyError) {
+ | ^ mismatched closing delimiter
+
+error: unexpected closing delimiter: `}`
+ --> $DIR/issue-68987-unmatch-issue-2.rs:14:1
+ |
+LL | let obs_connect = || -> Result<(), MyError) {
+ | - missing open `(` for this delimiter
+...
+LL | }
+ | ^ unexpected closing delimiter
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs
new file mode 100644
index 000000000..e98df8d7c
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs
@@ -0,0 +1,8 @@
+// the `{` is closed with `)`, there is a missing `(`
+fn f(i: u32, j: u32) {
+ let res = String::new();
+ let mut cnt = i;
+ while cnt < j {
+ write!&mut res, " "); //~ ERROR mismatched closing delimiter
+ }
+} //~ ERROR unexpected closing delimiter
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr
new file mode 100644
index 000000000..dfc4407ed
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr
@@ -0,0 +1,19 @@
+error: mismatched closing delimiter: `)`
+ --> $DIR/issue-68987-unmatch-issue-3.rs:5:19
+ |
+LL | while cnt < j {
+ | ^ unclosed delimiter
+LL | write!&mut res, " ");
+ | ^ mismatched closing delimiter
+
+error: unexpected closing delimiter: `}`
+ --> $DIR/issue-68987-unmatch-issue-3.rs:8:1
+ |
+LL | write!&mut res, " ");
+ | - missing open `(` for this delimiter
+LL | }
+LL | }
+ | ^ unexpected closing delimiter
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs
new file mode 100644
index 000000000..5a3620bf2
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs
@@ -0,0 +1,12 @@
+// This file has unexpected closing delimiter,
+
+fn func(o: Option<u32>) {
+ match o {
+ Some(_x) => // Missing '{'
+ let _ = if true {};
+ }
+ None => {}
+ }
+} //~ ERROR unexpected closing delimiter
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr
new file mode 100644
index 000000000..cabd13324
--- /dev/null
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr
@@ -0,0 +1,16 @@
+error: unexpected closing delimiter: `}`
+ --> $DIR/issue-68987-unmatch-issue.rs:10:1
+ |
+LL | match o {
+ | - this delimiter might not be properly closed...
+LL | Some(_x) => // Missing '{'
+LL | let _ = if true {};
+ | -- block is empty, you might have not meant to close it
+LL | }
+ | - ...as it matches this but it has different indentation
+...
+LL | }
+ | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-81804.rs b/tests/ui/parser/issues/issue-81804.rs
new file mode 100644
index 000000000..ebc4752a1
--- /dev/null
+++ b/tests/ui/parser/issues/issue-81804.rs
@@ -0,0 +1,6 @@
+// error-pattern: this file contains an unclosed delimiter
+// error-pattern: this file contains an unclosed delimiter
+
+fn main() {}
+
+fn p([=(}
diff --git a/tests/ui/parser/issues/issue-81804.stderr b/tests/ui/parser/issues/issue-81804.stderr
new file mode 100644
index 000000000..de3b33ecd
--- /dev/null
+++ b/tests/ui/parser/issues/issue-81804.stderr
@@ -0,0 +1,19 @@
+error: mismatched closing delimiter: `}`
+ --> $DIR/issue-81804.rs:6:8
+ |
+LL | fn p([=(}
+ | ^^ mismatched closing delimiter
+ | |
+ | unclosed delimiter
+
+error: this file contains an unclosed delimiter
+ --> $DIR/issue-81804.rs:6:11
+ |
+LL | fn p([=(}
+ | -- ^
+ | ||
+ | |unclosed delimiter
+ | unclosed delimiter
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-81827.rs b/tests/ui/parser/issues/issue-81827.rs
new file mode 100644
index 000000000..91defd12a
--- /dev/null
+++ b/tests/ui/parser/issues/issue-81827.rs
@@ -0,0 +1,10 @@
+// error-pattern: this file contains an unclosed delimiter
+// error-pattern: mismatched closing delimiter: `]`
+
+#![crate_name="0"]
+
+
+
+fn main() {}
+
+fn r()->i{0|{#[cfg(r(0{]0
diff --git a/tests/ui/parser/issues/issue-81827.stderr b/tests/ui/parser/issues/issue-81827.stderr
new file mode 100644
index 000000000..63d135f73
--- /dev/null
+++ b/tests/ui/parser/issues/issue-81827.stderr
@@ -0,0 +1,21 @@
+error: mismatched closing delimiter: `]`
+ --> $DIR/issue-81827.rs:10:23
+ |
+LL | fn r()->i{0|{#[cfg(r(0{]0
+ | - ^^ mismatched closing delimiter
+ | | |
+ | | unclosed delimiter
+ | closing delimiter possibly meant for this
+
+error: this file contains an unclosed delimiter
+ --> $DIR/issue-81827.rs:10:27
+ |
+LL | fn r()->i{0|{#[cfg(r(0{]0
+ | - - - ^
+ | | | |
+ | | | missing open `[` for this delimiter
+ | | unclosed delimiter
+ | unclosed delimiter
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-84117.stderr b/tests/ui/parser/issues/issue-84117.stderr
index 237bc11bd..958f3b40b 100644
--- a/tests/ui/parser/issues/issue-84117.stderr
+++ b/tests/ui/parser/issues/issue-84117.stderr
@@ -47,6 +47,7 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
| |
| while parsing the type for `inner_local`
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: you might have meant to end the type parameters here
|
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, }
@@ -61,6 +62,8 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, fo
|
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
| ^ expected one of 8 possible tokens
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
--> $DIR/issue-84117.rs:2:33
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
index df0cd5439..099178a7d 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
@@ -7,3 +7,8 @@ const async const fn test() {}
//~| NOTE expected one of `extern`, `fn`, or `unsafe`
//~| HELP `const` already used earlier, remove this one
//~| NOTE `const` first seen here
+//~| ERROR functions cannot be both `const` and `async`
+//~| NOTE `const` because of this
+//~| NOTE `async` because of this
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
index 977c6ebfe..4c55179ce 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
@@ -13,5 +13,14 @@ note: `const` first seen here
LL | const async const fn test() {}
| ^^^^^
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/const-async-const.rs:5:1
+ |
+LL | const async const fn test() {}
+ | ^^^^^-^^^^^-------------------
+ | | |
+ | | `async` because of this
+ | `const` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs
new file mode 100644
index 000000000..9d7fe4389
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs
@@ -0,0 +1,22 @@
+// test for #115714
+
+struct Misplaced;
+
+impl Misplaced {
+ unsafe const fn from_u32(val: u32) {}
+ //~^ ERROR expected one of `extern` or `fn`
+ fn oof(self){}
+}
+
+struct Duplicated;
+
+impl Duplicated {
+ unsafe unsafe fn from_u32(val: u32) {}
+ //~^ ERROR expected one of `extern` or `fn`
+ fn oof(self){}
+}
+
+fn main() {
+ Misplaced.oof();
+ Duplicated.oof();
+}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr
new file mode 100644
index 000000000..3f504a9eb
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr
@@ -0,0 +1,28 @@
+error: expected one of `extern` or `fn`, found keyword `const`
+ --> $DIR/recovery.rs:6:12
+ |
+LL | unsafe const fn from_u32(val: u32) {}
+ | -------^^^^^
+ | | |
+ | | expected one of `extern` or `fn`
+ | help: `const` must come before `unsafe`: `const unsafe`
+ |
+ = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+error: expected one of `extern` or `fn`, found keyword `unsafe`
+ --> $DIR/recovery.rs:14:12
+ |
+LL | unsafe unsafe fn from_u32(val: u32) {}
+ | ^^^^^^
+ | |
+ | expected one of `extern` or `fn`
+ | help: `unsafe` already used earlier, remove this one
+ |
+note: `unsafe` first seen here
+ --> $DIR/recovery.rs:14:5
+ |
+LL | unsafe unsafe fn from_u32(val: u32) {}
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
index bbebc99e9..479426626 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
@@ -12,3 +12,8 @@ async unsafe const fn test() {}
//~| HELP `const` must come before `async unsafe`
//~| SUGGESTION const async unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+//~| ERROR functions cannot be both `const` and `async`
+//~| NOTE `const` because of this
+//~| NOTE `async` because of this
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
index f455caba1..489e8eefb 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
@@ -9,5 +9,14 @@ LL | async unsafe const fn test() {}
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/several-kw-jump.rs:9:1
+ |
+LL | async unsafe const fn test() {}
+ | ^^^^^--------^^^^^-------------
+ | | |
+ | | `const` because of this
+ | `async` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
index 4ff4cf5c8..867f71c12 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
@@ -12,3 +12,5 @@ unsafe async fn test() {}
//~| HELP `async` must come before `unsafe`
//~| SUGGESTION async unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
index 2f5fbc513..9a7f28210 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
@@ -12,3 +12,5 @@ unsafe const fn test() {}
//~| HELP `const` must come before `unsafe`
//~| SUGGESTION const unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
index df2412e3e..8305ff4f6 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
@@ -12,3 +12,5 @@ extern unsafe fn test() {}
//~| HELP `unsafe` must come before `extern`
//~| SUGGESTION unsafe extern
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87694-duplicated-pub.rs b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs
new file mode 100644
index 000000000..e3ea61dc4
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs
@@ -0,0 +1,5 @@
+pub const pub fn test() {}
+//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+//~| NOTE expected one of `async`, `extern`, `fn`, or `unsafe`
+//~| HELP there is already a visibility modifier, remove one
+//~| NOTE explicit visibility first seen here
diff --git a/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr
new file mode 100644
index 000000000..8d242bc9d
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr
@@ -0,0 +1,17 @@
+error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+ --> $DIR/issue-87694-duplicated-pub.rs:1:11
+ |
+LL | pub const pub fn test() {}
+ | ^^^
+ | |
+ | expected one of `async`, `extern`, `fn`, or `unsafe`
+ | help: there is already a visibility modifier, remove one
+ |
+note: explicit visibility first seen here
+ --> $DIR/issue-87694-duplicated-pub.rs:1:1
+ |
+LL | pub const pub fn test() {}
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-87694-misplaced-pub.rs b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs
new file mode 100644
index 000000000..3f824617c
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs
@@ -0,0 +1,5 @@
+const pub fn test() {}
+//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+//~| NOTE expected one of `async`, `extern`, `fn`, or `unsafe`
+//~| HELP visibility `pub` must come before `const`
+//~| SUGGESTION pub const
diff --git a/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr
new file mode 100644
index 000000000..94c6a29ef
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr
@@ -0,0 +1,11 @@
+error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+ --> $DIR/issue-87694-misplaced-pub.rs:1:7
+ |
+LL | const pub fn test() {}
+ | ------^^^
+ | | |
+ | | expected one of `async`, `extern`, `fn`, or `unsafe`
+ | help: visibility `pub` must come before `const`: `pub const`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-89396.fixed b/tests/ui/parser/issues/issue-89396.fixed
index 823ad8cd1..0c040ddea 100644
--- a/tests/ui/parser/issues/issue-89396.fixed
+++ b/tests/ui/parser/issues/issue-89396.fixed
@@ -8,9 +8,9 @@ fn main() {
let _ = match opt {
Some(_) => true,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
None => false,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
};
}
diff --git a/tests/ui/parser/issues/issue-89396.rs b/tests/ui/parser/issues/issue-89396.rs
index f1d9efa52..d95f666d7 100644
--- a/tests/ui/parser/issues/issue-89396.rs
+++ b/tests/ui/parser/issues/issue-89396.rs
@@ -8,9 +8,9 @@ fn main() {
let _ = match opt {
Some(_) = true,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
None -> false,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
};
}
diff --git a/tests/ui/parser/issues/issue-89396.stderr b/tests/ui/parser/issues/issue-89396.stderr
index 504420574..41ce07050 100644
--- a/tests/ui/parser/issues/issue-89396.stderr
+++ b/tests/ui/parser/issues/issue-89396.stderr
@@ -5,7 +5,7 @@ LL | Some(_) = true,
| ^
| |
| expected one of `=>`, `if`, or `|`
- | help: try using a fat arrow here: `=>`
+ | help: use a fat arrow to start a match arm: `=>`
error: expected one of `=>`, `@`, `if`, or `|`, found `->`
--> $DIR/issue-89396.rs:12:14
@@ -14,7 +14,7 @@ LL | None -> false,
| ^^
| |
| expected one of `=>`, `@`, `if`, or `|`
- | help: try using a fat arrow here: `=>`
+ | help: use a fat arrow to start a match arm: `=>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-90728.rs b/tests/ui/parser/issues/issue-90728.rs
new file mode 100644
index 000000000..d6a898361
--- /dev/null
+++ b/tests/ui/parser/issues/issue-90728.rs
@@ -0,0 +1,6 @@
+fn main() {
+ a.5.2E+
+ //~^ ERROR: unexpected token: `5.2E+`
+ //~| ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `5.2E+`
+ //~| ERROR: expected at least one digit in exponent
+}
diff --git a/tests/ui/parser/issues/issue-90728.stderr b/tests/ui/parser/issues/issue-90728.stderr
new file mode 100644
index 000000000..b55c46030
--- /dev/null
+++ b/tests/ui/parser/issues/issue-90728.stderr
@@ -0,0 +1,20 @@
+error: expected at least one digit in exponent
+ --> $DIR/issue-90728.rs:2:7
+ |
+LL | a.5.2E+
+ | ^^^^^
+
+error: unexpected token: `5.2E+`
+ --> $DIR/issue-90728.rs:2:7
+ |
+LL | a.5.2E+
+ | ^^^^^
+
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `5.2E+`
+ --> $DIR/issue-90728.rs:2:7
+ |
+LL | a.5.2E+
+ | ^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/parser/issues/issue-91421.rs b/tests/ui/parser/issues/issue-91421.rs
new file mode 100644
index 000000000..8bba27f37
--- /dev/null
+++ b/tests/ui/parser/issues/issue-91421.rs
@@ -0,0 +1,9 @@
+// Regression test for issue #91421.
+
+fn main() {
+ let value = if true && {
+ //~^ ERROR: this `if` expression is missing a block after the condition
+ //~| HELP: this binary operation is possibly unfinished
+ 3
+ } else { 4 };
+}
diff --git a/tests/ui/parser/issues/issue-91421.stderr b/tests/ui/parser/issues/issue-91421.stderr
new file mode 100644
index 000000000..2d9652051
--- /dev/null
+++ b/tests/ui/parser/issues/issue-91421.stderr
@@ -0,0 +1,14 @@
+error: this `if` expression is missing a block after the condition
+ --> $DIR/issue-91421.rs:4:17
+ |
+LL | let value = if true && {
+ | ^^
+ |
+help: this binary operation is possibly unfinished
+ --> $DIR/issue-91421.rs:4:20
+ |
+LL | let value = if true && {
+ | ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed
new file mode 100644
index 000000000..4b4a416b1
--- /dev/null
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed
@@ -0,0 +1,13 @@
+// run-rustfix
+
+pub enum Range {
+ //~^ ERROR `enum` and `struct` are mutually exclusive
+ Valid {
+ begin: u32,
+ len: u32,
+ },
+ Out,
+}
+
+fn main() {
+}
diff --git a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs
new file mode 100644
index 000000000..9cc886641
--- /dev/null
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs
@@ -0,0 +1,13 @@
+// run-rustfix
+
+pub enum struct Range {
+ //~^ ERROR `enum` and `struct` are mutually exclusive
+ Valid {
+ begin: u32,
+ len: u32,
+ },
+ Out,
+}
+
+fn main() {
+}
diff --git a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr
new file mode 100644
index 000000000..edc640bf5
--- /dev/null
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr
@@ -0,0 +1,8 @@
+error: `enum` and `struct` are mutually exclusive
+ --> $DIR/issue-99625-enum-struct-mutually-exclusive.rs:3:5
+ |
+LL | pub enum struct Range {
+ | ^^^^^^^^^^^ help: replace `enum struct` with: `enum`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed
new file mode 100644
index 000000000..64ab6f62b
--- /dev/null
+++ b/tests/ui/parser/issues/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/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs
new file mode 100644
index 000000000..50520971f
--- /dev/null
+++ b/tests/ui/parser/issues/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/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr
new file mode 100644
index 000000000..72377fc37
--- /dev/null
+++ b/tests/ui/parser/issues/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
+