forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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#125640 - fmease:plz-no-stringify, r=estebank Don't suggest turning non-char-literal exprs of ty `char` into string literals Fixes rust-lang#125595. Fixes rust-lang#125081. r? estebank (rust-lang#122217) or compiler
- Loading branch information
Showing
6 changed files
with
66 additions
and
11 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 was deleted.
Oops, something went wrong.
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,7 @@ | ||
// issue: rust-lang/rust#125081 | ||
|
||
fn main() { | ||
let _: &str = 'β; | ||
//~^ ERROR expected `while`, `for`, `loop` or `{` after a label | ||
//~| 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,22 @@ | ||
error: expected `while`, `for`, `loop` or `{` after a label | ||
--> $DIR/str-as-char-butchered.rs:4:21 | ||
| | ||
LL | let _: &str = 'β; | ||
| ^ expected `while`, `for`, `loop` or `{` after a label | ||
| | ||
help: add `'` to close the char literal | ||
| | ||
LL | let _: &str = 'β'; | ||
| + | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/str-as-char-butchered.rs:4:19 | ||
| | ||
LL | let _: &str = 'β; | ||
| ---- ^^ 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`. |
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-non-lit.rs:6:19 | ||
| | ||
LL | let _: &str = ('a'); | ||
| ---- ^^^^^ expected `&str`, found `char` | ||
| | | ||
| expected due to this | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/str-as-char-non-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`. |