From 558955035688162ddde287eff62f0becbbe5f36b Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 11 Apr 2018 17:15:59 +0200 Subject: [PATCH 1/9] Expand `x.py test` to also run with `--compare-mode=nll` on src/test/ui suite. --- src/bootstrap/test.rs | 45 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 3d954cd5d848c..ca18604e6d1f8 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -538,6 +538,7 @@ impl Step for RustdocUi { target: self.target, mode: "ui", suite: "rustdoc-ui", + compare_mode: None, }) } } @@ -590,6 +591,14 @@ macro_rules! default_test { } } +macro_rules! default_test_with_compare_mode { + ($name:ident { path: $path:expr, mode: $mode:expr, suite: $suite:expr, + compare_mode: $compare_mode:expr }) => { + test_with_compare_mode!($name { path: $path, mode: $mode, suite: $suite, default: true, + host: false, compare_mode: $compare_mode }); + } +} + macro_rules! host_test { ($name:ident { path: $path:expr, mode: $mode:expr, suite: $suite:expr }) => { test!($name { path: $path, mode: $mode, suite: $suite, default: true, host: true }); @@ -597,12 +606,29 @@ macro_rules! host_test { } macro_rules! test { + ($name:ident { path: $path:expr, mode: $mode:expr, suite: $suite:expr, default: $default:expr, + host: $host:expr }) => { + test_definitions!($name { path: $path, mode: $mode, suite: $suite, default: $default, + host: $host, compare_mode: None }); + } +} + +macro_rules! test_with_compare_mode { + ($name:ident { path: $path:expr, mode: $mode:expr, suite: $suite:expr, default: $default:expr, + host: $host:expr, compare_mode: $compare_mode:expr }) => { + test_definitions!($name { path: $path, mode: $mode, suite: $suite, default: $default, + host: $host, compare_mode: Some($compare_mode) }); + } +} + +macro_rules! test_definitions { ($name:ident { path: $path:expr, mode: $mode:expr, suite: $suite:expr, default: $default:expr, - host: $host:expr + host: $host:expr, + compare_mode: $compare_mode:expr }) => { #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct $name { @@ -634,16 +660,18 @@ macro_rules! test { target: self.target, mode: $mode, suite: $suite, + compare_mode: $compare_mode, }) } } } } -default_test!(Ui { +default_test_with_compare_mode!(Ui { path: "src/test/ui", mode: "ui", - suite: "ui" + suite: "ui", + compare_mode: "nll" }); default_test!(RunPass { @@ -804,6 +832,7 @@ struct Compiletest { target: Interned, mode: &'static str, suite: &'static str, + compare_mode: Option<&'static str>, } impl Step for Compiletest { @@ -823,6 +852,7 @@ impl Step for Compiletest { let target = self.target; let mode = self.mode; let suite = self.suite; + let compare_mode = self.compare_mode; // Skip codegen tests if they aren't enabled in configuration. if !builder.config.codegen_tests && suite == "codegen" { @@ -1044,6 +1074,15 @@ impl Step for Compiletest { suite, mode, &compiler.host, target)); let _time = util::timeit(&builder); try_run(builder, &mut cmd); + + if let Some(compare_mode) = compare_mode { + cmd.arg("--compare-mode").arg(compare_mode); + let _folder = builder.fold_output(|| format!("test_{}_{}", suite, compare_mode)); + builder.info(&format!("Check compiletest suite={} mode={} compare_mode={} ({} -> {})", + suite, mode, compare_mode, &compiler.host, target)); + let _time = util::timeit(&builder); + try_run(builder, &mut cmd); + } } } From ae6a9d4ba484f8f5bb9cbebf6da6d179bef519e1 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 11 Apr 2018 17:18:22 +0200 Subject: [PATCH 2/9] Change output of `compiletest` to include the compare-mode when present. E.g. when running with `--compare-mode=nll`, then each test line will look like e.g.: ``` test [ui (nll)] ui/issue-10969.rs ... ok ``` --- src/tools/compiletest/src/common.rs | 2 +- src/tools/compiletest/src/main.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 41fc67a66f47d..365b47447f23a 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -101,7 +101,7 @@ pub enum CompareMode { } impl CompareMode { - fn to_str(&self) -> &'static str { + pub(crate) fn to_str(&self) -> &'static str { match *self { CompareMode::Nll => "nll" } diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index ae4f4aa404609..f61ab7bae4551 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -728,7 +728,11 @@ pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName let path = PathBuf::from(config.src_base.file_name().unwrap()) .join(&testpaths.relative_dir) .join(&testpaths.file.file_name().unwrap()); - test::DynTestName(format!("[{}] {}", config.mode, path.display())) + let mode_suffix = match config.compare_mode { + Some(ref mode) => format!(" ({})", mode.to_str()), + None => format!(""), + }; + test::DynTestName(format!("[{}{}] {}", config.mode, mode_suffix, path.display())) } pub fn make_test_closure(config: &Config, testpaths: &TestPaths) -> test::TestFn { From 02a7809f1c10ceab7ffe4652f1211cdc3c6fd4c1 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 11 Apr 2018 17:28:14 +0200 Subject: [PATCH 3/9] Generate separate stamp files for `--compare-mode=nll`, and also use them. :) --- src/tools/compiletest/src/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index f61ab7bae4551..37f7af0abe8f5 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -626,7 +626,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn // Debugging emscripten code doesn't make sense today let ignore = early_props.ignore - || (!up_to_date(config, testpaths, &early_props) && config.compare_mode.is_none()) + || !up_to_date(config, testpaths, &early_props) || (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) && config.target.contains("emscripten"); @@ -642,10 +642,15 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn } fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf { + let mode_suffix = match config.compare_mode { + Some(ref mode) => format!("-{}", mode.to_str()), + None => format!(""), + }; let stamp_name = format!( - "{}-{}.stamp", + "{}-{}{}.stamp", testpaths.file.file_name().unwrap().to_str().unwrap(), - config.stage_id + config.stage_id, + mode_suffix ); config .build_base From ea454746b31cfdd1c9f08b3ea11fff4ef19b58e7 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 12 Apr 2018 12:25:29 +0200 Subject: [PATCH 4/9] Update the previously checkpointed (but unused by bors) tests to reflect current reality. --- src/test/ui/borrowck/issue-45983.nll.stderr | 2 +- .../ui/did_you_mean/issue-34126.nll.stderr | 11 ++++- .../ui/did_you_mean/issue-35937.nll.stderr | 2 +- .../ui/did_you_mean/issue-38147-1.nll.stderr | 2 +- .../ui/did_you_mean/issue-38147-4.nll.stderr | 2 +- .../ui/did_you_mean/issue-39544.nll.stderr | 22 ++++----- src/test/ui/error-codes/E0389.nll.stderr | 8 ++-- src/test/ui/hygiene/fields-move.nll.stderr | 46 +++++++++++++++++++ .../fields-numeric-borrowck.nll.stderr | 13 ++++++ .../ui/hygiene/fields-numeric-borrowck.rs | 4 +- src/test/ui/issue-36400.nll.stderr | 2 +- .../enum.nll.stderr | 18 +++++--- .../explicit-mut.nll.stderr | 18 +++++--- ...owck-call-is-borrow-issue-12224.nll.stderr | 2 +- .../borrowck-object-mutability.nll.stderr | 2 +- .../span/destructor-restrictions.nll.stderr | 16 +++++++ ...locals-die-before-temps-of-body.nll.stderr | 30 ++++++++++++ .../wf-method-late-bound-regions.nll.stderr | 20 ++++---- .../ui/span/wf-method-late-bound-regions.rs | 4 +- 19 files changed, 174 insertions(+), 50 deletions(-) create mode 100644 src/test/ui/hygiene/fields-move.nll.stderr create mode 100644 src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr index ecd17edb079f1..d949ebae32557 100644 --- a/src/test/ui/borrowck/issue-45983.nll.stderr +++ b/src/test/ui/borrowck/issue-45983.nll.stderr @@ -16,7 +16,7 @@ error[E0594]: cannot assign to immutable item `x` LL | give_any(|y| x = Some(y)); | ^^^^^^^^^^^ cannot mutate | - = note: Value not mutable causing this error: `x` + = note: the value which is causing this path not to be mutable is...: `x` error[E0596]: cannot borrow immutable item `x` as mutable --> $DIR/issue-45983.rs:17:14 diff --git a/src/test/ui/did_you_mean/issue-34126.nll.stderr b/src/test/ui/did_you_mean/issue-34126.nll.stderr index afdc26a75c73f..81f858f6bfcb0 100644 --- a/src/test/ui/did_you_mean/issue-34126.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34126.nll.stderr @@ -1,3 +1,9 @@ +error[E0596]: cannot borrow immutable item `self` as mutable + --> $DIR/issue-34126.rs:16:18 + | +LL | self.run(&mut self); //~ ERROR cannot borrow + | ^^^^^^^^^ cannot borrow as mutable + error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable --> $DIR/issue-34126.rs:16:18 | @@ -8,6 +14,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow | immutable borrow occurs here | borrow later used here -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0502`. +Some errors occurred: E0502, E0596. +For more information about an error, try `rustc --explain E0502`. diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr index 7b5f452d32217..40b640b63cf32 100644 --- a/src/test/ui/did_you_mean/issue-35937.nll.stderr +++ b/src/test/ui/did_you_mean/issue-35937.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `f.v` as mutable LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow | ^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `f` + = note: the value which is causing this path not to be mutable is...: `f` error[E0384]: cannot assign twice to immutable variable `s.x` --> $DIR/issue-35937.rs:26:5 diff --git a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr index 099479eaf2b6b..8e4426779517c 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*self.s` as mutable LL | self.s.push('x'); //~ ERROR cannot borrow data mutably | ^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*self` + = note: the value which is causing this path not to be mutable is...: `*self` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr index 5649fc903a078..6808222cc3241 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*f.s` as mutable LL | f.s.push('x'); //~ ERROR cannot borrow data mutably | ^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*f` + = note: the value which is causing this path not to be mutable is...: `*f` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-39544.nll.stderr b/src/test/ui/did_you_mean/issue-39544.nll.stderr index 6e57796aa45c7..f5f5b675e7727 100644 --- a/src/test/ui/did_you_mean/issue-39544.nll.stderr +++ b/src/test/ui/did_you_mean/issue-39544.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `z.x` as mutable LL | let _ = &mut z.x; //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `z` + = note: the value which is causing this path not to be mutable is...: `z` error[E0596]: cannot borrow immutable item `self.x` as mutable --> $DIR/issue-39544.rs:26:17 @@ -12,7 +12,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*self` + = note: the value which is causing this path not to be mutable is...: `*self` error[E0596]: cannot borrow immutable item `self.x` as mutable --> $DIR/issue-39544.rs:30:17 @@ -20,7 +20,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*self` + = note: the value which is causing this path not to be mutable is...: `*self` error[E0596]: cannot borrow immutable item `other.x` as mutable --> $DIR/issue-39544.rs:31:17 @@ -28,7 +28,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*other` + = note: the value which is causing this path not to be mutable is...: `*other` error[E0596]: cannot borrow immutable item `self.x` as mutable --> $DIR/issue-39544.rs:35:17 @@ -36,7 +36,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*self` + = note: the value which is causing this path not to be mutable is...: `*self` error[E0596]: cannot borrow immutable item `other.x` as mutable --> $DIR/issue-39544.rs:36:17 @@ -44,7 +44,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*other` + = note: the value which is causing this path not to be mutable is...: `*other` error[E0596]: cannot borrow immutable item `self.x` as mutable --> $DIR/issue-39544.rs:40:17 @@ -52,7 +52,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*self` + = note: the value which is causing this path not to be mutable is...: `*self` error[E0596]: cannot borrow immutable item `other.x` as mutable --> $DIR/issue-39544.rs:41:17 @@ -60,7 +60,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*other` + = note: the value which is causing this path not to be mutable is...: `*other` error[E0596]: cannot borrow immutable item `other.x` as mutable --> $DIR/issue-39544.rs:45:17 @@ -68,7 +68,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*other` + = note: the value which is causing this path not to be mutable is...: `*other` error[E0596]: cannot borrow immutable item `z.x` as mutable --> $DIR/issue-39544.rs:51:13 @@ -76,7 +76,7 @@ error[E0596]: cannot borrow immutable item `z.x` as mutable LL | let _ = &mut z.x; //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `z` + = note: the value which is causing this path not to be mutable is...: `z` error[E0596]: cannot borrow immutable item `w.x` as mutable --> $DIR/issue-39544.rs:52:13 @@ -84,7 +84,7 @@ error[E0596]: cannot borrow immutable item `w.x` as mutable LL | let _ = &mut w.x; //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*w` + = note: the value which is causing this path not to be mutable is...: `*w` error[E0594]: cannot assign to immutable item `*x.0` --> $DIR/issue-39544.rs:58:5 diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr index 13ba653a5cad8..0525e16239d2c 100644 --- a/src/test/ui/error-codes/E0389.nll.stderr +++ b/src/test/ui/error-codes/E0389.nll.stderr @@ -1,10 +1,10 @@ -error[E0594]: cannot assign to immutable item `fancy_ref.num` +error[E0594]: cannot assign to data in a `&` reference --> $DIR/E0389.rs:18:5 | +LL | let fancy_ref = &(&mut fancy); + | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` LL | fancy_ref.num = 6; //~ ERROR E0389 - | ^^^^^^^^^^^^^^^^^ cannot mutate - | - = note: Value not mutable causing this error: `*fancy_ref` + | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/hygiene/fields-move.nll.stderr b/src/test/ui/hygiene/fields-move.nll.stderr new file mode 100644 index 0000000000000..51f8067b8ce5b --- /dev/null +++ b/src/test/ui/hygiene/fields-move.nll.stderr @@ -0,0 +1,46 @@ +error[E0382]: use of moved value: `foo.x` + --> $DIR/fields-move.rs:38:42 + | +LL | $foo.x + | ------ value moved here +... +LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` + | ^^^^^ value used here after move + | + = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait + +error[E0382]: use of moved value: `foo.x` + --> $DIR/fields-move.rs:28:9 + | +LL | $foo.x + | ------ value moved here +... +LL | $foo.x //~ ERROR use of moved value: `foo.x` + | ^^^^^^ value used here after move +... +LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` + | ----- value moved here +LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` + | ----------------- in this macro invocation + | + = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait + +error[E0382]: use of moved value: `foo.x` + --> $DIR/fields-move.rs:39:42 + | +LL | $foo.x + | ------ value moved here +... +LL | $foo.x //~ ERROR use of moved value: `foo.x` + | ------ value moved here +... +LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` + | ----- value moved here +LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` + | ^^^^^ value used here after move + | + = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr b/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr new file mode 100644 index 0000000000000..3a0a6f66d61c3 --- /dev/null +++ b/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr @@ -0,0 +1,13 @@ +error: compilation successful + --> $DIR/fields-numeric-borrowck.rs:13:1 + | +LL | / fn main() { #![rustc_error] // rust-lang/rust#49855 +LL | | let mut s = S(0); +LL | | let borrow1 = &mut s.0; +LL | | let S { 0: ref mut borrow2 } = s; +LL | | //~^ ERROR cannot borrow `s.0` as mutable more than once at a time +LL | | } + | |_^ + +error: aborting due to previous error + diff --git a/src/test/ui/hygiene/fields-numeric-borrowck.rs b/src/test/ui/hygiene/fields-numeric-borrowck.rs index 50ace39e70939..975684fbd41bb 100644 --- a/src/test/ui/hygiene/fields-numeric-borrowck.rs +++ b/src/test/ui/hygiene/fields-numeric-borrowck.rs @@ -7,10 +7,10 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. - +#![feature(rustc_attrs)] struct S(u8); -fn main() { +fn main() { #![rustc_error] // rust-lang/rust#49855 let mut s = S(0); let borrow1 = &mut s.0; let S { 0: ref mut borrow2 } = s; diff --git a/src/test/ui/issue-36400.nll.stderr b/src/test/ui/issue-36400.nll.stderr index 040e6300af60a..8045993747934 100644 --- a/src/test/ui/issue-36400.nll.stderr +++ b/src/test/ui/issue-36400.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable LL | f(&mut *x); //~ ERROR cannot borrow immutable | ^^^^^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `x` + = note: the value which is causing this path not to be mutable is...: `x` error: aborting due to previous error diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr index 6ae5f777a9396..b97bdeea409c6 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr @@ -1,20 +1,26 @@ -error[E0594]: cannot assign to immutable item `*x` +error[E0594]: cannot assign to data in a `&` reference --> $DIR/enum.rs:19:5 | +LL | let Wrap(x) = &Wrap(3); + | - help: consider changing this to be a mutable reference: `&mut` LL | *x += 1; //~ ERROR cannot assign to immutable - | ^^^^^^^ cannot mutate + | ^^^^^^^ -error[E0594]: cannot assign to immutable item `*x` +error[E0594]: cannot assign to data in a `&` reference --> $DIR/enum.rs:23:9 | +LL | if let Some(x) = &Some(3) { + | - help: consider changing this to be a mutable reference: `&mut` LL | *x += 1; //~ ERROR cannot assign to immutable - | ^^^^^^^ cannot mutate + | ^^^^^^^ -error[E0594]: cannot assign to immutable item `*x` +error[E0594]: cannot assign to data in a `&` reference --> $DIR/enum.rs:29:9 | +LL | while let Some(x) = &Some(3) { + | - help: consider changing this to be a mutable reference: `&mut` LL | *x += 1; //~ ERROR cannot assign to immutable - | ^^^^^^^ cannot mutate + | ^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr index 7138c4ac06e1f..3ee4dc07bb8bb 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr @@ -1,20 +1,26 @@ -error[E0594]: cannot assign to immutable item `*n` +error[E0594]: cannot assign to data in a `&` reference --> $DIR/explicit-mut.rs:17:13 | +LL | Some(n) => { + | - help: consider changing this to be a mutable reference: `&mut` LL | *n += 1; //~ ERROR cannot assign to immutable - | ^^^^^^^ cannot mutate + | ^^^^^^^ -error[E0594]: cannot assign to immutable item `*n` +error[E0594]: cannot assign to data in a `&` reference --> $DIR/explicit-mut.rs:25:13 | +LL | Some(n) => { + | - help: consider changing this to be a mutable reference: `&mut` LL | *n += 1; //~ ERROR cannot assign to immutable - | ^^^^^^^ cannot mutate + | ^^^^^^^ -error[E0594]: cannot assign to immutable item `*n` +error[E0594]: cannot assign to data in a `&` reference --> $DIR/explicit-mut.rs:33:13 | +LL | Some(n) => { + | - help: consider changing this to be a mutable reference: `&mut` LL | *n += 1; //~ ERROR cannot assign to immutable - | ^^^^^^^ cannot mutate + | ^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr index 505ee95088f55..26e9ea4dc0bc8 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr @@ -24,7 +24,7 @@ error[E0596]: cannot borrow immutable item `*f.f` as mutable LL | f.f.call_mut(()) | ^^^ cannot borrow as mutable | - = note: Value not mutable causing this error: `*f` + = note: the value which is causing this path not to be mutable is...: `*f` error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13 diff --git a/src/test/ui/span/borrowck-object-mutability.nll.stderr b/src/test/ui/span/borrowck-object-mutability.nll.stderr index 100b5ae150a7d..9b5e084bd3751 100644 --- a/src/test/ui/span/borrowck-object-mutability.nll.stderr +++ b/src/test/ui/span/borrowck-object-mutability.nll.stderr @@ -10,7 +10,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable LL | x.borrowed_mut(); //~ ERROR cannot borrow | ^ cannot borrow as mutable | - = note: Value not mutable causing this error: `x` + = note: the value which is causing this path not to be mutable is...: `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/span/destructor-restrictions.nll.stderr b/src/test/ui/span/destructor-restrictions.nll.stderr index e69de29bb2d1d..5de246cbb7341 100644 --- a/src/test/ui/span/destructor-restrictions.nll.stderr +++ b/src/test/ui/span/destructor-restrictions.nll.stderr @@ -0,0 +1,16 @@ +error[E0597]: `*a` does not live long enough + --> $DIR/destructor-restrictions.rs:18:10 + | +LL | *a.borrow() + 1 + | ^--------- + | | + | borrowed value does not live long enough + | borrow may end up in a temporary, created here +LL | }; //~^ ERROR `*a` does not live long enough + | -- temporary later dropped here, potentially using the reference + | | + | borrowed value only lives until here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr index e69de29bb2d1d..56f2d14390ecd 100644 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr +++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr @@ -0,0 +1,30 @@ +error[E0597]: `y` does not live long enough + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5 + | +LL | y.borrow().clone() + | ^--------- + | | + | borrowed value does not live long enough + | borrow may end up in a temporary, created here +LL | } + | - + | | + | borrowed value only lives until here + | temporary later dropped here, potentially using the reference + +error[E0597]: `y` does not live long enough + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9 + | +LL | y.borrow().clone() + | ^--------- + | | + | borrowed value does not live long enough + | borrow may end up in a temporary, created here +LL | }; + | -- temporary later dropped here, potentially using the reference + | | + | borrowed value only lives until here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/wf-method-late-bound-regions.nll.stderr b/src/test/ui/span/wf-method-late-bound-regions.nll.stderr index a175cf1b38a44..063ac376b05ec 100644 --- a/src/test/ui/span/wf-method-late-bound-regions.nll.stderr +++ b/src/test/ui/span/wf-method-late-bound-regions.nll.stderr @@ -1,14 +1,14 @@ -error: compilation successful - --> $DIR/wf-method-late-bound-regions.rs:25:1 +error[E0597]: `pointer` does not live long enough + --> $DIR/wf-method-late-bound-regions.rs:30:18 | -LL | / fn main() { #![rustc_error] // rust-lang/rust#49855 -LL | | let f = Foo(None); -LL | | let f2 = f; -LL | | let dangling = { -... | -LL | | println!("{}", dangling); -LL | | } - | |_^ +LL | f2.xmute(&pointer) + | ^^^^^^^^ borrowed value does not live long enough +LL | }; + | - borrowed value only lives until here +LL | //~^^ ERROR `pointer` does not live long enough +LL | println!("{}", dangling); + | -------- borrow later used here error: aborting due to previous error +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/wf-method-late-bound-regions.rs b/src/test/ui/span/wf-method-late-bound-regions.rs index 317cd395d0a73..d58c29d4a32d3 100644 --- a/src/test/ui/span/wf-method-late-bound-regions.rs +++ b/src/test/ui/span/wf-method-late-bound-regions.rs @@ -11,7 +11,7 @@ // A method's receiver must be well-formed, even if it has late-bound regions. // Because of this, a method's substs being well-formed does not imply that // the method's implied bounds are met. -#![feature(rustc_attrs)] + struct Foo<'b>(Option<&'b ()>); trait Bar<'b> { @@ -22,7 +22,7 @@ impl<'b> Bar<'b> for Foo<'b> { fn xmute<'a>(&'a self, u: &'b u32) -> &'a u32 { u } } -fn main() { #![rustc_error] // rust-lang/rust#49855 +fn main() { let f = Foo(None); let f2 = f; let dangling = { From 032081cdff1bf0a742e82e157e1e3bc4938750b0 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 18 Apr 2018 15:34:31 +0200 Subject: [PATCH 5/9] Trivial updates to `.nll.stderr` files post-rebase, reflecting s/-Znll/nll/ in messages. --- src/test/ui/borrowck/issue-45983.nll.stderr | 2 +- src/test/ui/borrowck/issue-7573.nll.stderr | 2 +- src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr | 2 +- src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr | 2 +- .../ui/borrowck/regions-escape-unboxed-closure.nll.stderr | 2 +- .../expect-region-supply-region.nll.stderr | 8 ++++---- .../E0621-does-not-trigger-for-closures.nll.stderr | 2 +- src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr | 2 +- src/test/ui/in-band-lifetimes/mismatched.nll.stderr | 4 ++-- src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr | 2 +- src/test/ui/issue-13058.nll.stderr | 4 ++-- .../42701_one_named_and_one_anonymous.nll.stderr | 2 +- ...urn-one-existing-name-early-bound-in-struct.nll.stderr | 2 +- .../ex1-return-one-existing-name-if-else-2.nll.stderr | 2 +- .../ex1-return-one-existing-name-if-else-3.nll.stderr | 2 +- ...turn-one-existing-name-if-else-using-impl-2.nll.stderr | 2 +- ...turn-one-existing-name-if-else-using-impl-3.nll.stderr | 2 +- ...return-one-existing-name-if-else-using-impl.nll.stderr | 2 +- .../ex1-return-one-existing-name-if-else.nll.stderr | 2 +- ...eturn-one-existing-name-return-type-is-anon.nll.stderr | 2 +- .../ex1-return-one-existing-name-self-is-anon.nll.stderr | 2 +- .../ex2a-push-one-existing-name-2.nll.stderr | 2 +- .../ex2a-push-one-existing-name-early-bound.nll.stderr | 2 +- .../ex2a-push-one-existing-name.nll.stderr | 2 +- .../ex2b-push-no-existing-names.nll.stderr | 2 +- .../ex2c-push-inference-variable.nll.stderr | 2 +- .../ex2d-push-inference-variable-2.nll.stderr | 2 +- .../ex2e-push-inference-variable-3.nll.stderr | 2 +- .../ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr | 2 +- .../ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr | 4 ++-- .../ex3-both-anon-regions-both-are-structs-2.nll.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs-3.nll.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs-4.nll.stderr | 2 +- ...regions-both-are-structs-earlybound-regions.nll.stderr | 2 +- ...-regions-both-are-structs-latebound-regions.nll.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs.nll.stderr | 2 +- .../ex3-both-anon-regions-latebound-regions.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-2.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-3.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-4.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct.nll.stderr | 2 +- .../ex3-both-anon-regions-return-type-is-anon.nll.stderr | 2 +- .../ex3-both-anon-regions-self-is-anon.nll.stderr | 2 +- .../ex3-both-anon-regions-using-fn-items.nll.stderr | 2 +- .../ex3-both-anon-regions-using-impl-items.nll.stderr | 2 +- .../ex3-both-anon-regions-using-trait-objects.nll.stderr | 2 +- .../ui/lifetime-errors/ex3-both-anon-regions.nll.stderr | 2 +- .../underscore-lifetime/dyn-trait-underscore.nll.stderr | 8 ++++---- 48 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr index d949ebae32557..1aec71fee347b 100644 --- a/src/test/ui/borrowck/issue-45983.nll.stderr +++ b/src/test/ui/borrowck/issue-45983.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/issue-45983.rs:17:27 | LL | give_any(|y| x = Some(y)); diff --git a/src/test/ui/borrowck/issue-7573.nll.stderr b/src/test/ui/borrowck/issue-7573.nll.stderr index c55c49604d008..84c6236eb0ae8 100644 --- a/src/test/ui/borrowck/issue-7573.nll.stderr +++ b/src/test/ui/borrowck/issue-7573.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/issue-7573.rs:27:31 | LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); diff --git a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr index d34a716bb2b30..ee3970aa8fd8f 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr +++ b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/regions-escape-bound-fn-2.rs:18:27 | LL | with_int(|y| x = Some(y)); diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr index b69c172bcdc23..07a4ab1dbb1ab 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr +++ b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/regions-escape-bound-fn.rs:18:22 | LL | with_int(|y| x = Some(y)); diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr index 788654a2ecc03..14c255ef52778 100644 --- a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr +++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/regions-escape-unboxed-closure.rs:16:27 | LL | with_int(&mut |y| x = Some(y)); diff --git a/src/test/ui/closure-expected-type/expect-region-supply-region.nll.stderr b/src/test/ui/closure-expected-type/expect-region-supply-region.nll.stderr index 18edf2addc53d..bbae80e16abde 100644 --- a/src/test/ui/closure-expected-type/expect-region-supply-region.nll.stderr +++ b/src/test/ui/closure-expected-type/expect-region-supply-region.nll.stderr @@ -1,22 +1,22 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/expect-region-supply-region.rs:28:13 | LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure | ^^^^^^^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/expect-region-supply-region.rs:38:13 | LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure | ^^^^^^^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/expect-region-supply-region.rs:47:33 | LL | closure_expecting_bound(|x: &'x u32| { | ^^^^^^^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/expect-region-supply-region.rs:52:13 | LL | f = Some(x); diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr index e9f0979569176..5ae6afa7b17e2 100644 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr b/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr index 34ee39c716402..ec8c4ecf10246 100644 --- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr +++ b/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/dyn-trait.rs:33:16 | LL | static_val(x); //~ ERROR cannot infer diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr index 0930583a7ee33..cd2ebc341ead1 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr @@ -1,10 +1,10 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/mismatched.rs:14:42 | LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required | ^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/mismatched.rs:16:46 | LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr index 5e42cab9974da..886e3834d1dca 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/mismatched_trait.rs:16:9 | LL | y //~ ERROR explicit lifetime required diff --git a/src/test/ui/issue-13058.nll.stderr b/src/test/ui/issue-13058.nll.stderr index 604ad38ad2340..146385f3de2d8 100644 --- a/src/test/ui/issue-13058.nll.stderr +++ b/src/test/ui/issue-13058.nll.stderr @@ -1,10 +1,10 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/issue-13058.rs:24:21 | LL | let cont_iter = cont.iter(); | ^^^^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/issue-13058.rs:24:26 | LL | let cont_iter = cont.iter(); diff --git a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr index 62ccea36bd344..d422a63bcad39 100644 --- a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr +++ b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/42701_one_named_and_one_anonymous.rs:20:9 | LL | &*x //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr index 78546594ef0dc..5451562cdfb40 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:21:21 | LL | other //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr index 11bb1df3c78aa..e1dfeb0ac6adb 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:16 | LL | if x > y { x } else { y } //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr index a619e6ca964cd..1e45914138de5 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-if-else-3.rs:12:27 | LL | if x > y { x } else { y } //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr index 92245173ce859..e264b3428c95b 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:15 | LL | if x > y { x } else { y } //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr index 32ef068b8b9bb..6119f3c560538 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:36 | LL | if true { &self.field } else { x } //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr index fd10b0d338cb3..71e9c34ac2b97 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:20 | LL | if x > y { x } else { y } //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr index f17b24a0aca9c..5e49e4ec4a98b 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-if-else.rs:12:27 | LL | if x > y { x } else { y } //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr index b1663fe5eb654..6c16d6a608ec8 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5 | LL | x //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr index 19b8bd2f780f0..6dc96ace4d0d3 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30 | LL | if true { x } else { self } //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr index 0b34e464b4b0f..a51d9307d074d 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex2a-push-one-existing-name-2.rs:16:12 | LL | y.push(x); //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr index 212b39966aae8..c5f3510fa0ed2 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex2a-push-one-existing-name-early-bound.rs:17:12 | LL | x.push(y); //~ ERROR explicit lifetime required diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr index ad39028154ad8..e50fd74faf4ba 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex2a-push-one-existing-name.rs:16:12 | LL | x.push(y); //~ ERROR explicit lifetime diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr index 34daea7c9f46f..283192c684392 100644 --- a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex2b-push-no-existing-names.rs:16:12 | LL | x.push(y); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr index 96baa5c8ad2a8..2ca202b402cee 100644 --- a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex2c-push-inference-variable.rs:16:13 | LL | let z = Ref { data: y.data }; diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr index e5d47689b4948..712c25f8929d4 100644 --- a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex2d-push-inference-variable-2.rs:17:13 | LL | let b = Ref { data: y.data }; diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr index 668752f8e0296..351966902a4fb 100644 --- a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex2e-push-inference-variable-3.rs:17:13 | LL | let b = Ref { data: y.data }; diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr index 452342497117a..871a0b109b4aa 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-2.rs:12:9 | LL | v = x; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr index 581088a9258a7..102981977e557 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr @@ -1,10 +1,10 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-3.rs:12:13 | LL | z.push((x,y)); //~ ERROR lifetime mismatch | ^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-3.rs:12:15 | LL | z.push((x,y)); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr index b15f5f4a0fcaf..191389b7706e1 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:11 | LL | x.b = y.b; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr index 0ec73c2e77815..159367cc9d2a6 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:11 | LL | x.a = x.b; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr index 727a701d3f252..3bbcbdd6681fd 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11 | LL | x.a = x.b; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr index f010c87377ed7..9d1f6a3e36f1b 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:18:12 | LL | x.push(y); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr index 2b48b176ae898..5df93fd5547c7 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:15:12 | LL | x.push(y); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr index c9ac04cb01e5f..cd602cf950b18 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:12 | LL | x.push(y); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr index 9c7fc8ac45863..52c90839c32af 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:12 | LL | x.push(y); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr index 85a0b7c134556..9d6d68f518d72 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:9 | LL | y = x.b; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr index 4e160001b8739..e7fb67f117f88 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:11 | LL | y.b = x; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr index 7bbc3c4084f04..af9e3a42664cf 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11 | LL | y.b = x; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr index 9fd7bbac247aa..5437beaab6511 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:11 | LL | x.b = y; //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr index 528a846991c04..42e1d42a32ccd 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5 | LL | x //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr index f8c0b5940c95b..26b0488cfdc61 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19 | LL | if true { x } else { self } //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr index 284f760435cfa..f58f33c9a9adb 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11:10 | LL | y.push(z); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr index 389549a8464b7..4d54f6fe0375c 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-using-impl-items.rs:15:16 | LL | x.push(y); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr index 185ea89275f35..4bfb4ac2833c8 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:10 | LL | y.push(z); //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr index 629a97ab5ca5c..c25eedc770d48 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr @@ -1,4 +1,4 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/ex3-both-anon-regions.rs:12:12 | LL | x.push(y); //~ ERROR lifetime mismatch diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr index f8ea891914ec6..10a03786d7b1f 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr @@ -1,22 +1,22 @@ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/dyn-trait-underscore.rs:20:14 | LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime | ^^^^^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/dyn-trait-underscore.rs:20:20 | LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime | ^^^^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/dyn-trait-underscore.rs:20:5 | LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime | ^^^^^^^^ -warning: not reporting region error due to -Znll +warning: not reporting region error due to nll --> $DIR/dyn-trait-underscore.rs:20:5 | LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime From 699c98ec6ae1f0ebfc84a94a5b815ba4134d5267 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 18 Apr 2018 15:30:38 +0200 Subject: [PATCH 6/9] Removed `.nll.stderr` files that currently match their corresponding `.stderr` files. --- .../borrowck-closures-two-mut.nll.stderr | 78 ------------------- src/test/ui/issue-45697-1.nll.stderr | 34 -------- src/test/ui/issue-46471-1.nll.stderr | 28 ------- 3 files changed, 140 deletions(-) delete mode 100644 src/test/ui/borrowck/borrowck-closures-two-mut.nll.stderr delete mode 100644 src/test/ui/issue-45697-1.nll.stderr delete mode 100644 src/test/ui/issue-46471-1.nll.stderr diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.nll.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut.nll.stderr deleted file mode 100644 index a21a6e36778c5..0000000000000 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.nll.stderr +++ /dev/null @@ -1,78 +0,0 @@ -error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:24:24 - | -LL | let c1 = to_fn_mut(|| x = 4); - | -- - previous borrow occurs due to use of `x` in closure - | | - | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once - | ^^ - borrow occurs due to use of `x` in closure - | | - | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once -LL | } - | - first borrow ends here - -error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:35:24 - | -LL | let c1 = to_fn_mut(|| set(&mut x)); - | -- - previous borrow occurs due to use of `x` in closure - | | - | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once - | ^^ - borrow occurs due to use of `x` in closure - | | - | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once -LL | } - | - first borrow ends here - -error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:42:24 - | -LL | let c1 = to_fn_mut(|| x = 5); - | -- - previous borrow occurs due to use of `x` in closure - | | - | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once - | ^^ - borrow occurs due to use of `x` in closure - | | - | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once -LL | } - | - first borrow ends here - -error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:49:24 - | -LL | let c1 = to_fn_mut(|| x = 5); - | -- - previous borrow occurs due to use of `x` in closure - | | - | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) - | ^^ - borrow occurs due to use of `x` in closure - | | - | second mutable borrow occurs here -... -LL | } - | - first borrow ends here - -error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:61:24 - | -LL | let c1 = to_fn_mut(|| set(&mut *x.f)); - | -- - previous borrow occurs due to use of `x` in closure - | | - | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut *x.f)); - | ^^ - borrow occurs due to use of `x` in closure - | | - | second mutable borrow occurs here -... -LL | } - | - first borrow ends here - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/issue-45697-1.nll.stderr b/src/test/ui/issue-45697-1.nll.stderr deleted file mode 100644 index cf108691a0e4f..0000000000000 --- a/src/test/ui/issue-45697-1.nll.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast) - --> $DIR/issue-45697-1.rs:30:9 - | -LL | let z = copy_borrowed_ptr(&mut y); - | - borrow of `*y.pointer` occurs here -LL | *y.pointer += 1; - | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here - -error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir) - --> $DIR/issue-45697-1.rs:30:9 - | -LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `y` occurs here -LL | *y.pointer += 1; - | ^^^^^^^^^^^^^^^ use of borrowed `y` -... -LL | *z.pointer += 1; - | --------------- borrow later used here - -error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir) - --> $DIR/issue-45697-1.rs:30:9 - | -LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `*y.pointer` occurs here -LL | *y.pointer += 1; - | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here -... -LL | *z.pointer += 1; - | --------------- borrow later used here - -error: aborting due to 3 previous errors - -Some errors occurred: E0503, E0506. -For more information about an error, try `rustc --explain E0503`. diff --git a/src/test/ui/issue-46471-1.nll.stderr b/src/test/ui/issue-46471-1.nll.stderr deleted file mode 100644 index 0108056bc7278..0000000000000 --- a/src/test/ui/issue-46471-1.nll.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0597]: `z` does not live long enough (Ast) - --> $DIR/issue-46471-1.rs:16:14 - | -LL | &mut z - | ^ borrowed value does not live long enough -LL | }; - | - `z` dropped here while still borrowed -... -LL | } - | - borrowed value needs to live until here - -error[E0597]: `z` does not live long enough (Mir) - --> $DIR/issue-46471-1.rs:16:9 - | -LL | let y = { - | _____________- -LL | | let mut z = 0; -LL | | &mut z - | | ^^^^^^ borrowed value does not live long enough -LL | | }; - | | - - | | | - | |_____borrowed value only lives until here - | borrow later used here - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. From a771b0f07538ccfc58a07207be6a5e5519c58fe2 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 18 Apr 2018 14:22:08 +0200 Subject: [PATCH 7/9] Work around rust-lang/rust#49998 with experimental code that does less updating of cause map. This seems to avoid poor scaling on src/test/ui/span/dropck_vec_cycle_checked.rs --- src/librustc/session/config.rs | 2 ++ .../borrow_check/nll/region_infer/values.rs | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 59823390a0a58..2e6689efee572 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1259,6 +1259,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, useful for profiling / PGO."), relro_level: Option = (None, parse_relro_level, [TRACKED], "choose which RELRO level to use"), + nll_subminimal_causes: bool = (false, parse_bool, [UNTRACKED], + "when tracking region error causes, accept subminimal results for faster execution."), disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED], "disable user provided type assertion in NLL"), trans_time_graph: bool = (false, parse_bool, [UNTRACKED], diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs index 2f0b4c24bd6f1..d15d85792d99d 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs @@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::IndexVec; use rustc::mir::{BasicBlock, Location, Mir}; -use rustc::ty::RegionVid; +use rustc::ty::{self, RegionVid}; use syntax::codemap::Span; use super::{Cause, CauseExt, TrackCauses}; @@ -263,7 +263,17 @@ impl RegionValues { if let Some(causes) = &mut self.causes { let cause = make_cause(causes); let old_cause = causes.get_mut(&(r, i)).unwrap(); - if cause < **old_cause { + // #49998: compare using root cause alone to avoid + // useless traffic from similar outlives chains. + + let overwrite = if ty::tls::with(|tcx| { + tcx.sess.opts.debugging_opts.nll_subminimal_causes + }) { + cause.root_cause() < old_cause.root_cause() + } else { + cause < **old_cause + }; + if overwrite { *old_cause = Rc::new(cause); return true; } 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 8/9] 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 41edd04c92e8c..b7f8b85f46cee 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 0560900e85855..ece58d21ba932 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 63b0ab52d395a..a6bc8da6f7c0c 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 From 33bcb4ed16b01abeaa762c99e452da82c9c6275f Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 18 Apr 2018 14:41:29 +0200 Subject: [PATCH 9/9] When running under compare-mode=nll, generate expected output to `foo.nll.stderr` This allows easy revision of the update-references.sh script (included here) so that it can update the expected output for nll rather than stderr. It also reminds the rustc developer via the filename that they are looking at output generated under comapre-mode=nll. One could argue that there is still a problem with the strategy encoded here: if we reach a scenario where a change to the compiler brings the output under AST and NLL modes back into sync, this code will continue to still generate output to distinct `foo.stderr` and `foo.nll.stderr` files, and will continue to copy those two files back to corresponding distinct files in the source tree, even if the *content* of the two files is now the same. * Arguably the "right thing" to do in that case is to remove the `foo.nll.stderr` file entirely. * However, I think the real answer is that we will probably want to double-check such cases by hand anyway. We should be regularly double-checking the diffs between `foo.stderr` and `foo.nll.stderr`, and if we see a zero-diff case, then we should evaluate whether that is correct, and if so, remove the file by hand.) * In any case, I think the default behavior encoded here (or at least *intended* to be encoded here) is superior to the alternative of *only* generating a `foo.nll.stderr` file if one already existed in the source tree at the time that `compiletest` was invoked (and otherwise unconditionally generating a `foo.stderr` file, as was the behavior prior to this commit), because that alternative is more likely to cause rustc developers to overwrite a `foo.stderr` file with the stderr output from a compare-mode=nll run, which will then break the *normal* `compiletest` run and probably be much more confusing for the average rustc developer. --- src/test/ui/update-references.sh | 6 ++++++ src/tools/compiletest/src/runtest.rs | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/test/ui/update-references.sh b/src/test/ui/update-references.sh index c2c842fcc4984..cfe9a43707cf6 100755 --- a/src/test/ui/update-references.sh +++ b/src/test/ui/update-references.sh @@ -33,6 +33,7 @@ shift while [[ "$1" != "" ]]; do STDERR_NAME="${1/%.rs/.stderr}" + STDERR_NLL_NAME="${1/%.rs/.nll.stderr}" STDOUT_NAME="${1/%.rs/.stdout}" shift if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ @@ -45,4 +46,9 @@ while [[ "$1" != "" ]]; do echo updating $MYDIR/$STDERR_NAME cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME fi + if [ -f $BUILD_DIR/$STDERR_NLL_NAME ] && \ + ! (diff $BUILD_DIR/$STDERR_NLL_NAME $MYDIR/$STDERR_NLL_NAME >& /dev/null); then + echo updating $MYDIR/$STDERR_NLL_NAME + cp $BUILD_DIR/$STDERR_NLL_NAME $MYDIR/$STDERR_NLL_NAME + fi done diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index e79aefb723614..c16dbd0272a76 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2811,7 +2811,7 @@ impl<'test> TestCx<'test> { normalized } - fn load_expected_output(&self, kind: &str) -> String { + fn expected_output_path(&self, kind: &str) -> PathBuf { let mut path = expected_output_path(&self.testpaths, self.revision, &self.config.compare_mode, @@ -2822,6 +2822,11 @@ impl<'test> TestCx<'test> { path = expected_output_path(&self.testpaths, self.revision, &None, kind); } + path + } + + fn load_expected_output(&self, kind: &str) -> String { + let path = self.expected_output_path(kind); if path.exists() { match self.load_expected_output_from_path(&path) { Ok(x) => x, @@ -2875,7 +2880,8 @@ impl<'test> TestCx<'test> { } } - let output_file = self.output_base_name().with_extension(kind); + let expected_output_path = self.expected_output_path(kind); + let output_file = self.output_base_name().with_file_name(&expected_output_path); match File::create(&output_file).and_then(|mut f| f.write_all(actual.as_bytes())) { Ok(()) => {} Err(e) => self.fatal(&format!(