1
Fork 0

Workaround rust-lang/rust#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`.
%
```
This commit is contained in:
Felix S. Klock II 2018-04-18 14:27:58 +02:00
parent a771b0f075
commit 1a4326d3fb
3 changed files with 12 additions and 9 deletions

View file

@ -1,5 +1,5 @@
error[E0597]: `c1` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:118:24
--> $DIR/dropck_vec_cycle_checked.rs:121:24
|
LL | c3.v[0].v.set(Some(&c1));
| ^^^ borrowed value does not live long enough
@ -11,7 +11,7 @@ LL | }
| borrow later used here, when `c1` is dropped
error[E0597]: `c2` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:110:24
--> $DIR/dropck_vec_cycle_checked.rs:113:24
|
LL | c1.v[0].v.set(Some(&c2));
| ^^^ borrowed value does not live long enough
@ -23,7 +23,7 @@ LL | }
| borrow later used here, when `c1` is dropped
error[E0597]: `c3` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:112:24
--> $DIR/dropck_vec_cycle_checked.rs:115:24
|
LL | c1.v[1].v.set(Some(&c3));
| ^^^ borrowed value does not live long enough

View file

@ -8,6 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z nll-subminimal-causes
// (Work around rust-lang/rust#49998 by opting into nll-subminimal-causes.)
// Reject mixing cyclic structure and Drop when using Vec.
//
// (Compare against compile-fail/dropck_arr_cycle_checked.rs)

View file

@ -1,5 +1,5 @@
error[E0597]: `c2` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:110:25
--> $DIR/dropck_vec_cycle_checked.rs:113:25
|
LL | c1.v[0].v.set(Some(&c2));
| ^^ borrowed value does not live long enough
@ -10,7 +10,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c3` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:112:25
--> $DIR/dropck_vec_cycle_checked.rs:115:25
|
LL | c1.v[1].v.set(Some(&c3));
| ^^ borrowed value does not live long enough
@ -21,7 +21,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c2` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:114:25
--> $DIR/dropck_vec_cycle_checked.rs:117:25
|
LL | c2.v[0].v.set(Some(&c2));
| ^^ borrowed value does not live long enough
@ -32,7 +32,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c3` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:116:25
--> $DIR/dropck_vec_cycle_checked.rs:119:25
|
LL | c2.v[1].v.set(Some(&c3));
| ^^ borrowed value does not live long enough
@ -43,7 +43,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c1` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:118:25
--> $DIR/dropck_vec_cycle_checked.rs:121:25
|
LL | c3.v[0].v.set(Some(&c1));
| ^^ borrowed value does not live long enough
@ -54,7 +54,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c2` does not live long enough
--> $DIR/dropck_vec_cycle_checked.rs:120:25
--> $DIR/dropck_vec_cycle_checked.rs:123:25
|
LL | c3.v[1].v.set(Some(&c2));
| ^^ borrowed value does not live long enough