Skip to content

Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha - #161305

Open
amandasystems wants to merge 5 commits into
rust-lang:mainfrom
amandasystems:issue-160670
Open

Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha#161305
amandasystems wants to merge 5 commits into
rust-lang:mainfrom
amandasystems:issue-160670

Conversation

@amandasystems

@amandasystems amandasystems commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Fixes: #160670

The soundness issue is caused by (as suggested by the text extruder) the incorrect variance for a region, which is supposed to be bidirectional (invariant) but is registered as contravariant.

Starting with this example (from the issue):

use std::fmt::Debug;

struct D<T: HasArg>(T::Arg);

trait HasArg {
    type Arg: Debug;
}
impl<'a, T: Debug> HasArg for fn(&'a T) {
    type Arg = &'a T;
}
impl<T: HasArg> Drop for D<T> {
    fn drop(&mut self) {
        println!("{:?}", self.0);
    }
}
fn mk<'a, T: Debug>(r: &'a T) -> D<fn(&'a T)> {
    D(r)
}

fn main() {
    let b = Box::new(vec![vec![1]]);
    let d;
    d = mk(&*b);
    drop(b); // ERROR: move out of borrowed...
}

This generates a path through MIR on the way to a drop that looks like this:

_1 = move _2

/// ...

drop(_1)

In this instance, the types of _1 and _2 are D<fn(&'?1 Vec<...>) and D<fn(&'?2 Vec<...>) respectively.

During liveness computation (in liveness::trace) region liveness is computed from drop liveness and use liveness. Additionally, for each live region (drop-live or use-live), region variance is computed for Polonius' loan propagation. Variance determines the direction of propagation across program flow.

For drop-live locals (variables), the types reported in DropckOutlivesResult::kinds are used to register drop live regions and compute their variances. However, instead of using the full type D<...> for the left-hand side of this assignment statement, kinds starts with a Binder {...} and the function type inside of it. From that it finds region '?1 and records it as contravariant (backwards propagated).

This PR addresses the issue by using the entire type of the drop-live local to compute the variance of any regions referenced inside it, at the cost of potentially doing unnecessary extra work, either when iteration continues over DropckOutlivesResult::kinds (which should be redundant with it in most cases), or if the local contains a region whose variance is actually not needed for computation or in regard to drop liveness (assuming that ever happens).

It also adds some debug statements that helped me debug the issue, and a ui test for the soundness issue.

of dropped variables.

This works around an off-by-one in type variance computation
causing a soundness issue.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 18, 2026
@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: borrowck, compiler
  • borrowck, compiler expanded to 75 candidates
  • Random selection from 16 candidates

@lqd lqd assigned lqd and jackh726 and unassigned mejrs Aug 18, 2026
@amandasystems amandasystems changed the title Issue 160670 Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha Aug 18, 2026
// the destructor and must be live at this point.
for &kind in &drop_data.dropck_result.kinds {
debug!("Drop-liveness is making the following type live: {kind:?}");
Self::make_all_regions_live(self.location_map, self.typeck, kind, live_at);

@amandasystems amandasystems Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be the case that we want to do record_polonius_region_variance_from_type() on these too; I genuinely don’t know.

View changes since the review

/// points `live_at`.
fn add_use_live_facts_for(&mut self, value: Ty<'tcx>, live_at: &IntervalSet<PointIndex>) {
debug!("add_use_live_facts_for(value={:?})", value);
Self::record_polonius_region_variance_from_type(self.typeck, value);

@jackh726 jackh726 Aug 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised we don't have a check elsewhere that asserts that we've recorded the variance for all regions.

(For the issue I was looking, I was thinking that we might want to ensure that liveness for every region var is recorded.)

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the exact opposite in fact! An unwrap-or-default for when we haven’t!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the fallout for just an expect there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(That would be the fallback case that activates if I removed some type from the drop liveness, and it’s fail safe into bidirectional edges)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that we've recorded the variance for all regions.

we don't propagate loans to dead regions throughout the CFG so I may be misunderstanding what you mean

@lqd lqd Aug 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the default case for a region whose variance we haven't recorded is to create bidir edges, so it wouldn't have helped to record the variance for all regions, depending on what you mean by "all". This case has to be because the variance is different in different types/drop kinds with some shared free region, and we're not recording all of these different contexts, not missing regions.

So the fun thing here looks to be the local is either not drop-live but some of its """drop kinds""" are, or it is and we needed to also, or only, record the variance of free regions in its type instead of just of the ones the actual drop-live drop kinds. Remember: NLL only records the regions in the drop kinds as live. The fact that the variance changes between these and the local's type is just the cherry on top.

@amandasystems amandasystems Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the local is either not drop-live but some of its """drop kinds""" are

That's possibly what's happening, though I'm not sure because all the parameter names seem to suggest the local is indeed drop live. The local becomes (drop) live in the next statement (I'm pretty sure, haven't fully checked), but for some reason, possibly due to assignment, its own type isn't among the drop-live kinds (only one layer in, for some reason). This might well be a bug or (more likely) an undocumented optimisation in drop live kind computation, but I don't know what it's supposed to do so I didn't dare touch it.

Before this apparently nobody needed the entire type of the local being dropped in all cases, but we do for the variance.

If the drop kinds never add anything to the variance, this PR is correct and may in fact be a slight optimisation, who knows, since it doesn't use the kinds to compute variance. If they may contain regions not in the type of the dropped local, I may lose variance information for them. This is a potential soundness issue if they appear somewhere else with an edge in only one direction, but otherwise just a risk of a compile failure (because we fail safe to a bidir edge). This can be trivially fixed by doing the variance computation on all the live kinds, at the risk of doing duplicate work.

I intentionally don't touch liveness, since it should be correct (tm).

@jackh726

Copy link
Copy Markdown
Member

@lqd and I were looking at this a bit today

First, this example is a bit more minimal, which should help to understand the MIR a bit more.

struct D<T: HasArg>(T::Arg);

trait HasArg {
    type Arg;
}
impl<'a, T> HasArg for fn(&'a T) {
    type Arg = &'a T;
}
impl<T: HasArg> Drop for D<T> {
    fn drop(&mut self) {}
}
fn mk<'a, T>(r: &'a T) -> D<fn(&'a T)> {
    D(r)
}

fn main() {
    let b = Box::new(0u8);
    let d;
    d = mk(&*b);
    drop(b); // ERROR: move out of borrowed...
}

One thing we noticed was that the let d; d = mk(&*b); split is actually load-bearing for this. Splitting that essentially makes a new local with a single move into the dropped local (d). It was surprising that just that addition causes a problem.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
100  177M  100  177M    0     0   203M      0 --:--:-- --:--:-- --:--:--  203M
#12 DONE 1.1s

#13 [ 7/10] RUN unzip -d /usr/bin/ chrome-linux64.zip && rm chrome-linux64.zip
#13 0.039 Archive:  chrome-linux64.zip
#13 0.040   inflating: /usr/bin/chrome-linux64/ABOUT  
#13 0.040   inflating: /usr/bin/chrome-linux64/MEIPreload/manifest.json  
#13 0.040   inflating: /usr/bin/chrome-linux64/MEIPreload/preloaded_data.pb  
#13 0.041   inflating: /usr/bin/chrome-linux64/PrivacySandboxAttestationsPreloaded/manifest.json  
#13 0.041   inflating: /usr/bin/chrome-linux64/PrivacySandboxAttestationsPreloaded/privacy-sandbox-attestations.dat  
#13 0.041   inflating: /usr/bin/chrome-linux64/WidevineCdm/LICENSE  
#13 0.041   inflating: /usr/bin/chrome-linux64/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so  
#13 0.171   inflating: /usr/bin/chrome-linux64/WidevineCdm/manifest.json  
#13 0.171   inflating: /usr/bin/chrome-linux64/chrome  
#13 2.403   inflating: /usr/bin/chrome-linux64/chrome-wrapper  
#13 2.403   inflating: /usr/bin/chrome-linux64/chrome_100_percent.pak  
#13 2.408   inflating: /usr/bin/chrome-linux64/chrome_200_percent.pak  
#13 2.417   inflating: /usr/bin/chrome-linux64/chrome_crashpad_handler  
#13 2.434   inflating: /usr/bin/chrome-linux64/chrome_sandbox  
#13 2.434   inflating: /usr/bin/chrome-linux64/deb.deps  
#13 2.434   inflating: /usr/bin/chrome-linux64/icudtl.dat  
#13 2.515   inflating: /usr/bin/chrome-linux64/libEGL.so  
#13 2.517   inflating: /usr/bin/chrome-linux64/libGLESv2.so  
#13 2.567   inflating: /usr/bin/chrome-linux64/libvk_swiftshader.so  
#13 2.605   inflating: /usr/bin/chrome-linux64/libvulkan.so.1  
#13 2.610   inflating: /usr/bin/chrome-linux64/locales/af.pak  
#13 2.615   inflating: /usr/bin/chrome-linux64/locales/af_FEMININE.pak  
#13 2.615   inflating: /usr/bin/chrome-linux64/locales/af_MASCULINE.pak  
#13 2.615   inflating: /usr/bin/chrome-linux64/locales/af_NEUTER.pak  
#13 2.615   inflating: /usr/bin/chrome-linux64/locales/am.pak  
#13 2.622   inflating: /usr/bin/chrome-linux64/locales/am_FEMININE.pak  
#13 2.622   inflating: /usr/bin/chrome-linux64/locales/am_MASCULINE.pak  
#13 2.622   inflating: /usr/bin/chrome-linux64/locales/am_NEUTER.pak  
#13 2.622   inflating: /usr/bin/chrome-linux64/locales/ar.pak  
#13 2.630   inflating: /usr/bin/chrome-linux64/locales/ar_FEMININE.pak  
#13 2.630   inflating: /usr/bin/chrome-linux64/locales/ar_MASCULINE.pak  
#13 2.630   inflating: /usr/bin/chrome-linux64/locales/ar_NEUTER.pak  
#13 2.630   inflating: /usr/bin/chrome-linux64/locales/bg.pak  
#13 2.638   inflating: /usr/bin/chrome-linux64/locales/bg_FEMININE.pak  
#13 2.638   inflating: /usr/bin/chrome-linux64/locales/bg_MASCULINE.pak  
#13 2.638   inflating: /usr/bin/chrome-linux64/locales/bg_NEUTER.pak  
#13 2.638   inflating: /usr/bin/chrome-linux64/locales/bn.pak  
#13 2.648   inflating: /usr/bin/chrome-linux64/locales/bn_FEMININE.pak  
#13 2.648   inflating: /usr/bin/chrome-linux64/locales/bn_MASCULINE.pak  
#13 2.648   inflating: /usr/bin/chrome-linux64/locales/bn_NEUTER.pak  
#13 2.648   inflating: /usr/bin/chrome-linux64/locales/ca.pak  
#13 2.653   inflating: /usr/bin/chrome-linux64/locales/ca_FEMININE.pak  
#13 2.653   inflating: /usr/bin/chrome-linux64/locales/ca_MASCULINE.pak  
#13 2.653   inflating: /usr/bin/chrome-linux64/locales/ca_NEUTER.pak  
#13 2.653   inflating: /usr/bin/chrome-linux64/locales/cs.pak  
#13 2.658   inflating: /usr/bin/chrome-linux64/locales/cs_FEMININE.pak  
#13 2.658   inflating: /usr/bin/chrome-linux64/locales/cs_MASCULINE.pak  
#13 2.659   inflating: /usr/bin/chrome-linux64/locales/cs_NEUTER.pak  
#13 2.659   inflating: /usr/bin/chrome-linux64/locales/da.pak  
#13 2.664   inflating: /usr/bin/chrome-linux64/locales/da_FEMININE.pak  
#13 2.664   inflating: /usr/bin/chrome-linux64/locales/da_MASCULINE.pak  
#13 2.664   inflating: /usr/bin/chrome-linux64/locales/da_NEUTER.pak  
#13 2.664   inflating: /usr/bin/chrome-linux64/locales/de.pak  
#13 2.669   inflating: /usr/bin/chrome-linux64/locales/de_FEMININE.pak  
#13 2.669   inflating: /usr/bin/chrome-linux64/locales/de_MASCULINE.pak  
#13 2.669   inflating: /usr/bin/chrome-linux64/locales/de_NEUTER.pak  
#13 2.669   inflating: /usr/bin/chrome-linux64/locales/el.pak  
#13 2.677   inflating: /usr/bin/chrome-linux64/locales/el_FEMININE.pak  
#13 2.677   inflating: /usr/bin/chrome-linux64/locales/el_MASCULINE.pak  
#13 2.678   inflating: /usr/bin/chrome-linux64/locales/el_NEUTER.pak  
#13 2.678   inflating: /usr/bin/chrome-linux64/locales/en-GB.pak  
#13 2.682   inflating: /usr/bin/chrome-linux64/locales/en-GB_FEMININE.pak  
#13 2.682   inflating: /usr/bin/chrome-linux64/locales/en-GB_MASCULINE.pak  
#13 2.682   inflating: /usr/bin/chrome-linux64/locales/en-GB_NEUTER.pak  
#13 2.682   inflating: /usr/bin/chrome-linux64/locales/en-US.pak  
#13 2.686   inflating: /usr/bin/chrome-linux64/locales/en-US_FEMININE.pak  
#13 2.686   inflating: /usr/bin/chrome-linux64/locales/en-US_MASCULINE.pak  
#13 2.686   inflating: /usr/bin/chrome-linux64/locales/en-US_NEUTER.pak  
#13 2.687   inflating: /usr/bin/chrome-linux64/locales/es-419.pak  
#13 2.692   inflating: /usr/bin/chrome-linux64/locales/es-419_FEMININE.pak  
#13 2.692   inflating: /usr/bin/chrome-linux64/locales/es-419_MASCULINE.pak  
#13 2.692   inflating: /usr/bin/chrome-linux64/locales/es-419_NEUTER.pak  
#13 2.692   inflating: /usr/bin/chrome-linux64/locales/es.pak  
#13 2.697   inflating: /usr/bin/chrome-linux64/locales/es_FEMININE.pak  
#13 2.697   inflating: /usr/bin/chrome-linux64/locales/es_MASCULINE.pak  
#13 2.697   inflating: /usr/bin/chrome-linux64/locales/es_NEUTER.pak  
#13 2.697   inflating: /usr/bin/chrome-linux64/locales/et.pak  
#13 2.702   inflating: /usr/bin/chrome-linux64/locales/et_FEMININE.pak  
#13 2.702   inflating: /usr/bin/chrome-linux64/locales/et_MASCULINE.pak  
#13 2.702   inflating: /usr/bin/chrome-linux64/locales/et_NEUTER.pak  
#13 2.702   inflating: /usr/bin/chrome-linux64/locales/fa.pak  
#13 2.709   inflating: /usr/bin/chrome-linux64/locales/fa_FEMININE.pak  
#13 2.709   inflating: /usr/bin/chrome-linux64/locales/fa_MASCULINE.pak  
#13 2.709   inflating: /usr/bin/chrome-linux64/locales/fa_NEUTER.pak  
#13 2.709   inflating: /usr/bin/chrome-linux64/locales/fi.pak  
#13 2.714   inflating: /usr/bin/chrome-linux64/locales/fi_FEMININE.pak  
#13 2.714   inflating: /usr/bin/chrome-linux64/locales/fi_MASCULINE.pak  
#13 2.714   inflating: /usr/bin/chrome-linux64/locales/fi_NEUTER.pak  
#13 2.715   inflating: /usr/bin/chrome-linux64/locales/fil.pak  
#13 2.720   inflating: /usr/bin/chrome-linux64/locales/fil_FEMININE.pak  
#13 2.720   inflating: /usr/bin/chrome-linux64/locales/fil_MASCULINE.pak  
#13 2.720   inflating: /usr/bin/chrome-linux64/locales/fil_NEUTER.pak  
#13 2.720   inflating: /usr/bin/chrome-linux64/locales/fr.pak  
#13 2.725   inflating: /usr/bin/chrome-linux64/locales/fr_FEMININE.pak  
#13 2.725   inflating: /usr/bin/chrome-linux64/locales/fr_MASCULINE.pak  
#13 2.726   inflating: /usr/bin/chrome-linux64/locales/fr_NEUTER.pak  
#13 2.726   inflating: /usr/bin/chrome-linux64/locales/gu.pak  
#13 2.735   inflating: /usr/bin/chrome-linux64/locales/gu_FEMININE.pak  
#13 2.735   inflating: /usr/bin/chrome-linux64/locales/gu_MASCULINE.pak  
#13 2.735   inflating: /usr/bin/chrome-linux64/locales/gu_NEUTER.pak  
#13 2.735   inflating: /usr/bin/chrome-linux64/locales/he.pak  
#13 2.741   inflating: /usr/bin/chrome-linux64/locales/he_FEMININE.pak  
#13 2.742   inflating: /usr/bin/chrome-linux64/locales/he_MASCULINE.pak  
#13 2.742   inflating: /usr/bin/chrome-linux64/locales/he_NEUTER.pak  
#13 2.742   inflating: /usr/bin/chrome-linux64/locales/hi.pak  
#13 2.752   inflating: /usr/bin/chrome-linux64/locales/hi_FEMININE.pak  
#13 2.752   inflating: /usr/bin/chrome-linux64/locales/hi_MASCULINE.pak  
#13 2.752   inflating: /usr/bin/chrome-linux64/locales/hi_NEUTER.pak  
#13 2.752   inflating: /usr/bin/chrome-linux64/locales/hr.pak  
#13 2.757   inflating: /usr/bin/chrome-linux64/locales/hr_FEMININE.pak  
#13 2.757   inflating: /usr/bin/chrome-linux64/locales/hr_MASCULINE.pak  
#13 2.757   inflating: /usr/bin/chrome-linux64/locales/hr_NEUTER.pak  
#13 2.758   inflating: /usr/bin/chrome-linux64/locales/hu.pak  
#13 2.763   inflating: /usr/bin/chrome-linux64/locales/hu_FEMININE.pak  
#13 2.763   inflating: /usr/bin/chrome-linux64/locales/hu_MASCULINE.pak  
#13 2.763   inflating: /usr/bin/chrome-linux64/locales/hu_NEUTER.pak  
#13 2.763   inflating: /usr/bin/chrome-linux64/locales/id.pak  
#13 2.768   inflating: /usr/bin/chrome-linux64/locales/id_FEMININE.pak  
#13 2.768   inflating: /usr/bin/chrome-linux64/locales/id_MASCULINE.pak  
#13 2.768   inflating: /usr/bin/chrome-linux64/locales/id_NEUTER.pak  
#13 2.768   inflating: /usr/bin/chrome-linux64/locales/it.pak  
#13 2.773   inflating: /usr/bin/chrome-linux64/locales/it_FEMININE.pak  
#13 2.773   inflating: /usr/bin/chrome-linux64/locales/it_MASCULINE.pak  
#13 2.773   inflating: /usr/bin/chrome-linux64/locales/it_NEUTER.pak  
#13 2.773   inflating: /usr/bin/chrome-linux64/locales/ja.pak  
#13 2.779   inflating: /usr/bin/chrome-linux64/locales/ja_FEMININE.pak  
#13 2.779   inflating: /usr/bin/chrome-linux64/locales/ja_MASCULINE.pak  
#13 2.779   inflating: /usr/bin/chrome-linux64/locales/ja_NEUTER.pak  
#13 2.779   inflating: /usr/bin/chrome-linux64/locales/kn.pak  
#13 2.789   inflating: /usr/bin/chrome-linux64/locales/kn_FEMININE.pak  
#13 2.790   inflating: /usr/bin/chrome-linux64/locales/kn_MASCULINE.pak  
#13 2.790   inflating: /usr/bin/chrome-linux64/locales/kn_NEUTER.pak  
#13 2.790   inflating: /usr/bin/chrome-linux64/locales/ko.pak  
#13 2.794   inflating: /usr/bin/chrome-linux64/locales/ko_FEMININE.pak  
#13 2.795   inflating: /usr/bin/chrome-linux64/locales/ko_MASCULINE.pak  
#13 2.795   inflating: /usr/bin/chrome-linux64/locales/ko_NEUTER.pak  
#13 2.795   inflating: /usr/bin/chrome-linux64/locales/lt.pak  
#13 2.800   inflating: /usr/bin/chrome-linux64/locales/lt_FEMININE.pak  
#13 2.800   inflating: /usr/bin/chrome-linux64/locales/lt_MASCULINE.pak  
#13 2.800   inflating: /usr/bin/chrome-linux64/locales/lt_NEUTER.pak  
#13 2.800   inflating: /usr/bin/chrome-linux64/locales/lv.pak  
#13 2.806   inflating: /usr/bin/chrome-linux64/locales/lv_FEMININE.pak  
#13 2.806   inflating: /usr/bin/chrome-linux64/locales/lv_MASCULINE.pak  
#13 2.806   inflating: /usr/bin/chrome-linux64/locales/lv_NEUTER.pak  
#13 2.806   inflating: /usr/bin/chrome-linux64/locales/ml.pak  
#13 2.817   inflating: /usr/bin/chrome-linux64/locales/ml_FEMININE.pak  
#13 2.817   inflating: /usr/bin/chrome-linux64/locales/ml_MASCULINE.pak  
#13 2.817   inflating: /usr/bin/chrome-linux64/locales/ml_NEUTER.pak  
#13 2.817   inflating: /usr/bin/chrome-linux64/locales/mr.pak  
#13 2.826   inflating: /usr/bin/chrome-linux64/locales/mr_FEMININE.pak  
#13 2.826   inflating: /usr/bin/chrome-linux64/locales/mr_MASCULINE.pak  
#13 2.826   inflating: /usr/bin/chrome-linux64/locales/mr_NEUTER.pak  
#13 2.826   inflating: /usr/bin/chrome-linux64/locales/ms.pak  
#13 2.831   inflating: /usr/bin/chrome-linux64/locales/ms_FEMININE.pak  
#13 2.831   inflating: /usr/bin/chrome-linux64/locales/ms_MASCULINE.pak  
#13 2.832   inflating: /usr/bin/chrome-linux64/locales/ms_NEUTER.pak  
#13 2.832   inflating: /usr/bin/chrome-linux64/locales/nb.pak  
#13 2.836   inflating: /usr/bin/chrome-linux64/locales/nb_FEMININE.pak  
#13 2.836   inflating: /usr/bin/chrome-linux64/locales/nb_MASCULINE.pak  
#13 2.836   inflating: /usr/bin/chrome-linux64/locales/nb_NEUTER.pak  
#13 2.836   inflating: /usr/bin/chrome-linux64/locales/nl.pak  
#13 2.841   inflating: /usr/bin/chrome-linux64/locales/nl_FEMININE.pak  
#13 2.841   inflating: /usr/bin/chrome-linux64/locales/nl_MASCULINE.pak  
#13 2.841   inflating: /usr/bin/chrome-linux64/locales/nl_NEUTER.pak  
#13 2.841   inflating: /usr/bin/chrome-linux64/locales/pl.pak  
#13 2.847   inflating: /usr/bin/chrome-linux64/locales/pl_FEMININE.pak  
#13 2.847   inflating: /usr/bin/chrome-linux64/locales/pl_MASCULINE.pak  
#13 2.847   inflating: /usr/bin/chrome-linux64/locales/pl_NEUTER.pak  
#13 2.847   inflating: /usr/bin/chrome-linux64/locales/pt-BR.pak  
#13 2.852   inflating: /usr/bin/chrome-linux64/locales/pt-BR_FEMININE.pak  
#13 2.852   inflating: /usr/bin/chrome-linux64/locales/pt-BR_MASCULINE.pak  
#13 2.852   inflating: /usr/bin/chrome-linux64/locales/pt-BR_NEUTER.pak  
#13 2.852   inflating: /usr/bin/chrome-linux64/locales/pt-PT.pak  
#13 2.857   inflating: /usr/bin/chrome-linux64/locales/pt-PT_FEMININE.pak  
#13 2.858   inflating: /usr/bin/chrome-linux64/locales/pt-PT_MASCULINE.pak  
#13 2.858   inflating: /usr/bin/chrome-linux64/locales/pt-PT_NEUTER.pak  
#13 2.858   inflating: /usr/bin/chrome-linux64/locales/ro.pak  
#13 2.863   inflating: /usr/bin/chrome-linux64/locales/ro_FEMININE.pak  
#13 2.863   inflating: /usr/bin/chrome-linux64/locales/ro_MASCULINE.pak  
#13 2.863   inflating: /usr/bin/chrome-linux64/locales/ro_NEUTER.pak  
#13 2.863   inflating: /usr/bin/chrome-linux64/locales/ru.pak  
#13 2.871   inflating: /usr/bin/chrome-linux64/locales/ru_FEMININE.pak  
#13 2.871   inflating: /usr/bin/chrome-linux64/locales/ru_MASCULINE.pak  
#13 2.871   inflating: /usr/bin/chrome-linux64/locales/ru_NEUTER.pak  
#13 2.871   inflating: /usr/bin/chrome-linux64/locales/sk.pak  
#13 2.877   inflating: /usr/bin/chrome-linux64/locales/sk_FEMININE.pak  
#13 2.877   inflating: /usr/bin/chrome-linux64/locales/sk_MASCULINE.pak  
#13 2.877   inflating: /usr/bin/chrome-linux64/locales/sk_NEUTER.pak  
#13 2.877   inflating: /usr/bin/chrome-linux64/locales/sl.pak  
#13 2.882   inflating: /usr/bin/chrome-linux64/locales/sl_FEMININE.pak  
#13 2.882   inflating: /usr/bin/chrome-linux64/locales/sl_MASCULINE.pak  
#13 2.882   inflating: /usr/bin/chrome-linux64/locales/sl_NEUTER.pak  
#13 2.882   inflating: /usr/bin/chrome-linux64/locales/sr.pak  
#13 2.890   inflating: /usr/bin/chrome-linux64/locales/sr_FEMININE.pak  
#13 2.890   inflating: /usr/bin/chrome-linux64/locales/sr_MASCULINE.pak  
#13 2.890   inflating: /usr/bin/chrome-linux64/locales/sr_NEUTER.pak  
#13 2.890   inflating: /usr/bin/chrome-linux64/locales/sv.pak  
#13 2.895   inflating: /usr/bin/chrome-linux64/locales/sv_FEMININE.pak  
#13 2.895   inflating: /usr/bin/chrome-linux64/locales/sv_MASCULINE.pak  
#13 2.895   inflating: /usr/bin/chrome-linux64/locales/sv_NEUTER.pak  
#13 2.895   inflating: /usr/bin/chrome-linux64/locales/sw.pak  
#13 2.900   inflating: /usr/bin/chrome-linux64/locales/sw_FEMININE.pak  
#13 2.900   inflating: /usr/bin/chrome-linux64/locales/sw_MASCULINE.pak  
#13 2.900   inflating: /usr/bin/chrome-linux64/locales/sw_NEUTER.pak  
#13 2.900   inflating: /usr/bin/chrome-linux64/locales/ta.pak  
#13 2.911   inflating: /usr/bin/chrome-linux64/locales/ta_FEMININE.pak  
#13 2.911   inflating: /usr/bin/chrome-linux64/locales/ta_MASCULINE.pak  
#13 2.911   inflating: /usr/bin/chrome-linux64/locales/ta_NEUTER.pak  
#13 2.911   inflating: /usr/bin/chrome-linux64/locales/te.pak  
#13 2.922   inflating: /usr/bin/chrome-linux64/locales/te_FEMININE.pak  
#13 2.922   inflating: /usr/bin/chrome-linux64/locales/te_MASCULINE.pak  
#13 2.922   inflating: /usr/bin/chrome-linux64/locales/te_NEUTER.pak  
#13 2.922   inflating: /usr/bin/chrome-linux64/locales/th.pak  
#13 2.930   inflating: /usr/bin/chrome-linux64/locales/th_FEMININE.pak  
#13 2.931   inflating: /usr/bin/chrome-linux64/locales/th_MASCULINE.pak  
#13 2.931   inflating: /usr/bin/chrome-linux64/locales/th_NEUTER.pak  
#13 2.931   inflating: /usr/bin/chrome-linux64/locales/tr.pak  
#13 2.936   inflating: /usr/bin/chrome-linux64/locales/tr_FEMININE.pak  
#13 2.936   inflating: /usr/bin/chrome-linux64/locales/tr_MASCULINE.pak  
#13 2.936   inflating: /usr/bin/chrome-linux64/locales/tr_NEUTER.pak  
#13 2.936   inflating: /usr/bin/chrome-linux64/locales/uk.pak  
#13 2.944   inflating: /usr/bin/chrome-linux64/locales/uk_FEMININE.pak  
#13 2.944   inflating: /usr/bin/chrome-linux64/locales/uk_MASCULINE.pak  
#13 2.944   inflating: /usr/bin/chrome-linux64/locales/uk_NEUTER.pak  
#13 2.944   inflating: /usr/bin/chrome-linux64/locales/ur.pak  
#13 2.951   inflating: /usr/bin/chrome-linux64/locales/ur_FEMININE.pak  
#13 2.951   inflating: /usr/bin/chrome-linux64/locales/ur_MASCULINE.pak  
#13 2.951   inflating: /usr/bin/chrome-linux64/locales/ur_NEUTER.pak  
#13 2.951   inflating: /usr/bin/chrome-linux64/locales/vi.pak  
#13 2.957   inflating: /usr/bin/chrome-linux64/locales/vi_FEMININE.pak  
#13 2.957   inflating: /usr/bin/chrome-linux64/locales/vi_MASCULINE.pak  
#13 2.957   inflating: /usr/bin/chrome-linux64/locales/vi_NEUTER.pak  
#13 2.957   inflating: /usr/bin/chrome-linux64/locales/zh-CN.pak  
#13 2.962   inflating: /usr/bin/chrome-linux64/locales/zh-CN_FEMININE.pak  
#13 2.962   inflating: /usr/bin/chrome-linux64/locales/zh-CN_MASCULINE.pak  
#13 2.962   inflating: /usr/bin/chrome-linux64/locales/zh-CN_NEUTER.pak  
#13 2.962   inflating: /usr/bin/chrome-linux64/locales/zh-TW.pak  
#13 2.966   inflating: /usr/bin/chrome-linux64/locales/zh-TW_FEMININE.pak  
#13 2.966   inflating: /usr/bin/chrome-linux64/locales/zh-TW_MASCULINE.pak  
#13 2.966   inflating: /usr/bin/chrome-linux64/locales/zh-TW_NEUTER.pak  
#13 2.966  extracting: /usr/bin/chrome-linux64/product_logo_48.png  
#13 2.966   inflating: /usr/bin/chrome-linux64/resources.pak  
#13 3.056   inflating: /usr/bin/chrome-linux64/rpm.deps  
#13 3.056   inflating: /usr/bin/chrome-linux64/v8_context_snapshot.bin  
#13 3.062   inflating: /usr/bin/chrome-linux64/vk_swiftshader_icd.json  
#13 3.062    creating: /usr/bin/chrome-linux64/resources/
#13 3.062    creating: /usr/bin/chrome-linux64/resources/inspector_overlay/
#13 3.062   inflating: /usr/bin/chrome-linux64/resources/inspector_overlay/inspector_overlay_resources.grd  
#13 3.062   inflating: /usr/bin/chrome-linux64/resources/inspector_overlay/main.js  
#13 3.063    creating: /usr/bin/chrome-linux64/resources/accessibility/
#13 3.063    creating: /usr/bin/chrome-linux64/resources/accessibility/reading_mode_gdocs_helper/
#13 3.063   inflating: /usr/bin/chrome-linux64/resources/accessibility/reading_mode_gdocs_helper/content.js  
#13 3.063   inflating: /usr/bin/chrome-linux64/resources/accessibility/reading_mode_gdocs_helper/gdocs_script.js  
#13 3.063   inflating: /usr/bin/chrome-linux64/resources/accessibility/reading_mode_gdocs_helper_manifest.json  
#13 3.063    creating: /usr/bin/chrome-linux64/hyphen-data/
#13 3.063   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-tk.hyb  
#13 3.063   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-de-1901.hyb  
#13 3.065   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-de-1996.hyb  
#13 3.066   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-mul-ethi.hyb  
#13 3.066   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-es.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-hi.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-cu.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-as.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-ta.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-pa.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-el.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-te.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-und-ethi.hyb  
#13 3.068   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-de-ch-1901.hyb  
#13 3.069   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-bg.hyb  
#13 3.069   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-gu.hyb  
#13 3.069   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-et.hyb  
#13 3.069   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-cs.hyb  
#13 3.070   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-nl.hyb  
#13 3.071   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-ru.hyb  
#13 3.071   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-hy.hyb  
#13 3.072   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-uk.hyb  
#13 3.072   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-eu.hyb  
#13 3.072   inflating: /usr/bin/chrome-linux64/hyphen-data/manifest.json  
#13 3.072   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-ga.hyb  
#13 3.072   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-sk.hyb  
#13 3.073   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-mr.hyb  
#13 3.073   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-bn.hyb  
#13 3.073   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-nb.hyb  
#13 3.075   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-en-gb.hyb  
#13 3.076   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-or.hyb  
#13 3.076   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-cy.hyb  
#13 3.076   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-hr.hyb  
#13 3.076   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-fr.hyb  
#13 3.076   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-kn.hyb  
#13 3.077   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-mn-cyrl.hyb  
#13 3.077   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-lt.hyb  
#13 3.077   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-en-us.hyb  
#13 3.077   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-ml.hyb  
#13 3.078   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-pt.hyb  
#13 3.078   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-be.hyb  
#13 3.078   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-sl.hyb  
#13 3.078   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-lv.hyb  
#13 3.078   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-sv.hyb  
#13 3.079   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-hu.hyb  
#13 3.082   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-af.hyb  
#13 3.083   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-sq.hyb  
#13 3.083   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-ka.hyb  
#13 3.084   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-it.hyb  
#13 3.084   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-gl.hyb  
#13 3.084   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-da.hyb  
#13 3.084   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-nn.hyb  
#13 3.086   inflating: /usr/bin/chrome-linux64/hyphen-data/hyph-la.hyb  
#13 DONE 3.8s

#14 [ 8/10] COPY scripts/nodejs.sh /scripts/
#14 DONE 0.0s

---
[WARNING] line 38: Delta is 0 for "x", maybe try to use `compare-elements-position` instead?

======== tests/rustdoc-gui/sidebar.goml ========

[ERROR] line 263: ProtocolError: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.: for command `assert-css: ("#rustdoc-toc", {"display": "block"})`
    at <file:///checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/test_docs/index.html>
[ERROR] line 266: ProtocolError: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.: for command `set-local-storage: {"rustdoc-hide-modnav": "true"}`
    at <file:///checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/test_docs/index.html>


<= doc-ui tests done: 150 succeeded, 1 failed, 0 filtered out

Error: ()

if self.liveness.is_live_at_point(node.region, node.point) {
self.live_loans.insert(node.point, loan);
} else {
debug!("Region not live at {node:?}; marking loan {loan:?} as not live!")

@lqd lqd Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this is not marking the loan as not live)

View changes since the review

/// `live_kind` is the type of a use-live of drop-live local.
/// Record the variance of any region(s) appearing in it for
/// Polonius. Does nothing if Polonius is not active.
fn record_polonius_region_variance_from_type(

@lqd lqd Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can name this something simpler like record_variance or something, and we shouldn't to need it to be generic and can use a Ty.

View changes since the review

@lqd lqd Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add some comment about why this test is interesting here, drop polonius alpha from the name and have revisions to show the failure should happen regardless of the borrowck algorithm we use.

View changes since the review

let mut logical_edges: FxHashMap<_, FxIndexSet<_>> = FxHashMap::default();

for outlives_constraint in outlives_constraints {
debug!(?outlives_constraint);

@lqd lqd Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm weary all the debug annotations will make logging super verbose, when no one needs them 99% of the time. Having better dumping and debugging would help avoid them, maybe these being at the trace level instead of debug would also help the common case I don't know. wdyt @jackh726

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree; you generally only want these for one MIR body and often select locals/regions/loans, so something that allows filtering and querying would be much, much better

@rust-bors

rust-bors Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #162148) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zpolonius=next soundness bug: UB caused by liveness detection

6 participants