-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't suggest turning non-char-literal exprs of ty
char
into string…
… literals
- Loading branch information
Showing
3 changed files
with
37 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Don't suggest double quotes when encountering an expr of type `char` where a `&str` | ||
// is expected if the expr is not a char literal. | ||
// issue: rust-lang/rust#125595 | ||
|
||
fn main() { | ||
let _: &str = ('a'); //~ ERROR mismatched types | ||
let token = || 'a'; | ||
let _: &str = token(); //~ ERROR mismatched types | ||
} |
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,19 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/str-as-char-no-lit.rs:6:19 | ||
| | ||
LL | let _: &str = ('a'); | ||
| ---- ^^^^^ expected `&str`, found `char` | ||
| | | ||
| expected due to this | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/str-as-char-no-lit.rs:8:19 | ||
| | ||
LL | let _: &str = token(); | ||
| ---- ^^^^^^^ expected `&str`, found `char` | ||
| | | ||
| expected due to this | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |