1
Fork 0

Add regression test for ice 89574

This commit is contained in:
Gary Guo 2021-10-06 01:52:45 +01:00
parent a15879d662
commit b4c62d5f2c
8 changed files with 41 additions and 10 deletions

View file

@ -0,0 +1,4 @@
fn main() {
const EMPTY_ARRAY = [];
//~^ missing type for `const` item
}

View file

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

View file

@ -4,3 +4,4 @@ fn main() {}
const A: u8; //~ ERROR free constant item without body
const B; //~ ERROR free constant item without body
//~^ ERROR missing type for `const` item

View file

@ -14,5 +14,11 @@ LL | const B;
| |
| help: provide a definition for the constant: `= <expr>;`
error: aborting due to 2 previous errors
error: missing type for `const` item
--> $DIR/item-free-const-no-body-semantic-fail.rs:6:7
|
LL | const B;
| ^ help: provide a type for the item: `B: <type>`
error: aborting due to 3 previous errors

View file

@ -4,6 +4,8 @@ fn main() {}
static A: u8; //~ ERROR free static item without body
static B; //~ ERROR free static item without body
//~^ ERROR missing type for `static` item
static mut C: u8; //~ ERROR free static item without body
static mut D; //~ ERROR free static item without body
//~^ ERROR missing type for `static mut` item

View file

@ -15,7 +15,7 @@ LL | static B;
| help: provide a definition for the static: `= <expr>;`
error: free static item without body
--> $DIR/item-free-static-no-body-semantic-fail.rs:8:1
--> $DIR/item-free-static-no-body-semantic-fail.rs:9:1
|
LL | static mut C: u8;
| ^^^^^^^^^^^^^^^^-
@ -23,12 +23,24 @@ LL | static mut C: u8;
| help: provide a definition for the static: `= <expr>;`
error: free static item without body
--> $DIR/item-free-static-no-body-semantic-fail.rs:9:1
--> $DIR/item-free-static-no-body-semantic-fail.rs:10:1
|
LL | static mut D;
| ^^^^^^^^^^^^-
| |
| help: provide a definition for the static: `= <expr>;`
error: aborting due to 4 previous errors
error: missing type for `static` item
--> $DIR/item-free-static-no-body-semantic-fail.rs:6:8
|
LL | static B;
| ^ help: provide a type for the item: `B: <type>`
error: missing type for `static mut` item
--> $DIR/item-free-static-no-body-semantic-fail.rs:10:12
|
LL | static mut D;
| ^ help: provide a type for the item: `D: <type>`
error: aborting due to 6 previous errors

View file

@ -1,5 +1,5 @@
fn main() {
const FOO = "hello" + 1; //~ ERROR cannot add `{integer}` to `&str`
//~^ ERROR cannot add `{integer}` to `&str`
//~^ missing type for `const` item
println!("{}", FOO);
}

View file

@ -6,13 +6,11 @@ LL | const FOO = "hello" + 1;
| |
| &str
error[E0369]: cannot add `{integer}` to `&str`
--> $DIR/issue-79040.rs:2:25
error: missing type for `const` item
--> $DIR/issue-79040.rs:2:11
|
LL | const FOO = "hello" + 1;
| ------- ^ - {integer}
| |
| &str
| ^^^ help: provide a type for the item: `FOO: <type>`
error: aborting due to 2 previous errors