-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add explicit revisions to polonius tests
The blessed expectations were recently removed because they were only checked via the compare-mode. This switches to explicit revisions to ensure it doesn't happen again. - `assignment-to-differing-field` - `polonius-smoke-test` - `subset-relations`
- Loading branch information
Showing
9 changed files
with
148 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
tests/ui/nll/polonius/assignment-to-differing-field.polonius.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
error[E0499]: cannot borrow `list.0.value` as mutable more than once at a time | ||
--> $DIR/assignment-to-differing-field.rs:23:21 | ||
| | ||
LL | fn assignment_to_field_projection<'a, T>( | ||
| -- lifetime `'a` defined here | ||
... | ||
LL | result.push(&mut (list.0).value); | ||
| ^^^^^^^^^^^^^^^^^^^ `list.0.value` was mutably borrowed here in the previous iteration of the loop | ||
... | ||
LL | return result; | ||
| ------ returning this value requires that `list.0.value` is borrowed for `'a` | ||
|
||
error[E0499]: cannot borrow `list.0.next` as mutable more than once at a time | ||
--> $DIR/assignment-to-differing-field.rs:26:26 | ||
| | ||
LL | fn assignment_to_field_projection<'a, T>( | ||
| -- lifetime `'a` defined here | ||
... | ||
LL | if let Some(n) = (list.0).next.as_mut() { | ||
| ^^^^^^^^^^^^^ `list.0.next` was mutably borrowed here in the previous iteration of the loop | ||
LL | | ||
LL | list.1 = n; | ||
| ---------- assignment requires that `list.0.next` is borrowed for `'a` | ||
|
||
error[E0499]: cannot borrow `list.0.0.0.0.0.value` as mutable more than once at a time | ||
--> $DIR/assignment-to-differing-field.rs:40:21 | ||
| | ||
LL | fn assignment_through_projection_chain<'a, T>( | ||
| -- lifetime `'a` defined here | ||
... | ||
LL | result.push(&mut ((((list.0).0).0).0).0.value); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `list.0.0.0.0.0.value` was mutably borrowed here in the previous iteration of the loop | ||
... | ||
LL | return result; | ||
| ------ returning this value requires that `list.0.0.0.0.0.value` is borrowed for `'a` | ||
|
||
error[E0499]: cannot borrow `list.0.0.0.0.0.next` as mutable more than once at a time | ||
--> $DIR/assignment-to-differing-field.rs:43:26 | ||
| | ||
LL | fn assignment_through_projection_chain<'a, T>( | ||
| -- lifetime `'a` defined here | ||
... | ||
LL | if let Some(n) = ((((list.0).0).0).0).0.next.as_mut() { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `list.0.0.0.0.0.next` was mutably borrowed here in the previous iteration of the loop | ||
LL | | ||
LL | *((((list.0).0).0).0).1 = n; | ||
| --------------------------- assignment requires that `list.0.0.0.0.0.next` is borrowed for `'a` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0499`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
error[E0515]: cannot return reference to local variable `x` | ||
--> $DIR/polonius-smoke-test.rs:10:5 | ||
| | ||
LL | &x | ||
| ^^ returns a reference to data owned by the current function | ||
|
||
error[E0503]: cannot use `x` because it was mutably borrowed | ||
--> $DIR/polonius-smoke-test.rs:16:13 | ||
| | ||
LL | let y = &mut x; | ||
| ------ `x` is borrowed here | ||
LL | let z = x; | ||
| ^ use of borrowed `x` | ||
LL | let w = y; | ||
| - borrow later used here | ||
|
||
error[E0505]: cannot move out of `x` because it is borrowed | ||
--> $DIR/polonius-smoke-test.rs:22:13 | ||
| | ||
LL | pub fn use_while_mut_fr(x: &mut i32) -> &mut i32 { | ||
| - - let's call the lifetime of this reference `'1` | ||
| | | ||
| binding `x` declared here | ||
LL | let y = &mut *x; | ||
| ------- borrow of `*x` occurs here | ||
LL | let z = x; | ||
| ^ move out of `x` occurs here | ||
LL | y | ||
| - returning this value requires that `*x` is borrowed for `'1` | ||
| | ||
help: consider cloning the value if the performance cost is acceptable | ||
| | ||
LL - let y = &mut *x; | ||
LL + let y = &mut x.clone(); | ||
| | ||
|
||
error[E0505]: cannot move out of `s` because it is borrowed | ||
--> $DIR/polonius-smoke-test.rs:46:5 | ||
| | ||
LL | let s = &mut 1; | ||
| - binding `s` declared here | ||
LL | let r = &mut *s; | ||
| ------- borrow of `*s` occurs here | ||
LL | let tmp = foo(&r); | ||
LL | s; | ||
| ^ move out of `s` occurs here | ||
LL | tmp; | ||
| --- borrow later used here | ||
| | ||
help: consider cloning the value if the performance cost is acceptable | ||
| | ||
LL - let r = &mut *s; | ||
LL + let r = &mut s.clone(); | ||
| | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0503, E0505, E0515. | ||
For more information about an error, try `rustc --explain E0503`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/ui/nll/polonius/subset-relations.stderr → ...l/polonius/subset-relations.legacy.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/subset-relations.rs:13:5 | ||
| | ||
LL | fn missing_subset<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 { | ||
| -- -- lifetime `'b` defined here | ||
| | | ||
| lifetime `'a` defined here | ||
LL | y | ||
| ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` | ||
| | ||
= help: consider adding the following bound: `'b: 'a` | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters