Rollup merge of #116960 - lqd:applied-member-constraints-scope, r=matthewjasper
Location-insensitive polonius: consider a loan escaping if an SCC has member constraints applied only The location-insensitive analysis considered loans to escape if there were member constraints, which makes *some* sense for scopes and matches the scopes that NLL computes on all the tests. However, polonius and NLLs differ on the fuzzed case #116657, where an SCC has member constraints but no applied ones (and is kinda surprising). The existing UI tests with member constraints impacting scopes all have some constraint applied. This PR changes the location-insensitive analysis to consider a loan to escape if there are applied member constraints, and for extra paranoia/insurance via fuzzing and crater: actually checks the constraint's min choice is indeed a universal region as we expect. (This could be turned into a `debug_assert` and early return as a slight optimization after these periods of verification) The 4 UI tests where member constraints are meaningful for computing scopes still pass obviously, and this also fixes #116657. r? `@matthewjasper`
This commit is contained in:
commit
726709bca4
6 changed files with 128 additions and 25 deletions
|
@ -3463,9 +3463,10 @@ impl DumpMonoStatsFormat {
|
|||
|
||||
/// `-Zpolonius` values, enabling the borrow checker polonius analysis, and which version: legacy,
|
||||
/// or future prototype.
|
||||
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Hash, Debug, Default)]
|
||||
pub enum Polonius {
|
||||
/// The default value: disabled.
|
||||
#[default]
|
||||
Off,
|
||||
|
||||
/// Legacy version, using datalog and the `polonius-engine` crate. Historical value for `-Zpolonius`.
|
||||
|
@ -3475,12 +3476,6 @@ pub enum Polonius {
|
|||
Next,
|
||||
}
|
||||
|
||||
impl Default for Polonius {
|
||||
fn default() -> Self {
|
||||
Polonius::Off
|
||||
}
|
||||
}
|
||||
|
||||
impl Polonius {
|
||||
/// Returns whether the legacy version of polonius is enabled
|
||||
pub fn is_legacy_enabled(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue