about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/polonius/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-08-08simplify polonius=nextRémy Rakic-4/+2
Remove incomplete handling of kills during traversal for loan liveness to get to a simpler and actionable prototype. This handles the cases, on sufficiently simple examples, that were deferred from NLLs (NLL problem case 3, lending iterators), and is still a good step to put in people's hands without needing to wait for another full implementation. This is a practical cut in scope, but it also shows where are the areas of improvement, that we will explore in the future.
2025-01-31record boring locals in polonius contextRémy Rakic-12/+22
this is used in diagnostics to focus on relevant live locals to match NLL diagnostics
2025-01-31create context for errors and diagnostics for last borrowck phaseRémy Rakic-5/+13
2025-01-31split polonius context into per-phase dataRémy Rakic-8/+45
- describe how that data flows during borrowck - prepares for recording some liveness data for diagnostics, not just for the main analysis
2025-01-17encode `Locations::All` typeck constraints as logical edgesRémy Rakic-0/+1
Instead of materializing `Locations::All` constraints as physical edges at all the points in the CFG, we record them as logical edges and only materialize them during traversal as successors for a given node. This fixes the slowness/hang in the `saturating-float-casts.rs` test.
2025-01-12replace location-insensitive analysis with location-sensitive analysisRémy Rakic-4/+3
we're in in the endgame now set up the location-sensitive analysis end to end: - stop recording inflowing loans and loan liveness in liveness - replace location-insensitive liveness data with live loans computed by reachability - remove equivalence between polonius scopes and NLL scopes, and only run one scope computation
2025-01-12introduce reachability to the constraint graphRémy Rakic-5/+25
2025-01-01localize typeck constraintsRémy Rakic-1/+4
it's still partially a skeleton, but works well enough for almost all tests to pass
2025-01-01move typeck constraints conversion to its own moduleRémy Rakic-39/+3
2024-12-29liveness constraints: draw the rest of the owlRémy Rakic-70/+7
2024-12-29finish filling polonius contextRémy Rakic-6/+3
transpose liveness matrix and record live regions at the end of MIR typeck
2024-12-29add variance recordingRémy Rakic-0/+1
Following the Generalizer's structure, relating e.g. a type with itself will allow tracking the variance wrt the contained regions.
2024-12-29introduce polonius contextRémy Rakic-27/+66
This context struct will hold data to help creating localized constraints: - the live regions, with the shape matching a CFG walk, indexed per point - the variance of these live regions, represented as the direction we'll add the appropriate We also add this structure to the mir typeck to record liveness data, and make it responsible for localized constraint creation.
2024-12-18address review commentsRémy Rakic-16/+14
- move constraints to an Option - check `-Zpolonius=next` only once - rewrite fixme comments to make the actionable part clear
2024-12-18introduce beginnings of polonius MIR dumpRémy Rakic-0/+2
This is mostly for test purposes to show the localized constraints until the MIR debugger is set up.
2024-12-18set up skeleton for localized constraints conversionRémy Rakic-1/+142
2024-12-18add general documentation on the polonius moduleRémy Rakic-0/+35
this describes the rough algorithm using the localized constraint graph
2024-12-18introduce localized outlives constraintsRémy Rakic-0/+3
these are the basic blocks of the naive polonius constraint graph implementation.
2024-12-14move datalog fact generation into a legacy moduleRémy Rakic-184/+1
2024-11-19Clean up `UniversalRegions`.Nicholas Nethercote-11/+4
There is an `Rc<UniversalRegions>` within `UniversalRegionRelations`, and yet the two types get passed around in tandem a lot. This commit makes `UniversalRegionRelations` own `UniversalRegions`, removing the `Rc` (which wasn't truly needed) and the tandem-passing. This requires adding a `universal_relations` method to `UniversalRegionRelations`, and renaming a couple of existing methods producing iterators to avoid a name clash.
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_borrowck`.Nicholas Nethercote-0/+1
2024-06-05Remove confusing `use_polonius` flag and do less cloningAmanda Stjerna-2/+2
The `use_polonius` flag is both redundant and confusing since every function it's propagated to also checks if `all_facts` is `Some`, the true test of whether to generate Polonius facts for Polonius or for external consumers. This PR makes that path clearer by simply doing away with the argument and handling the logic in precisely two places: where facts are populated (check for `Some`), and where `all_facts` are initialised. It also delays some statements until after that check to avoid the miniscule performance penalty of executing them when Polonius is disabled. This also addresses @lqd's concern in #125652 by reducing the size of what is cloned out of Polonius facts to just the facts being added, as opposed to the entire vector of potential inputs, and added descriptive comments. *Reviewer note*: the comments in [add_extra_drop_facts](https://github.com/rust-lang/rust/blob/85f90a461262f7ca37a6e629933d455fa9c3ee48/compiler/rustc_borrowck/src/type_check/liveness/trace.rs#L219) should be inspected by a reviewer, in particular the one on L#259 in this PR, which should be trivial for someone with the right background knowledge. I also included some minor lints I found on the way there that I couldn't help myself from addressing.
2024-05-20Uplift RegionVidMichael Goulet-4/+6
2023-11-26move remaining legacy polonius fact generation out of NLL moduleRémy Rakic-16/+40
2023-11-26small polish of loan invalidations fact generationRémy Rakic-2/+2
2023-11-26rename polonius constraint generation to what it actually does: emit loan killsRémy Rakic-2/+2
2023-11-26simplify polonius constraint generationRémy Rakic-3/+7
2023-11-26remove NLL liveness from polonius constraint generationRémy Rakic-11/+2
2023-11-26extract polonius "constraint generation"Rémy Rakic-2/+24
to help review, this duplicates the existing NLL + polonius constraint generation component, before splitting them up to only do what they individually need.
2023-11-26extract polonius loan invalidations fact generationRémy Rakic-0/+147
and move the polonius module to the borrowck root