Uh oh!
There was an error while loading. Please reload this page.
fix Expr::can_have_side_effects for [x; N] style array literal and binary expressions - #150385
Conversation
rustbot
commented
Dec 26, 2025
rustbot has assigned @jdonszelmann. Use |
This comment has been minimized.
This comment has been minimized.
Kivooeo
commented
Dec 26, 2025
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:
|
jdonszelmann
commented
Jan 6, 2026
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 |
rustbot
commented
Jan 6, 2026
Reminder, once the PR becomes ready for a review, use |
rustbot
commented
Jan 6, 2026
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
andjsrk
commented
Jan 6, 2026
@jdonszelmann I'm going to add a test for repeats( |
Kivooeo
commented
Jan 6, 2026
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.
andjsrk
commented
Jan 6, 2026
@rustbot ready |
samueltardieu
commented
Jan 7, 2026
The Clippy part looks ok. |
jdonszelmann
commented
Jan 8, 2026
yea, I think this looks reasonable. @bors r=jdonszelmann,samueltardieu rollup |
jdonszelmann
commented
Jan 8, 2026
actually, stop, @bors r- |
Commit d848437 has been unapproved. |
jdonszelmann
commented
Jan 8, 2026
I realised that I would also quite like to see a test for the binary operator change here. After that r=me |
jdonszelmann
commented
Jan 8, 2026
@rustbot author |
andjsrk
commented
Jan 9, 2026
@bors r=jdonszelmann |
@andjsrk: 🔑 Insufficient privileges: not in review users |
andjsrk
commented
Jan 9, 2026
@rustbot ready |
andjsrk
commented
Jan 9, 2026
@jdonszelmann I have no permission, please take action on this |
samueltardieu
commented
Jan 9, 2026
@bors r=jdonszelmann,samueltardieu rollup |
jdonszelmann
commented
Jan 9, 2026
Thanks @samueltardieu :3 |
Rollup of 11 pull requests Successful merges: - #150272 (docs(core): update `find()` and `rfind()` examples) - #150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions) - #150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`) - #150574 (Clarify `MoveData::init_loc_map`.) - #150762 (Use functions more in rustdoc GUI tests) - #150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`) - #150816 (Fix trait method anchor disappearing before user can click on it) - #150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)) - #150829 (make attrs actually use `Target::GenericParam`) - #150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`) - #150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.) r? @ghost
Uh oh!
There was an error while loading. Please reload this page.
Rollup merge of #150385 - fix-expr-can-have-side-effects, r=jdonszelmann,samueltardieu fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions 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.
Rollup of 11 pull requests Successful merges: - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples) - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions) - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`) - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.) - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests) - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`) - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it) - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)) - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`) - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`) - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.) r? @ghost
…jdonszelmann,samueltardieu fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions 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.
Rollup of 11 pull requests Successful merges: - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples) - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions) - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`) - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.) - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests) - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`) - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it) - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)) - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`) - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`) - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.) r? @ghost
Rollup of 11 pull requests Successful merges: - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples) - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions) - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`) - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.) - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests) - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`) - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it) - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)) - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`) - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`) - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.) r? @ghost
Rollup of 11 pull requests Successful merges: - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples) - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions) - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`) - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.) - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests) - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`) - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it) - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)) - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`) - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`) - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.) r? @ghost
Rollup of 11 pull requests Successful merges: - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples) - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions) - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`) - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.) - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests) - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`) - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it) - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)) - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`) - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`) - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.) r? @ghost
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.