-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Populate liveness facts when calling get_body_with_borrowck_facts
without -Z polonius
#93603
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Populate liveness facts when calling get_body_with_borrowck_facts
without -Z polonius
#93603
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cjgillot (or someone else) soon. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
7e58208
to
42371a5
Compare
get_body_with_borrowck_facts
without -Z polonius
get_body_with_borrowck_facts
without -Z polonius
Sorry for the wait @connorff. I don't know this code at all. |
@bors r+ rollup I also find it strange that we pass these flags manually instead of checking some flag on @connorff Feel free to ping me on any future PRs that need attention. I'll try to respond in a timely fashion. |
📌 Commit 42371a5 has been approved by |
…facts-flag, r=ecstatic-morse Populate liveness facts when calling `get_body_with_borrowck_facts` without `-Z polonius` For a new feature of [Flowistry](https://github.com/willcrichton/flowistry), a static-analysis tool, we need to obtain a `mir::Body`'s liveness facts using `get_body_with_borrowck_facts` (added in rust-lang#86977). We'd like to do this without passing `-Z polonius` as a compiler arg to avoid borrow checking the entire crate. Support for doing this was added in rust-lang#88983, but the Polonius input facts used for liveness analysis are empty. This happens because the liveness input facts are populated in `liveness::generate` depending only on the value of `AllFacts::enabled` (which is toggled via compiler args). This PR propagates the [`use_polonius`](https://github.com/rust-lang/rust/blob/8b09ba6a5d5c644fe0f1c27c7f9c80b334241707/compiler/rustc_borrowck/src/nll.rs#L168) flag to `liveness::generate` to support populating liveness facts without requiring the `-Z polonius` flag. This fix is somewhat patchy - if it'd be better to add more widely-accessible state (like `AllFacts::enabled`) I'd be open to ideas!
…askrgr Rollup of 5 pull requests Successful merges: - rust-lang#93603 (Populate liveness facts when calling `get_body_with_borrowck_facts` without `-Z polonius`) - rust-lang#93870 (Fix switch on discriminant detection in a presence of coverage counters) - rust-lang#94355 (Add one more case to avoid ICE) - rust-lang#94363 (Remove needless borrows from core::fmt) - rust-lang#94377 (`check_used` should only look at actual `used` attributes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
For a new feature of Flowistry, a static-analysis tool, we need to obtain a
mir::Body
's liveness facts usingget_body_with_borrowck_facts
(added in #86977). We'd like to do this without passing-Z polonius
as a compiler arg to avoid borrow checking the entire crate.Support for doing this was added in #88983, but the Polonius input facts used for liveness analysis are empty. This happens because the liveness input facts are populated in
liveness::generate
depending only on the value ofAllFacts::enabled
(which is toggled via compiler args).This PR propagates the
use_polonius
flag toliveness::generate
to support populating liveness facts without requiring the-Z polonius
flag.This fix is somewhat patchy - if it'd be better to add more widely-accessible state (like
AllFacts::enabled
) I'd be open to ideas!