| Age | Commit message (Collapse) | Author | Lines |
|
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.
|
|
this is used in diagnostics to focus on relevant live locals to match
NLL diagnostics
|
|
|
|
- describe how that data flows during borrowck
- prepares for recording some liveness data for diagnostics, not just
for the main analysis
|
|
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.
|
|
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
|
|
|
|
it's still partially a skeleton, but works well enough for almost all tests to pass
|
|
|
|
|
|
transpose liveness matrix and record live regions at the end of MIR typeck
|
|
Following the Generalizer's structure, relating e.g. a type with itself
will allow tracking the variance wrt the contained regions.
|
|
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.
|
|
- move constraints to an Option
- check `-Zpolonius=next` only once
- rewrite fixme comments to make the actionable part clear
|
|
This is mostly for test purposes to show the localized constraints until
the MIR debugger is set up.
|
|
|
|
this describes the rough algorithm using the localized constraint graph
|
|
these are the basic blocks of the naive polonius constraint graph
implementation.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
to help review, this duplicates the existing NLL + polonius constraint
generation component, before splitting them up to only do what they
individually need.
|
|
and move the polonius module to the borrowck root
|