Skip to content

Commit

Permalink
Modified the tests so that if we place wrong parentheses we will get …
Browse files Browse the repository at this point in the history
…a different result
  • Loading branch information
Natsume-Neko committed Nov 30, 2024
1 parent 66e212b commit 120b841
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions tests/ui/precedence.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ fn main() {
1 ^ (1 - 1);
3 | (2 - 1);
3 & (5 - 2);
12 & (0xF000 << 4);
12 & (0xF000 >> 4);
(12 << 4) ^ 0xF000;
(12 << 4) | 0xF000;
0x0F00 & (0x00F0 << 4);
0x0F00 & (0xF000 >> 4);
(0x0F00 << 1) ^ 3;
(0x0F00 << 1) | 2;

let b = 3;
trip!(b * 8);
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/precedence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ fn main() {
1 ^ 1 - 1;
3 | 2 - 1;
3 & 5 - 2;
12 & 0xF000 << 4;
12 & 0xF000 >> 4;
12 << 4 ^ 0xF000;
12 << 4 | 0xF000;
0x0F00 & 0x00F0 << 4;
0x0F00 & 0xF000 >> 4;
0x0F00 << 1 ^ 3;
0x0F00 << 1 | 2;

let b = 3;
trip!(b * 8);
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/precedence.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,26 @@ LL | 3 & 5 - 2;
error: operator precedence can trip the unwary
--> tests/ui/precedence.rs:23:5
|
LL | 12 & 0xF000 << 4;
| ^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `12 & (0xF000 << 4)`
LL | 0x0F00 & 0x00F0 << 4;
| ^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `0x0F00 & (0x00F0 << 4)`

error: operator precedence can trip the unwary
--> tests/ui/precedence.rs:24:5
|
LL | 12 & 0xF000 >> 4;
| ^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `12 & (0xF000 >> 4)`
LL | 0x0F00 & 0xF000 >> 4;
| ^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `0x0F00 & (0xF000 >> 4)`

error: operator precedence can trip the unwary
--> tests/ui/precedence.rs:25:5
|
LL | 12 << 4 ^ 0xF000;
| ^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(12 << 4) ^ 0xF000`
LL | 0x0F00 << 1 ^ 3;
| ^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(0x0F00 << 1) ^ 3`

error: operator precedence can trip the unwary
--> tests/ui/precedence.rs:26:5
|
LL | 12 << 4 | 0xF000;
| ^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(12 << 4) | 0xF000`
LL | 0x0F00 << 1 | 2;
| ^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(0x0F00 << 1) | 2`

error: aborting due to 11 previous errors

0 comments on commit 120b841

Please sign in to comment.