fix 101793, fix the wording of help msg for bitwise not

This commit is contained in:
yukang 2022-09-15 17:33:28 +08:00
parent c3f59295fe
commit 2194fc957a
5 changed files with 17 additions and 7 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -4,7 +4,7 @@ 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
@ -12,13 +12,13 @@ error: unexpected `the_worst` after identifier
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?");
| ^^^^^^^
@ -42,7 +42,7 @@ 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
@ -50,7 +50,7 @@ error: unexpected `be_smothered_out_before` after identifier
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