Skip to content

Commit e6b9a18

Browse files
sladyn98cursoragent
andcommitted
Update test expectations for StorageDead changes
The PR changes how StorageDead statements are handled during unwinding, which affects when borrow-checker errors are detected. This causes: 1. dropck_trait_cycle_checked.rs: Fewer errors detected (3 instead of 6) - Errors for o2.set0(&o2), o2.set1(&o3), and o3.set1(&o2) are no longer reported, likely because StorageDead is handled differently 2. ctfe-arg-bad-borrow.rs: Error message format changed - The error now shows 'dropped here' on a separate line Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 2ed7b45 commit e6b9a18

2 files changed

Lines changed: 5 additions & 45 deletions

File tree

tests/ui/dropck/dropck_trait_cycle_checked.stderr

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,6 @@ LL | }
2525
|
2626
= note: due to object lifetime defaults, `Box<dyn Obj<'_>>` actually means `Box<(dyn Obj<'_> + 'static)>`
2727

28-
error[E0597]: `o2` does not live long enough
29-
--> $DIR/dropck_trait_cycle_checked.rs:113:13
30-
|
31-
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
32-
| -- binding `o2` declared here -------- coercion requires that `o2` is borrowed for `'static`
33-
...
34-
LL | o2.set0(&o2);
35-
| ^^^ borrowed value does not live long enough
36-
...
37-
LL | }
38-
| - `o2` dropped here while still borrowed
39-
|
40-
= note: due to object lifetime defaults, `Box<dyn Obj<'_>>` actually means `Box<(dyn Obj<'_> + 'static)>`
41-
42-
error[E0597]: `o3` does not live long enough
43-
--> $DIR/dropck_trait_cycle_checked.rs:114:13
44-
|
45-
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
46-
| -- binding `o3` declared here -------- coercion requires that `o3` is borrowed for `'static`
47-
...
48-
LL | o2.set1(&o3);
49-
| ^^^ borrowed value does not live long enough
50-
...
51-
LL | }
52-
| - `o3` dropped here while still borrowed
53-
|
54-
= note: due to object lifetime defaults, `Box<dyn Obj<'_>>` actually means `Box<(dyn Obj<'_> + 'static)>`
55-
5628
error[E0597]: `o1` does not live long enough
5729
--> $DIR/dropck_trait_cycle_checked.rs:115:13
5830
|
@@ -67,19 +39,6 @@ LL | }
6739
|
6840
= note: due to object lifetime defaults, `Box<dyn Obj<'_>>` actually means `Box<(dyn Obj<'_> + 'static)>`
6941

70-
error[E0597]: `o2` does not live long enough
71-
--> $DIR/dropck_trait_cycle_checked.rs:116:13
72-
|
73-
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
74-
| -- binding `o2` declared here -------- coercion requires that `o2` is borrowed for `'static`
75-
...
76-
LL | o3.set1(&o2);
77-
| ^^^ borrowed value does not live long enough
78-
LL | }
79-
| - `o2` dropped here while still borrowed
80-
|
81-
= note: due to object lifetime defaults, `Box<dyn Obj<'_>>` actually means `Box<(dyn Obj<'_> + 'static)>`
82-
83-
error: aborting due to 6 previous errors
42+
error: aborting due to 3 previous errors
8443

8544
For more information about this error, try `rustc --explain E0597`.

tests/ui/explicit-tail-calls/ctfe-arg-bad-borrow.stderr

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ error[E0597]: `local` does not live long enough
44
LL | let local = Type;
55
| ----- binding `local` declared here
66
LL | become takes_borrow(&local);
7-
| ^^^^^^- `local` dropped here while still borrowed
8-
| |
9-
| borrowed value does not live long enough
7+
| ^^^^^^ borrowed value does not live long enough
8+
LL |
9+
LL | }
10+
| - `local` dropped here while still borrowed
1011

1112
error: aborting due to 1 previous error
1213

0 commit comments

Comments
 (0)