forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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 rust-lang#136869 - chenyukang:yukang-fix-133713-let-binding, r=estebank Fix diagnostic when using = instead of : in let binding Fixes rust-lang#133713 r? ``@estebank``
- Loading branch information
Showing
4 changed files
with
73 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
12 changes: 12 additions & 0 deletions
12
tests/ui/suggestions/let-binding-suggest-issue-133713.fixed
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,12 @@ | ||
//@ run-rustfix | ||
#![allow(dead_code)] | ||
|
||
fn demo1() { | ||
let _last: u64 = 0; //~ ERROR expected value, found builtin type `u64` | ||
} | ||
|
||
fn demo2() { | ||
let _val: u64; //~ ERROR expected value, found builtin type `u64` | ||
} | ||
|
||
fn main() {} |
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,12 @@ | ||
//@ run-rustfix | ||
#![allow(dead_code)] | ||
|
||
fn demo1() { | ||
let _last = u64 = 0; //~ ERROR expected value, found builtin type `u64` | ||
} | ||
|
||
fn demo2() { | ||
let _val = u64; //~ ERROR expected value, found builtin type `u64` | ||
} | ||
|
||
fn main() {} |
27 changes: 27 additions & 0 deletions
27
tests/ui/suggestions/let-binding-suggest-issue-133713.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,27 @@ | ||
error[E0423]: expected value, found builtin type `u64` | ||
--> $DIR/let-binding-suggest-issue-133713.rs:5:17 | ||
| | ||
LL | let _last = u64 = 0; | ||
| ^^^ | ||
| | ||
help: you might have meant to use `:` for type annotation | ||
| | ||
LL - let _last = u64 = 0; | ||
LL + let _last: u64 = 0; | ||
| | ||
|
||
error[E0423]: expected value, found builtin type `u64` | ||
--> $DIR/let-binding-suggest-issue-133713.rs:9:16 | ||
| | ||
LL | let _val = u64; | ||
| ^^^ | ||
| | ||
help: you might have meant to use `:` for type annotation | ||
| | ||
LL - let _val = u64; | ||
LL + let _val: u64; | ||
| | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0423`. |