Scalable Polonius support on nightly

Metadata
Point of contactRémy Rakic
Teamstypes
StatusAccepted
Tracking issuerust-lang/rust-project-goals#118

Summary

Implement a native rustc version of the Polonius next generation borrow checking algorithm, that would scale better than the previous datalog implementation.

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 status quo

The next six months

  • Land polonius on nightly

The "shiny future" we are working towards

Stable support for Polonius.

Design axioms

N/A

Ownership and team asks

Owner: lqd

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

TaskOwner(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

MilestoneExpected date
Factoring out higher-ranked concerns from the main pathTBD
Replace parts of the borrow checker with location-insensitive PoloniusTBD
Location-sensitive prototype on nightlyTBD
Verify full test suite/crater pass with location-sensitive PoloniusTBD
Location-sensitive pass on nightly, tested on CITBD

Frequently asked questions

None yet.