Scalable Polonius support on nightly

Metadata
Owner(s)Rémy Rakic
Teamstypes
StatusProposed

Summary

Keep working on implementing a native rustc version of the Polonius next generation borrow checking algorithm, that would scale better than the previous datalog implementation, continuing from the 2024h2 goal.

Motivation

Polonius is an improved version of the borrow checker that resolves common limitations of the borrow checker and which is needed to support future patterns such as "lending iterators" (see #92985). Its model also prepares us for further improvements in the future.

Some support exists on nightly, but this older prototype has no path to stabilization due to scalability issues. We need an improved architecture and implementation to fix these issues.

The next six months

  • Complete the ongoing work to land polonius on nightly

The "shiny future" we are working towards

Stable support for Polonius.

Ownership and team asks

Owner: lqd

Other support provided by Amanda Stjerna as part of her PhD.

SubgoalOwner(s) or team(s)Notes
Design reviewNiko Matsakis
ImplementationRémy Rakic, Amanda Stjerna
Standard reviewsTeam typesMatthew Jasper

Support needed from the project

We expect most support to be needed from the types team, for design, reviews, interactions with the trait solver, and so on. We expect Niko Matsakis, leading the polonius working group and design, to provide guidance and design time, and Michael Goulet and Matthew Jasper to help with reviews.

Outputs and milestones

Outputs

Nightly implementation of polonius that passes NLL problem case #3 and accepts lending iterators (#92985).

Performance should be reasonable enough that we can run the full test suite, do crater runs, and test it on CI, without significant slowdowns. We do not expect to be production-ready yet by then, and therefore the implementation would still be gated under a nightly -Z feature flag.

As our model is a superset of NLLs, we expect little to no diagnostics regressions, but improvements would probably still be needed for the new errors.

Milestones

Note: some of these are currently being worked on as part of the 2024h2 goal, and could be completed before the 2025h1 period.

MilestoneContributorNotes
Factoring out higher-ranked concerns from the main pathAmanda Stjerna
↳ [x] rewrite invalid universe constraints with outlives 'static constraintsPR 123720
↳ [ ] completely remove placeholdersin progress PR 130227
Location-sensitive prototype on nightlyRémy Rakicin progress
↳ [x] create structures for location-dependent outlives constraints
↳ [x] build new constraint graph from typeck constraints and liveness constraints
↳ [x] update NLLs for required changes to local & region liveness, loan liveness & loan scopes, (possibly unreachable) kills, bidirectional traversal & active loans
↳ [ ] limit regressions about diagnostics when using the new constraints on diagnostics tailored to the old constraints
↳ [ ] land on nightly under a -Z flag
[x] Debugging / dump tool for analysis of location-sensitive analysisRémy Rakic
[ ] Tests and validation of location-sensitive PoloniusRémy Rakic
↳ [ ] make the full test suite passin progress
↳ [ ] do a crater run for assertions and backwards-compatibility
↳ [ ] expand test suite with tests about the new capabilities
[ ] Location-sensitive pass on nightly, tested on CIRémy Rakic