-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
suggest const or static for global variable
- Loading branch information
1 parent
1603a70
commit 98518c2
Showing
3 changed files
with
20 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let X: i32 = 12; | ||
//~^ ERROR expected item, found keyword `let` | ||
|
||
fn main() { | ||
println!("{}", X); | ||
} |
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 @@ | ||
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 | ||
|