Skip to content

Commit 1a4326d

Browse files
committed
Workaround #49998 by opting into experimental -Z nll-subminimal-causes flag
This commit only applies the flag to the one test case, ui/span/dropck_vec_cycle_checked.rs, that absolutely needs it. Without the flag, that test takes an unknown amount of time (greater than 1 minute) to compile. But its possible that other tests would also benefit from the flag, and we may want to make it the default (after evaluating its impact on other tests). In terms of its known impact on other tests, I have only evaluated the ui tests, and the *only* ui test I have found that the flag impacts (running under NLL mode, of course), is src/test/ui/nll/issue-31567.rs In particular: ``` % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs error[E0597]: `*v.0` does not live long enough --> ../src/test/ui/nll/issue-31567.rs:22:26 | 22 | let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough | ^^^^^ borrowed value does not live long enough 23 | &s_inner.0 24 | } | - borrowed value only lives until here | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:1... --> ../src/test/ui/nll/issue-31567.rs:21:1 | 21 | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs -Z nll-subminimal-causes error[E0597]: `*v.0` does not live long enough --> ../src/test/ui/nll/issue-31567.rs:22:26 | 22 | let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough | ^^^^^ borrowed value does not live long enough 23 | &s_inner.0 24 | } | - | | | borrowed value only lives until here | borrow later used here, when `v` is dropped error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. % ```
1 parent a771b0f commit 1a4326d

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Diff for: src/test/ui/span/dropck_vec_cycle_checked.nll.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0597]: `c1` does not live long enough
2-
--> $DIR/dropck_vec_cycle_checked.rs:118:24
2+
--> $DIR/dropck_vec_cycle_checked.rs:121:24
33
|
44
LL | c3.v[0].v.set(Some(&c1));
55
| ^^^ borrowed value does not live long enough
@@ -11,7 +11,7 @@ LL | }
1111
| borrow later used here, when `c1` is dropped
1212

1313
error[E0597]: `c2` does not live long enough
14-
--> $DIR/dropck_vec_cycle_checked.rs:110:24
14+
--> $DIR/dropck_vec_cycle_checked.rs:113:24
1515
|
1616
LL | c1.v[0].v.set(Some(&c2));
1717
| ^^^ borrowed value does not live long enough
@@ -23,7 +23,7 @@ LL | }
2323
| borrow later used here, when `c1` is dropped
2424

2525
error[E0597]: `c3` does not live long enough
26-
--> $DIR/dropck_vec_cycle_checked.rs:112:24
26+
--> $DIR/dropck_vec_cycle_checked.rs:115:24
2727
|
2828
LL | c1.v[1].v.set(Some(&c3));
2929
| ^^^ borrowed value does not live long enough

Diff for: src/test/ui/span/dropck_vec_cycle_checked.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z nll-subminimal-causes
12+
// (Work around rust-lang/rust#49998 by opting into nll-subminimal-causes.)
13+
1114
// Reject mixing cyclic structure and Drop when using Vec.
1215
//
1316
// (Compare against compile-fail/dropck_arr_cycle_checked.rs)

Diff for: src/test/ui/span/dropck_vec_cycle_checked.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0597]: `c2` does not live long enough
2-
--> $DIR/dropck_vec_cycle_checked.rs:110:25
2+
--> $DIR/dropck_vec_cycle_checked.rs:113:25
33
|
44
LL | c1.v[0].v.set(Some(&c2));
55
| ^^ borrowed value does not live long enough
@@ -10,7 +10,7 @@ LL | }
1010
= note: values in a scope are dropped in the opposite order they are created
1111

1212
error[E0597]: `c3` does not live long enough
13-
--> $DIR/dropck_vec_cycle_checked.rs:112:25
13+
--> $DIR/dropck_vec_cycle_checked.rs:115:25
1414
|
1515
LL | c1.v[1].v.set(Some(&c3));
1616
| ^^ borrowed value does not live long enough
@@ -21,7 +21,7 @@ LL | }
2121
= note: values in a scope are dropped in the opposite order they are created
2222

2323
error[E0597]: `c2` does not live long enough
24-
--> $DIR/dropck_vec_cycle_checked.rs:114:25
24+
--> $DIR/dropck_vec_cycle_checked.rs:117:25
2525
|
2626
LL | c2.v[0].v.set(Some(&c2));
2727
| ^^ borrowed value does not live long enough
@@ -32,7 +32,7 @@ LL | }
3232
= note: values in a scope are dropped in the opposite order they are created
3333

3434
error[E0597]: `c3` does not live long enough
35-
--> $DIR/dropck_vec_cycle_checked.rs:116:25
35+
--> $DIR/dropck_vec_cycle_checked.rs:119:25
3636
|
3737
LL | c2.v[1].v.set(Some(&c3));
3838
| ^^ borrowed value does not live long enough
@@ -43,7 +43,7 @@ LL | }
4343
= note: values in a scope are dropped in the opposite order they are created
4444

4545
error[E0597]: `c1` does not live long enough
46-
--> $DIR/dropck_vec_cycle_checked.rs:118:25
46+
--> $DIR/dropck_vec_cycle_checked.rs:121:25
4747
|
4848
LL | c3.v[0].v.set(Some(&c1));
4949
| ^^ borrowed value does not live long enough
@@ -54,7 +54,7 @@ LL | }
5454
= note: values in a scope are dropped in the opposite order they are created
5555

5656
error[E0597]: `c2` does not live long enough
57-
--> $DIR/dropck_vec_cycle_checked.rs:120:25
57+
--> $DIR/dropck_vec_cycle_checked.rs:123:25
5858
|
5959
LL | c3.v[1].v.set(Some(&c2));
6060
| ^^ borrowed value does not live long enough

0 commit comments

Comments
 (0)