Skip to content

Commit

Permalink
fix 101793, fix the wording of help msg for bitwise not
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Sep 15, 2022
1 parent c3f5929 commit 2194fc9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/locales/en-US/parser.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ parser_tilde_is_not_unary_operator = `~` cannot be used as a unary operator
.suggestion = use `!` to perform bitwise not
parser_unexpected_token_after_not = unexpected {$negated_desc} after identifier
.suggestion = use `!` to perform logical negation
.suggestion = use `!` to perform bitwise not
parser_malformed_loop_label = malformed loop label
.suggestion = use the correct loop label format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

fn main() {
let _x = !1; //~ ERROR cannot be used as a unary operator
let _y = !1; //~ ERROR unexpected `1` after identifier
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

fn main() {
let _x = ~1; //~ ERROR cannot be used as a unary operator
let _y = not 1; //~ ERROR unexpected `1` after identifier
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@ error: `~` cannot be used as a unary operator
LL | let _x = ~1;
| ^ help: use `!` to perform bitwise not

error: aborting due to previous error
error: unexpected `1` after identifier
--> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:5:18
|
LL | let _y = not 1;
| ----^
| |
| help: use `!` to perform bitwise not

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ error: unexpected `for_you` after identifier
LL | if not for_you {
| ----^^^^^^^
| |
| help: use `!` to perform logical negation
| help: use `!` to perform bitwise not

error: unexpected `the_worst` after identifier
--> $DIR/issue-46836-identifier-not-instead-of-negation.rs:11:15
|
LL | while not the_worst {
| ----^^^^^^^^^
| |
| help: use `!` to perform logical negation
| help: use `!` to perform bitwise not

error: unexpected `println` after identifier
--> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:9
|
LL | if not // lack of braces is [sic]
| ----- help: use `!` to perform logical negation
| ----- help: use `!` to perform bitwise not
LL | println!("Then when?");
| ^^^^^^^

Expand All @@ -42,15 +42,15 @@ error: unexpected `2` after identifier
LL | let resource = not 2;
| ----^
| |
| help: use `!` to perform logical negation
| help: use `!` to perform bitwise not

error: unexpected `be_smothered_out_before` after identifier
--> $DIR/issue-46836-identifier-not-instead-of-negation.rs:32:27
|
LL | let young_souls = not be_smothered_out_before;
| ----^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: use `!` to perform logical negation
| help: use `!` to perform bitwise not

error: aborting due to 6 previous errors

0 comments on commit 2194fc9

Please sign in to comment.