Skip to content

Commit b99db6e

Browse files
authored
Rollup merge of #70546 - lqd:polonius_update, r=nikomatsakis
Polonius: update to 0.12.1, fix more move errors false positives, update test expectations This PR: - updates `polonius-engine` to version 0.12.1 to fix some move errors false positives - fixes a fact generation mistake creating the other move errors false positives - updates the test expectations for the polonius compare-mode so that all (minus the 2 OOMs) ui tests pass again (matching the [analysis doc](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view) starting at case 34) In my opinion, this is safe to rollup. r? @nikomatsakis
2 parents 47ffca2 + 5af11d2 commit b99db6e

File tree

7 files changed

+20
-14
lines changed

7 files changed

+20
-14
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -2522,9 +2522,9 @@ checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
25222522

25232523
[[package]]
25242524
name = "polonius-engine"
2525-
version = "0.12.0"
2525+
version = "0.12.1"
25262526
source = "registry+https://github.com/rust-lang/crates.io-index"
2527-
checksum = "04d8ef65e3f89ecaec9ca7cb0e0911b4617352d4494018bcf934992f03f2024c"
2527+
checksum = "ef2558a4b464e185b36ee08a2937ebb62ea5464c38856cfb1465c97cb38db52d"
25282528
dependencies = [
25292529
"datafrog",
25302530
"log",

src/librustc_mir/borrow_check/type_check/liveness/polonius.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl UseFactsExtractor<'_> {
4343

4444
fn insert_path_access(&mut self, path: MovePathIndex, location: Location) {
4545
debug!("UseFactsExtractor::insert_path_access({:?}, {:?})", path, location);
46-
self.path_accessed_at_base.push((path, self.location_table.start_index(location)));
46+
self.path_accessed_at_base.push((path, self.location_to_index(location)));
4747
}
4848

4949
fn place_to_mpi(&self, place: &Place<'_>) -> Option<MovePathIndex> {

src/test/ui/closures/closure-expected-type/expect-region-supply-region.polonius.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure
22
--> $DIR/expect-region-supply-region.rs:18:9
33
|
44
LL | let mut f: Option<&u32> = None;
5-
| ----- `f` is declared here, outside of the closure body
5+
| ----- `f` declared here, outside of the closure body
66
LL | closure_expecting_bound(|x| {
77
| - `x` is a reference that is only valid in the closure body
88
LL | f = Some(x);
@@ -12,7 +12,7 @@ error[E0521]: borrowed data escapes outside of closure
1212
--> $DIR/expect-region-supply-region.rs:28:9
1313
|
1414
LL | let mut f: Option<&u32> = None;
15-
| ----- `f` is declared here, outside of the closure body
15+
| ----- `f` declared here, outside of the closure body
1616
LL | closure_expecting_bound(|x: &u32| {
1717
| - `x` is a reference that is only valid in the closure body
1818
LL | f = Some(x);
@@ -33,7 +33,7 @@ error[E0521]: borrowed data escapes outside of closure
3333
--> $DIR/expect-region-supply-region.rs:42:9
3434
|
3535
LL | let mut f: Option<&u32> = None;
36-
| ----- `f` is declared here, outside of the closure body
36+
| ----- `f` declared here, outside of the closure body
3737
...
3838
LL | closure_expecting_bound(|x: &'x u32| {
3939
| - `x` is a reference that is only valid in the closure body

src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also
3939
... |
4040
LL | | foo_hrtb_bar_not(&mut t);
4141
| | ------------------------ recursive call site
42+
LL | |
4243
LL | | }
4344
| |_^ cannot return without recursing
4445
|
@@ -51,7 +52,7 @@ LL | foo_hrtb_bar_not(&mut t);
5152
| ^^^^^^^^^^^^^^^^^^^^^^^^
5253

5354
warning: function cannot return without recursing
54-
--> $DIR/hrtb-perfect-forwarding.rs:49:1
55+
--> $DIR/hrtb-perfect-forwarding.rs:50:1
5556
|
5657
LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
5758
LL | | where T : for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>

src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
error: lifetime may not live long enough
2-
--> $DIR/error-handling.rs:13:56
2+
--> $DIR/error-handling.rs:23:16
33
|
44
LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
5-
| -- -- lifetime `'b` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'b`
5+
| -- -- lifetime `'b` defined here
66
| |
77
| lifetime `'a` defined here
8+
...
9+
LL | let _: &'b i32 = *u.0;
10+
| ^^^^^^^ type annotation requires that `'a` must outlive `'b`
811
|
912
= help: consider adding the following bound: `'a: 'b`
1013

src/test/ui/nll/outlives-suggestion-simple.polonius.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ LL | (x, x)
7272
|
7373
= help: consider adding the following bound: `'a: 'c`
7474

75+
help: add bound `'a: 'b + 'c`
76+
7577
error: lifetime may not live long enough
7678
--> $DIR/outlives-suggestion-simple.rs:31:9
7779
|
@@ -106,16 +108,16 @@ LL | self.x
106108
|
107109
= help: consider adding the following bound: `'b: 'a`
108110

109-
error[E0521]: borrowed data escapes outside of function
111+
error[E0521]: borrowed data escapes outside of associated function
110112
--> $DIR/outlives-suggestion-simple.rs:73:9
111113
|
112114
LL | fn get_bar(&self) -> Bar2 {
113115
| -----
114116
| |
115-
| `self` is declared here, outside of the function body
116-
| `self` is a reference that is only valid in the function body
117+
| `self` declared here, outside of the associated function body
118+
| `self` is a reference that is only valid in the associated function body
117119
LL | Bar2::new(&self)
118-
| ^^^^^^^^^^^^^^^^ `self` escapes the function body here
120+
| ^^^^^^^^^^^^^^^^ `self` escapes the associated function body here
119121

120122
error: aborting due to 10 previous errors
121123

src/test/ui/nll/user-annotations/closure-substs.polonius.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ error[E0521]: borrowed data escapes outside of closure
5050
--> $DIR/closure-substs.rs:29:9
5151
|
5252
LL | |x: &i32, b: fn(&'static i32)| {
53-
| - - `b` is declared here, outside of the closure body
53+
| - - `b` declared here, outside of the closure body
5454
| |
5555
| `x` is a reference that is only valid in the closure body
5656
LL | b(x);

0 commit comments

Comments
 (0)