-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #101790 - TaKO8Ki:do-not-suggest-placeholder-to-const…
…-and-static-without-type, r=compiler-errors Do not suggest a placeholder to const and static without a type Fixes #101755
- Loading branch information
Showing
4 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
trait Foo { | ||
const A; //~ ERROR missing type for `const` item | ||
static B; | ||
//~^ ERROR associated `static` items are not allowed | ||
//~| ERROR missing type for `static` item | ||
} | ||
|
||
fn main() {} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error: associated `static` items are not allowed | ||
--> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:5 | ||
| | ||
LL | static B; | ||
| ^^^^^^^^^ | ||
|
||
error: missing type for `const` item | ||
--> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:2:12 | ||
| | ||
LL | const A; | ||
| ^ help: provide a type for the item: `: <type>` | ||
|
||
error: missing type for `static` item | ||
--> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:13 | ||
| | ||
LL | static B; | ||
| ^ help: provide a type for the item: `: <type>` | ||
|
||
error: aborting due to 3 previous errors | ||
|