Skip to content

Commit 5033d1d

Browse files
committed
consistent capitalization
1 parent f111441 commit 5033d1d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

posts/inside-rust/2023-09-29-polonius-update.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ team: The Polonius Working Group <https://www.rust-lang.org/governance/teams/com
77

88
This post lays out a roadmap to try to get Polonius on stable by Rust 2024. It identifies some high-level milestones and summarizes the key goals, as well as the recent progress.
99

10-
## Background on polonius
10+
## Background on Polonius
1111

12-
Polonius refers to a few things. It is a [new formulation](http://smallcultfollowing.com/babysteps/blog/2018/04/27/an-alias-based-formulation-of-the-borrow-checker/) of the borrow check. It is also a [specific project](https://github.com/rust-lang/polonius) that implemented that analysis, based on datalog. Our current plan does not make use of that datalog-based implementation, but uses what we learned implementing it to focus on reimplementing polonius within rustc.
12+
Polonius refers to a few things. It is a [new formulation](http://smallcultfollowing.com/babysteps/blog/2018/04/27/an-alias-based-formulation-of-the-borrow-checker/) of the borrow check. It is also a [specific project](https://github.com/rust-lang/polonius) that implemented that analysis, based on datalog. Our current plan does not make use of that datalog-based implementation, but uses what we learned implementing it to focus on reimplementing Polonius within rustc.
1313

14-
The motivating example for polonius is the so-called ["Problem Case #3: conditional control flow across functions"](https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md#problem-case-3-conditional-control-flow-across-functions): here, returning a reference out of a function, from a conditional.
14+
The motivating example for Polonius is the so-called ["Problem Case #3: conditional control flow across functions"](https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md#problem-case-3-conditional-control-flow-across-functions): here, returning a reference out of a function, from a conditional.
1515

1616
```rust=
1717
fn get_default<'r, K: Hash + Eq + Copy, V: Default>(
@@ -54,7 +54,7 @@ fn main() {
5454

5555
Here, the loan created on iteration N _may be used_ in the `None` path on iteration N+1, however the borrowed variable at that iteration is not the same.
5656

57-
Issues like "NLL problem case #3", issue #47680 and others, were therefore deferred from NLLs, and left as future work, [polonius](http://smallcultfollowing.com/babysteps/blog/2018/04/27/an-alias-based-formulation-of-the-borrow-checker/).
57+
Issues like "NLL problem case #3", issue #47680 and others, were therefore deferred from NLLs, and left as future work, [Polonius](http://smallcultfollowing.com/babysteps/blog/2018/04/27/an-alias-based-formulation-of-the-borrow-checker/).
5858

5959
The key ideas being:
6060
- switching from a model of _lifetimes_ as sets of points in the CFG (with _outlives_ relationships), to a model of _origins_ as sets of loans (with _subset_ relationships).
@@ -75,14 +75,14 @@ Here are the roadmap's milestones:
7575

7676
Today, the trait solver produces higher-ranked outlives constraints and the borrow checker solves them. In the future, we would like to make the [next trait solver](https://github.com/rust-lang/trait-system-refactor-initiative/) responsible for solving these higher-ranked constraints itself, so that it only produces constraints on regions in the root [universe](https://rustc-dev-guide.rust-lang.org/borrow_check/region_inference/placeholders_and_universes.html#what-is-a-universe) (which the borrow checker can easily process). This would allow us to solve implication predicates like `for<T> { if (T: 'a, 'a: 'b) { T: 'b } }` without having to effectively reproduce the same trait solving logic again.
7777

78-
In the shorter term, we can refactor the borrow checker to separate out the higher-ranked processing from the ordinary processing. The goal would be to preprocess the outlives constraints in a kind of polonius ["leak check"](https://rustc-dev-guide.rust-lang.org/traits/hrtb.html#basic-matching-and-placeholder-leaks), where we can compute the higher-ranked errors. This can then be removed once the trait solver can solve these constraints.
78+
In the shorter term, we can refactor the borrow checker to separate out the higher-ranked processing from the ordinary processing. The goal would be to preprocess the outlives constraints in a kind of Polonius ["leak check"](https://rustc-dev-guide.rust-lang.org/traits/hrtb.html#basic-matching-and-placeholder-leaks), where we can compute the higher-ranked errors. This can then be removed once the trait solver can solve these constraints.
7979

8080
Current status: ⏳ members of the types team are starting to work on this task in the next few days.
8181

8282

8383
### 2. Location-insensitive loans in scope
8484

85-
Out of the two key differences between polonius and the existing borrow check (regions as "sets of loans", and computing subtyping relations at each point in the CFG), this step is aimed at resolving the *first* difference, but not the second, so we call it the "location *in*sensitive loans in scope" (because subtyping is being done once, not per location): the idea can be described as "NLLs with the polonius model".
85+
Out of the two key differences between Polonius and the existing borrow check (regions as "sets of loans", and computing subtyping relations at each point in the CFG), this step is aimed at resolving the *first* difference, but not the second, so we call it the "location *in*sensitive loans in scope" (because subtyping is being done once, not per location): the idea can be described as "NLLs with the Polonius model".
8686

8787
Note that other aspects of the existing borrow checker are still flow-sensitive.
8888

@@ -92,7 +92,7 @@ Importantly, this change paves the way for adding location sensitivity (sets of
9292

9393
Current status: ✅ we have completed prototypes, and have [an open PR](https://github.com/rust-lang/rust/pull/113218) to land this under a `-Z` flag, which should happen in the near future.
9494

95-
### 3. Verify full test suite passes with location-insensitive polonius
95+
### 3. Verify full test suite passes with location-insensitive Polonius
9696

9797
That PR does pass the full 15000+ tests in our suite, but we haven't yet checked on the crates published on crates.io with a crater run.
9898

@@ -101,7 +101,7 @@ Compared to our internal test suite, the vast majority of published crates are e
101101
Current status: ⏳ in-progress, should be finalized right when the PR is just ready to land.
102102

103103

104-
### 4. Replace parts of the borrow checker with location-insensitive polonius
104+
### 4. Replace parts of the borrow checker with location-insensitive Polonius
105105

106106

107107
The prototype only does additional work, and does not modify the existing analysis.
@@ -122,9 +122,9 @@ At this point it can still be inefficient, and use the feature flag, but this is
122122

123123
Current status: we're in the design phase here, to adapt our datalog prototype and algorithms to rustc, imagining alternative ways to compute and propagate the subset constraints along the CFG.
124124

125-
### 6. Model borrow checking and polonius in a-mir-formality
125+
### 6. Model borrow checking and Polonius in a-mir-formality
126126

127-
The types team is building a model of Rust's MIR and trait system called [`a-mir-formality`][]. Once it reaches a sufficiently complete status, the intent is that the model will always be extended to cover new language features prior to stabilization. We are therefore working to add polonius into the model. This will in fact be the second time doing such modeling, as we already added polonius to a previous incarnation of a-mir-formality. In fact, that modeling work is what gave us the insights that enabled the location-insensitive polonius formulation now landing on nightly.
127+
The types team is building a model of Rust's MIR and trait system called [`a-mir-formality`][]. Once it reaches a sufficiently complete status, the intent is that the model will always be extended to cover new language features prior to stabilization. We are therefore working to add Polonius into the model. This will in fact be the second time doing such modeling, as we already added Polonius to a previous incarnation of a-mir-formality. In fact, that modeling work is what gave us the insights that enabled the location-insensitive Polonius formulation now landing on nightly.
128128

129129
[`a-mir-formality`]: https://github.com/rust-lang/a-mir-formality
130130

@@ -138,7 +138,7 @@ If a similar experience to NLLs in edition 2018 is to be expected again, another
138138

139139
At this point, the location-sensitive pass is hopefully efficient enough, tested in practice, somewhat formally verified, and can be enabled in edition 2024.
140140

141-
Around this time, librarification efforts can also be rebooted, to turn the in-tree polonius into a library, maybe using [Stable MIR][]. This is so that it could be reused elsewhere, for example in [rust-analyzer][], or [gccrs][], or by researchers working on verification tools (like [kani][]), [prusti][] and [creusot][]).
141+
Around this time, librarification efforts can also be rebooted, to turn the in-tree Polonius into a library, maybe using [Stable MIR][]. This is so that it could be reused elsewhere, for example in [rust-analyzer][], or [gccrs][], or by researchers working on verification tools (like [kani][]), [prusti][] and [creusot][]).
142142

143143
[Stable MIR]: https://github.com/rust-lang/team/pull/729
144144
[rust-analyzer]: https://github.com/rust-lang/rust-analyzer
@@ -149,4 +149,4 @@ Around this time, librarification efforts can also be rebooted, to turn the in-t
149149

150150
## Conclusion
151151

152-
We are very excited to see the plan for polonius coming into focus. At the moment, as we are still doing foundational work, we are not looking for volunteers or contributors unless they are well versed in the compiler. We do expect that as the project proceeds, there will be more and more need for new contributions. Stay tuned for updates!
152+
We are very excited to see the plan for Polonius coming into focus. At the moment, as we are still doing foundational work, we are not looking for volunteers or contributors unless they are well versed in the compiler. We do expect that as the project proceeds, there will be more and more need for new contributions. Stay tuned for updates!

0 commit comments

Comments
 (0)