Skip to content

Commit 2194fc9

Browse files
committed
fix 101793, fix the wording of help msg for bitwise not
1 parent c3f5929 commit 2194fc9

5 files changed

+17
-7
lines changed

compiler/rustc_error_messages/locales/en-US/parser.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ parser_tilde_is_not_unary_operator = `~` cannot be used as a unary operator
5555
.suggestion = use `!` to perform bitwise not
5656
5757
parser_unexpected_token_after_not = unexpected {$negated_desc} after identifier
58-
.suggestion = use `!` to perform logical negation
58+
.suggestion = use `!` to perform bitwise not
5959
6060
parser_malformed_loop_label = malformed loop label
6161
.suggestion = use the correct loop label format

src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
fn main() {
44
let _x = !1; //~ ERROR cannot be used as a unary operator
5+
let _y = !1; //~ ERROR unexpected `1` after identifier
56
}

src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
fn main() {
44
let _x = ~1; //~ ERROR cannot be used as a unary operator
5+
let _y = not 1; //~ ERROR unexpected `1` after identifier
56
}

src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,13 @@ error: `~` cannot be used as a unary operator
44
LL | let _x = ~1;
55
| ^ help: use `!` to perform bitwise not
66

7-
error: aborting due to previous error
7+
error: unexpected `1` after identifier
8+
--> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:5:18
9+
|
10+
LL | let _y = not 1;
11+
| ----^
12+
| |
13+
| help: use `!` to perform bitwise not
14+
15+
error: aborting due to 2 previous errors
816

src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ error: unexpected `for_you` after identifier
44
LL | if not for_you {
55
| ----^^^^^^^
66
| |
7-
| help: use `!` to perform logical negation
7+
| help: use `!` to perform bitwise not
88

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

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

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

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

5555
error: aborting due to 6 previous errors
5656

0 commit comments

Comments
 (0)