Skip to content

Commit 8d944eb

Browse files
nbdd0121Mark-Simulacrum
authored andcommitted
Add regression test for ice 89574
1 parent c418c6d commit 8d944eb

8 files changed

+41
-10
lines changed

src/test/ui/parser/issue-89574.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn main() {
2+
const EMPTY_ARRAY = [];
3+
//~^ missing type for `const` item
4+
}

src/test/ui/parser/issue-89574.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: missing type for `const` item
2+
--> $DIR/issue-89574.rs:2:11
3+
|
4+
LL | const EMPTY_ARRAY = [];
5+
| ^^^^^^^^^^^ help: provide a type for the item: `EMPTY_ARRAY: <type>`
6+
7+
error: aborting due to previous error
8+

src/test/ui/parser/item-free-const-no-body-semantic-fail.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ fn main() {}
44

55
const A: u8; //~ ERROR free constant item without body
66
const B; //~ ERROR free constant item without body
7+
//~^ ERROR missing type for `const` item

src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ LL | const B;
1414
| |
1515
| help: provide a definition for the constant: `= <expr>;`
1616

17-
error: aborting due to 2 previous errors
17+
error: missing type for `const` item
18+
--> $DIR/item-free-const-no-body-semantic-fail.rs:6:7
19+
|
20+
LL | const B;
21+
| ^ help: provide a type for the item: `B: <type>`
22+
23+
error: aborting due to 3 previous errors
1824

src/test/ui/parser/item-free-static-no-body-semantic-fail.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ fn main() {}
44

55
static A: u8; //~ ERROR free static item without body
66
static B; //~ ERROR free static item without body
7+
//~^ ERROR missing type for `static` item
78

89
static mut C: u8; //~ ERROR free static item without body
910
static mut D; //~ ERROR free static item without body
11+
//~^ ERROR missing type for `static mut` item

src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr

+15-3
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,32 @@ LL | static B;
1515
| help: provide a definition for the static: `= <expr>;`
1616

1717
error: free static item without body
18-
--> $DIR/item-free-static-no-body-semantic-fail.rs:8:1
18+
--> $DIR/item-free-static-no-body-semantic-fail.rs:9:1
1919
|
2020
LL | static mut C: u8;
2121
| ^^^^^^^^^^^^^^^^-
2222
| |
2323
| help: provide a definition for the static: `= <expr>;`
2424

2525
error: free static item without body
26-
--> $DIR/item-free-static-no-body-semantic-fail.rs:9:1
26+
--> $DIR/item-free-static-no-body-semantic-fail.rs:10:1
2727
|
2828
LL | static mut D;
2929
| ^^^^^^^^^^^^-
3030
| |
3131
| help: provide a definition for the static: `= <expr>;`
3232

33-
error: aborting due to 4 previous errors
33+
error: missing type for `static` item
34+
--> $DIR/item-free-static-no-body-semantic-fail.rs:6:8
35+
|
36+
LL | static B;
37+
| ^ help: provide a type for the item: `B: <type>`
38+
39+
error: missing type for `static mut` item
40+
--> $DIR/item-free-static-no-body-semantic-fail.rs:10:12
41+
|
42+
LL | static mut D;
43+
| ^ help: provide a type for the item: `D: <type>`
44+
45+
error: aborting due to 6 previous errors
3446

src/test/ui/typeck/issue-79040.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
const FOO = "hello" + 1; //~ ERROR cannot add `{integer}` to `&str`
3-
//~^ ERROR cannot add `{integer}` to `&str`
3+
//~^ missing type for `const` item
44
println!("{}", FOO);
55
}

src/test/ui/typeck/issue-79040.stderr

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ LL | const FOO = "hello" + 1;
66
| |
77
| &str
88

9-
error[E0369]: cannot add `{integer}` to `&str`
10-
--> $DIR/issue-79040.rs:2:25
9+
error: missing type for `const` item
10+
--> $DIR/issue-79040.rs:2:11
1111
|
1212
LL | const FOO = "hello" + 1;
13-
| ------- ^ - {integer}
14-
| |
15-
| &str
13+
| ^^^ help: provide a type for the item: `FOO: <type>`
1614

1715
error: aborting due to 2 previous errors
1816

0 commit comments

Comments
 (0)