-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
fix Expr::can_have_side_effects for [x; N] style array literal and binary expressions
#150385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
rustbot has assigned @jdonszelmann. Use |
This comment has been minimized.
This comment has been minimized.
|
Would you like to add a test for this, to reflect new behaviour you changed here Because on a first glance it's not obvious (at least to me) |
|
I'm not sure where should I add a test:
|
|
I agree with @Kivooeo here: something has to be tested. A ui test will show a piece of rust code now compiling (or warning) differently. I think this is supposed to change something about the diagnostics of binop expressions and array expressions. So ideally, I'd see a uitest showing a diagnostic that is different. In fact, I see some tests that failed in CI, likely because of this diagnostics change. If you run @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@jdonszelmann I'm going to add a test for repeats( |
|
Add please this test to And I'm not sure why this changes to clippy were made? |
These are the cause of test failures in CI and so I fixed them, did I something wrong? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
|
The Clippy part looks ok. |
|
yea, I think this looks reasonable. @bors r=jdonszelmann,samueltardieu rollup |
|
actually, stop, @bors r- |
|
Commit d848437 has been unapproved. |
|
I realised that I would also quite like to see a test for the binary operator change here. After that r=me |
|
@rustbot author |
|
@bors r=jdonszelmann |
|
@andjsrk: 🔑 Insufficient privileges: not in review users |
|
@rustbot ready |
|
@jdonszelmann I have no permission, please take action on this |
AFAIK
[0; 3]is basically a syntax sugar for[0, 0, 0]so it should return whether the repeat's element can have side effects, like what it does on arrays.And it seems that the rule for unary operators and indexings can be applied to binary operators as well.