-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Replace Body::basic_blocks()
with field access
#99027
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
It's not super clear to me that we want this. |
I also do not see why we would do this. (Are accessor methods like |
In fairness, |
As to the question why change this at all, I would like to encourage borrowing individual fields instead of the whole body and reduce the number of different ways to borrow the basic blocks. I also think that it might be confusing to leave |
@jackh726 yeah, but the important difference is that @tmiasko I'm on board with getting rid of |
@JakobDegen informed by this refactoring, I think that if one knows about cache invalidation I suspect that to make further improvements toward preserving cache validity we would need to go one step further. Avoid |
The thing I'm more worried about is accidental calls from someone intending to use the no-cfg-invalidation stuff |
☔ The latest upstream changes (presumably #99592) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #99667) made this pull request unmergeable. Please resolve the merge conflicts. |
r? rust-lang/mir-opt |
☔ The latest upstream changes (presumably #100087) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #100089) made this pull request unmergeable. Please resolve the merge conflicts. |
I like this, as it makes it clear that there's something possibly surprising going on |
Body::basic_blocks*()
with field accessBody::basic_blocks()
with field access
I limited changes to |
@bors r+ |
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#94890 (Support parsing IP addresses from a byte string) - rust-lang#96334 (socket `set_mark` addition.) - rust-lang#99027 (Replace `Body::basic_blocks()` with field access) - rust-lang#100437 (Improve const mismatch `FulfillmentError`) - rust-lang#100843 (Migrate part of rustc_infer to session diagnostic) - rust-lang#100897 (extra sanity check against consts pointing to mutable memory) - rust-lang#100959 (translations: rename warn_ to warning) - rust-lang#101111 (Use the declaration's SourceInfo for FnEntry retags, not the outermost) - rust-lang#101116 ([rustdoc] Remove Attrs type alias) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Since the refactoring in #98930, it is possible to borrow the basic blocks
independently from other parts of MIR by accessing the
basic_blocks
fielddirectly.
Replace unnecessary
Body::basic_blocks()
method with a direct field access,which has an additional benefit of borrowing the basic blocks only.