From 1a4326d3fb83f88f10139ec2f00c3fb5442775d7 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 18 Apr 2018 14:27:58 +0200 Subject: [PATCH] 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`. % ``` --- src/test/ui/span/dropck_vec_cycle_checked.nll.stderr | 6 +++--- src/test/ui/span/dropck_vec_cycle_checked.rs | 3 +++ src/test/ui/span/dropck_vec_cycle_checked.stderr | 12 ++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr b/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr index 41edd04c92e..b7f8b85f46c 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr +++ b/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr @@ -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 diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs index 0560900e858..ece58d21ba9 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.rs +++ b/src/test/ui/span/dropck_vec_cycle_checked.rs @@ -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) diff --git a/src/test/ui/span/dropck_vec_cycle_checked.stderr b/src/test/ui/span/dropck_vec_cycle_checked.stderr index 63b0ab52d39..a6bc8da6f7c 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.stderr +++ b/src/test/ui/span/dropck_vec_cycle_checked.stderr @@ -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