diff --git a/src/test/codegen/enum-debug-niche-2.rs b/src/test/codegen/enum-debug-niche-2.rs index aa6cbf66b4aa3..0f17976ef4965 100644 --- a/src/test/codegen/enum-debug-niche-2.rs +++ b/src/test/codegen/enum-debug-niche-2.rs @@ -13,7 +13,6 @@ // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}} #![feature(never_type)] -#![feature(nll)] #[derive(Copy, Clone)] pub struct Entity { diff --git a/src/test/incremental/hashes/closure_expressions.rs b/src/test/incremental/hashes/closure_expressions.rs index 5bfd540eca63e..5165f9821fd88 100644 --- a/src/test/incremental/hashes/closure_expressions.rs +++ b/src/test/incremental/hashes/closure_expressions.rs @@ -49,14 +49,14 @@ pub fn add_parameter() { // Change parameter pattern ---------------------------------------------------- #[cfg(cfail1)] pub fn change_parameter_pattern() { - let _ = |x: &u32| x; + let _ = |x: (u32,)| x; } #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody, mir_built, typeck_tables_of")] #[rustc_clean(cfg="cfail3")] pub fn change_parameter_pattern() { - let _ = |&x: &u32| x; + let _ = |(x,): (u32,)| x; } diff --git a/src/test/mir-opt/remove_fake_borrows.rs b/src/test/mir-opt/remove_fake_borrows.rs index 144348450a91b..8348f9a774678 100644 --- a/src/test/mir-opt/remove_fake_borrows.rs +++ b/src/test/mir-opt/remove_fake_borrows.rs @@ -2,8 +2,6 @@ // ignore-wasm32-bare -#![feature(nll)] - fn match_guard(x: Option<&&i32>, c: bool) -> i32 { match x { Some(0) if c => 0, diff --git a/src/test/run-fail/issue-51345.rs b/src/test/run-fail/issue-51345.rs index 3c7f6a68db545..c62f98ea78d1e 100644 --- a/src/test/run-fail/issue-51345.rs +++ b/src/test/run-fail/issue-51345.rs @@ -1,7 +1,5 @@ // error-pattern: thread 'main' panicked at 'explicit panic' -#![feature(nll)] - fn main() { let mut vec = vec![]; vec.push((vec.len(), panic!())); diff --git a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs index c953bed26f491..96d2663500ef0 100644 --- a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs +++ b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs @@ -3,8 +3,6 @@ #![allow(unused_variables)] // Test case from #39963. -#![feature(nll)] - #[derive(Clone)] struct Foo(Option>, Option>); diff --git a/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs b/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs index 8f0434c0e2b58..fd0e346e2b42d 100644 --- a/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs +++ b/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(nll)] #![deny(unused_mut)] #[derive(Debug)] diff --git a/src/test/run-pass/borrowck/two-phase-bin-ops.rs b/src/test/run-pass/borrowck/two-phase-bin-ops.rs index 5e1d436e31bf2..1242ae307d39c 100644 --- a/src/test/run-pass/borrowck/two-phase-bin-ops.rs +++ b/src/test/run-pass/borrowck/two-phase-bin-ops.rs @@ -1,8 +1,4 @@ // run-pass -// revisions: lxl nll - -#![cfg_attr(nll, feature(nll))] - use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign}; use std::ops::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssign}; diff --git a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs index 68f7dfd38f4f4..48362d0bb6282 100644 --- a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs +++ b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs @@ -5,7 +5,6 @@ // See further discussion on rust-lang/rust#24535, // rust-lang/rfcs#1006, and rust-lang/rfcs#107 -#![feature(nll)] #![feature(bind_by_move_pattern_guards)] fn main() { diff --git a/src/test/run-pass/issues/issue-48962.rs b/src/test/run-pass/issues/issue-48962.rs index 7c644789834d4..80d815379bec2 100644 --- a/src/test/run-pass/issues/issue-48962.rs +++ b/src/test/run-pass/issues/issue-48962.rs @@ -1,7 +1,6 @@ // run-pass #![allow(unused_must_use)] // Test that we are able to reinitialize box with moved referent -#![feature(nll)] static mut ORDER: [usize; 3] = [0, 0, 0]; static mut INDEX: usize = 0; diff --git a/src/test/run-pass/issues/issue-51345.rs b/src/test/run-pass/issues/issue-51345.rs index 29a0a328503e1..15571e8bf5b28 100644 --- a/src/test/run-pass/issues/issue-51345.rs +++ b/src/test/run-pass/issues/issue-51345.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unreachable_code)] -#![feature(nll)] fn main() { let mut v = Vec::new(); diff --git a/src/test/run-pass/nll/issue-47153-generic-const.rs b/src/test/run-pass/nll/issue-47153-generic-const.rs index 4f021fda4e344..9f4d57111bbe9 100644 --- a/src/test/run-pass/nll/issue-47153-generic-const.rs +++ b/src/test/run-pass/nll/issue-47153-generic-const.rs @@ -3,7 +3,6 @@ // Regression test for #47153: constants in a generic context (such as // a trait) used to ICE. -#![feature(nll)] #![allow(warnings)] trait Foo { diff --git a/src/test/run-pass/nll/issue-47589.rs b/src/test/run-pass/nll/issue-47589.rs index 5bbed3a85904c..280bf081138cc 100644 --- a/src/test/run-pass/nll/issue-47589.rs +++ b/src/test/run-pass/nll/issue-47589.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(nll)] - pub struct DescriptorSet<'a> { pub slots: Vec> } diff --git a/src/test/run-pass/nll/issue-48623-closure.rs b/src/test/run-pass/nll/issue-48623-closure.rs index 5a41fff11a1f0..3f8587eed41b9 100644 --- a/src/test/run-pass/nll/issue-48623-closure.rs +++ b/src/test/run-pass/nll/issue-48623-closure.rs @@ -2,8 +2,6 @@ #![allow(path_statements)] #![allow(dead_code)] -#![feature(nll)] - struct WithDrop; impl Drop for WithDrop { diff --git a/src/test/run-pass/nll/issue-48623-generator.rs b/src/test/run-pass/nll/issue-48623-generator.rs index b404daca72568..ba3eccff495e5 100644 --- a/src/test/run-pass/nll/issue-48623-generator.rs +++ b/src/test/run-pass/nll/issue-48623-generator.rs @@ -2,7 +2,6 @@ #![allow(path_statements)] #![allow(dead_code)] -#![feature(nll)] #![feature(generators, generator_trait)] struct WithDrop; diff --git a/src/test/run-pass/nll/issue-50343.rs b/src/test/run-pass/nll/issue-50343.rs index 8d2992b3b4f88..55a2d231e19ff 100644 --- a/src/test/run-pass/nll/issue-50343.rs +++ b/src/test/run-pass/nll/issue-50343.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(nll)] #![deny(unused_mut)] fn main() { diff --git a/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs b/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs index dc5257cfb9225..69d7cdd83a6a1 100644 --- a/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs +++ b/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(nll)] #![deny(unused_mut)] struct Foo { diff --git a/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs index c3f818812aa5f..941c9eeb411d9 100644 --- a/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs +++ b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(nll)] #![allow(unused_variables)] pub trait TryTransform { diff --git a/src/test/run-pass/nll/mutating_references.rs b/src/test/run-pass/nll/mutating_references.rs index 0af8751494e0d..eb46b30b6b94a 100644 --- a/src/test/run-pass/nll/mutating_references.rs +++ b/src/test/run-pass/nll/mutating_references.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(nll)] - struct List { value: T, next: Option>>, diff --git a/src/test/run-pass/nll/process_or_insert_default.rs b/src/test/run-pass/nll/process_or_insert_default.rs index e9cd4014bc351..84ac9bbd0ddc4 100644 --- a/src/test/run-pass/nll/process_or_insert_default.rs +++ b/src/test/run-pass/nll/process_or_insert_default.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(nll)] - use std::collections::HashMap; fn process_or_insert_default(map: &mut HashMap, key: usize) { diff --git a/src/test/run-pass/nll/rc-loop.rs b/src/test/run-pass/nll/rc-loop.rs index a4ef546c25f4a..e59303d1f788f 100644 --- a/src/test/run-pass/nll/rc-loop.rs +++ b/src/test/run-pass/nll/rc-loop.rs @@ -6,8 +6,6 @@ // `x`. The lexical checker makes this very painful. The NLL checker // does not. -#![feature(nll)] - use std::rc::Rc; #[derive(Debug, PartialEq, Eq)] diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr new file mode 100644 index 0000000000000..ca99304f9b4a0 --- /dev/null +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29 + | +LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>( + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let z: I::A = if cond { x } else { y }; + | ^ assignment requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40 + | +LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>( + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let z: I::A = if cond { x } else { y }; + | ^ assignment requires that `'b` must outlive `'a` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr new file mode 100644 index 0000000000000..d8506b9c8c81c --- /dev/null +++ b/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/associated-types-subtyping-1.rs:24:12 + | +LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T) + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let a: >::Type = make_any(); + | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/associated-types-subtyping-1.rs:35:13 + | +LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T) + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _c: >::Type = b; + | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr new file mode 100644 index 0000000000000..779e6dac92e25 --- /dev/null +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/project-fn-ret-contravariant.rs:45:4 + | +LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | (a, b) + | ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: lifetime may not live long enough + --> $DIR/project-fn-ret-contravariant.rs:45:4 + | +LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | (a, b) + | ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr new file mode 100644 index 0000000000000..f532c96ed2cc7 --- /dev/null +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/project-fn-ret-contravariant.rs:38:4 + | +LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | bar(foo, x) + | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr new file mode 100644 index 0000000000000..c45082fb0538f --- /dev/null +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/project-fn-ret-invariant.rs:55:4 + | +LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | (a, b) + | ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: lifetime may not live long enough + --> $DIR/project-fn-ret-invariant.rs:55:4 + | +LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | (a, b) + | ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr new file mode 100644 index 0000000000000..2c11e7ffe930d --- /dev/null +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/project-fn-ret-invariant.rs:38:12 + | +LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let f = foo; // <-- No consistent type can be inferred for `f` here. +LL | let a = bar(f, x); + | ^^^^^^^^^ argument requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/project-fn-ret-invariant.rs:39:12 + | +LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let b = bar(f, y); + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr new file mode 100644 index 0000000000000..8be0ad6e88f3a --- /dev/null +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/project-fn-ret-invariant.rs:48:4 + | +LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> { + | -- lifetime `'a` defined here +... +LL | bar(foo, x) + | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr new file mode 100644 index 0000000000000..f66994b3f100a --- /dev/null +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr @@ -0,0 +1,40 @@ +error[E0503]: cannot use `y` because it was mutably borrowed + --> $DIR/borrowck-anon-fields-variant.rs:17:7 + | +LL | Foo::Y(ref mut a, _) => a, + | --------- borrow of `y.0` occurs here +... +LL | Foo::Y(_, ref mut b) => b, + | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0` +... +LL | *a += 1; + | ------- borrow later used here + +error[E0503]: cannot use `y` because it was mutably borrowed + --> $DIR/borrowck-anon-fields-variant.rs:37:7 + | +LL | Foo::Y(ref mut a, _) => a, + | --------- borrow of `y.0` occurs here +... +LL | Foo::Y(ref mut b, _) => b, + | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0` +... +LL | *a += 1; + | ------- borrow later used here + +error[E0499]: cannot borrow `y.0` as mutable more than once at a time + --> $DIR/borrowck-anon-fields-variant.rs:37:14 + | +LL | Foo::Y(ref mut a, _) => a, + | --------- first mutable borrow occurs here +... +LL | Foo::Y(ref mut b, _) => b, + | ^^^^^^^^^ second mutable borrow occurs here +... +LL | *a += 1; + | ------- first borrow later used here + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0499, E0503. +For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr new file mode 100644 index 0000000000000..f1e1ae18839c4 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.nll.stderr @@ -0,0 +1,366 @@ +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-describe-lvalue.rs:262:13 + | +LL | let y = &mut x; + | ------ first mutable borrow occurs here +LL | &mut x; + | ^^^^^^ second mutable borrow occurs here +LL | *y = 1; + | ------ first borrow later used here + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-describe-lvalue.rs:272:20 + | +LL | let y = &mut x; + | ------ first mutable borrow occurs here +LL | &mut x; + | ^^^^^^ second mutable borrow occurs here +LL | *y = 1; + | ------ first borrow later used here + +error: captured variable cannot escape `FnMut` closure body + --> $DIR/borrowck-describe-lvalue.rs:270:16 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | / || { +LL | | let y = &mut x; +LL | | &mut x; +LL | | *y = 1; +LL | | drop(y); +LL | | } + | |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error[E0503]: cannot use `f.x` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:41:9 + | +LL | let x = f.x(); + | - borrow of `f` occurs here +LL | f.x; + | ^^^ use of borrowed `f` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `g.0` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:48:9 + | +LL | let x = g.x(); + | - borrow of `g` occurs here +LL | g.0; + | ^^^ use of borrowed `g` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `h.0` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:55:9 + | +LL | let x = &mut h.0; + | -------- borrow of `h.0` occurs here +LL | h.0; + | ^^^ use of borrowed `h.0` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `e.0` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:63:20 + | +LL | let x = e.x(); + | - borrow of `e` occurs here +LL | match e { +LL | Baz::X(value) => value + | ^^^^^ use of borrowed `e` +LL | }; +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `u.a` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:71:9 + | +LL | let x = &mut u.a; + | -------- borrow of `u.a` occurs here +LL | u.a; + | ^^^ use of borrowed `u.a` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `f.x` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:78:9 + | +LL | let x = f.x(); + | - borrow of `*f` occurs here +LL | f.x; + | ^^^ use of borrowed `*f` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `g.0` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:85:9 + | +LL | let x = g.x(); + | - borrow of `*g` occurs here +LL | g.0; + | ^^^ use of borrowed `*g` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `h.0` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:92:9 + | +LL | let x = &mut h.0; + | -------- borrow of `h.0` occurs here +LL | h.0; + | ^^^ use of borrowed `h.0` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `e.0` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:100:20 + | +LL | let x = e.x(); + | - borrow of `*e` occurs here +LL | match *e { +LL | Baz::X(value) => value + | ^^^^^ use of borrowed `*e` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `u.a` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:109:9 + | +LL | let x = &mut u.a; + | -------- borrow of `u.a` occurs here +LL | u.a; + | ^^^ use of borrowed `u.a` +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:117:15 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +LL | match v { +LL | &[x, _, .., _, _] => println!("{}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:122:18 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +... +LL | &[_, x, .., _, _] => println!("{}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:127:25 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +... +LL | &[_, _, .., x, _] => println!("{}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:132:28 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +... +LL | &[_, _, .., _, x] => println!("{}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:143:15 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +LL | match v { +LL | &[x..] => println!("{:?}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:148:18 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +... +LL | &[_, x..] => println!("{:?}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:153:15 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +... +LL | &[x.., _] => println!("{:?}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[..]` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:158:18 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +... +LL | &[_, x.., _] => println!("{:?}", x), + | ^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `e` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:171:13 + | +LL | let x = &mut e; + | ------ borrow of `e` occurs here +LL | match e { +LL | E::A(ref ax) => + | ^^^^^^^^^^^^ use of borrowed `e` +... +LL | drop(x); + | - borrow later used here + +error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-describe-lvalue.rs:171:18 + | +LL | let x = &mut e; + | ------ mutable borrow occurs here +LL | match e { +LL | E::A(ref ax) => + | ^^^^^^ immutable borrow occurs here +... +LL | drop(x); + | - mutable borrow later used here + +error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-describe-lvalue.rs:175:23 + | +LL | let x = &mut e; + | ------ mutable borrow occurs here +... +LL | E::B { x: ref bx } => + | ^^^^^^ immutable borrow occurs here +... +LL | drop(x); + | - mutable borrow later used here + +error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-describe-lvalue.rs:188:22 + | +LL | let x = &mut s; + | ------ mutable borrow occurs here +LL | match s { +LL | S { y: (ref y0, _), .. } => + | ^^^^^^ immutable borrow occurs here +... +LL | drop(x); + | - mutable borrow later used here + +error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-describe-lvalue.rs:194:28 + | +LL | let x = &mut s; + | ------ mutable borrow occurs here +... +LL | S { x: F { y: ref x0, .. }, .. } => + | ^^^^^^ immutable borrow occurs here +... +LL | drop(x); + | - mutable borrow later used here + +error[E0503]: cannot use `*v` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:240:9 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +LL | v[0].y; + | ^^^^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0503]: cannot use `v[_].y` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:240:9 + | +LL | let x = &mut v; + | ------ borrow of `v` occurs here +LL | v[0].y; + | ^^^^^^ use of borrowed `v` +... +LL | drop(x); + | - borrow later used here + +error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-describe-lvalue.rs:251:24 + | +LL | let x = &mut v; + | ------ mutable borrow occurs here +LL | match v { +LL | &[_, F {x: ref xf, ..}] => println!("{}", xf), + | ^^^^^^ immutable borrow occurs here +... +LL | drop(x); + | - mutable borrow later used here + +error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-describe-lvalue.rs:210:29 + | +LL | let x = &mut block; + | ---------- mutable borrow occurs here +LL | let p: &'a u8 = &*block.current; + | ^^^^^^^^^^^^^^^ immutable borrow occurs here +... +LL | drop(x); + | - mutable borrow later used here + +error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-describe-lvalue.rs:227:33 + | +LL | let x = &mut block; + | ---------- mutable borrow occurs here +LL | let p : *const u8 = &*(*block).current; + | ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here +... +LL | drop(x); + | - mutable borrow later used here + +error[E0382]: use of moved value: `x` + --> $DIR/borrowck-describe-lvalue.rs:282:22 + | +LL | drop(x); + | - value moved here +LL | drop(x); + | ^ value used here after move + | + = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait + +error: aborting due to 32 previous errors + +Some errors have detailed explanations: E0382, E0499, E0502, E0503. +For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr new file mode 100644 index 0000000000000..3468f29fb1a23 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr @@ -0,0 +1,27 @@ +error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-for-loop-head-linkage.rs:7:9 + | +LL | for &x in &vector { + | ------- + | | + | immutable borrow occurs here + | immutable borrow later used here +LL | let cap = vector.capacity(); +LL | vector.extend(repeat(0)); + | ^^^^^^ mutable borrow occurs here + +error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-for-loop-head-linkage.rs:8:9 + | +LL | for &x in &vector { + | ------- + | | + | immutable borrow occurs here + | immutable borrow later used here +... +LL | vector[1] = 5; + | ^^^^^^ mutable borrow occurs here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/borrowck/borrowck-issue-48962.rs b/src/test/ui/borrowck/borrowck-issue-48962.rs index e7df319a0bb70..86061c8cd6e87 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.rs +++ b/src/test/ui/borrowck/borrowck-issue-48962.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Node { elem: i32, next: Option>, diff --git a/src/test/ui/borrowck/borrowck-issue-48962.stderr b/src/test/ui/borrowck/borrowck-issue-48962.stderr index a5462b4139685..ee174f6736e1e 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.stderr +++ b/src/test/ui/borrowck/borrowck-issue-48962.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `src` - --> $DIR/borrowck-issue-48962.rs:16:5 + --> $DIR/borrowck-issue-48962.rs:14:5 | LL | let mut src = &mut node; | ------- move occurs because `src` has type `&mut Node`, which does not implement the `Copy` trait @@ -9,7 +9,7 @@ LL | src.next = None; | ^^^^^^^^ value used here after move error[E0382]: use of moved value: `src` - --> $DIR/borrowck-issue-48962.rs:22:5 + --> $DIR/borrowck-issue-48962.rs:20:5 | LL | let mut src = &mut (22, 44); | ------- move occurs because `src` has type `&mut (i32, i32)`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr new file mode 100644 index 0000000000000..7e4a6322d5f5c --- /dev/null +++ b/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr @@ -0,0 +1,41 @@ +error[E0302]: cannot assign in a pattern guard + --> $DIR/borrowck-mutate-in-guard.rs:10:25 + | +LL | Enum::A(_) if { x = Enum::B(false); false } => 1, + | ^^^^^^^^^^^^^^^^^^ assignment in pattern guard + +error[E0301]: cannot mutably borrow in a pattern guard + --> $DIR/borrowck-mutate-in-guard.rs:15:38 + | +LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, + | ^ borrowed mutably in pattern guard + | + = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable + +error[E0302]: cannot assign in a pattern guard + --> $DIR/borrowck-mutate-in-guard.rs:15:41 + | +LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, + | ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard + +error[E0510]: cannot assign `x` in match guard + --> $DIR/borrowck-mutate-in-guard.rs:10:25 + | +LL | match x { + | - value is immutable in match guard +LL | Enum::A(_) if { x = Enum::B(false); false } => 1, + | ^^^^^^^^^^^^^^^^^^ cannot assign + +error[E0510]: cannot mutably borrow `x` in match guard + --> $DIR/borrowck-mutate-in-guard.rs:15:33 + | +LL | match x { + | - value is immutable in match guard +... +LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, + | ^^^^^^ cannot mutably borrow + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0301, E0302, E0510. +For more information about an error, try `rustc --explain E0301`. diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr new file mode 100644 index 0000000000000..49c3f861ea993 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr @@ -0,0 +1,23 @@ +error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-object-lifetime.rs:20:13 + | +LL | let y = x.borrowed(); + | - immutable borrow occurs here +LL | let z = x.mut_borrowed(); + | ^ mutable borrow occurs here +LL | y.use_ref(); + | - immutable borrow later used here + +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-object-lifetime.rs:26:13 + | +LL | let y = x.borrowed(); + | - immutable borrow occurs here +LL | let z = &mut x; + | ^^^^^^ mutable borrow occurs here +LL | y.use_ref(); + | - immutable borrow later used here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr new file mode 100644 index 0000000000000..e6d0f88e3ea8b --- /dev/null +++ b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:9:5 + | +LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | S { pointer: &mut *p.pointer } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/issue-10876.rs b/src/test/ui/borrowck/issue-10876.rs index d8fff5f17760a..20ab905fec46e 100644 --- a/src/test/ui/borrowck/issue-10876.rs +++ b/src/test/ui/borrowck/issue-10876.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(nll)] - enum Nat { S(Box), Z diff --git a/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs b/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs index a8bfdbad38ba4..7d5acb95751ed 100644 --- a/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs +++ b/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs @@ -8,8 +8,6 @@ // run-pass -#![feature(nll)] - fn foo(x: &mut Result<(u32, u32), (u32, u32)>) -> u32 { match *x { Ok((ref mut v, _)) | Err((_, ref mut v)) if *v > 0 => { *v } diff --git a/src/test/ui/borrowck/issue-52713-bug.rs b/src/test/ui/borrowck/issue-52713-bug.rs index 460e6b4bbae4d..671e83dfadc8b 100644 --- a/src/test/ui/borrowck/issue-52713-bug.rs +++ b/src/test/ui/borrowck/issue-52713-bug.rs @@ -2,8 +2,6 @@ // computing liveness that wound up accidentally causing the program // below to be accepted. -#![feature(nll)] - fn foo<'a>(x: &'a mut u32) -> u32 { let mut x = 22; let y = &x; diff --git a/src/test/ui/borrowck/issue-52713-bug.stderr b/src/test/ui/borrowck/issue-52713-bug.stderr index e3216f5d33f98..4abb6fb2c7186 100644 --- a/src/test/ui/borrowck/issue-52713-bug.stderr +++ b/src/test/ui/borrowck/issue-52713-bug.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/issue-52713-bug.rs:14:5 + --> $DIR/issue-52713-bug.rs:12:5 | LL | let y = &x; | -- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs index ad4accbbeeef9..51df40016d8a7 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - #![allow(dead_code)] #[derive(Debug)] diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index 6a12016b2a5e3..519f1d6fb2791 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13 + --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:14:13 | LL | *array | ^^^^^^ diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs index 0f3f1a639f7e0..efa313a9d23f4 100644 --- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs @@ -1,19 +1,11 @@ -// ignore-compare-mode-nll - -// revisions: migrate nll - -#![cfg_attr(nll, feature(nll))] - fn main() { let mut greeting = "Hello world!".to_string(); let res = (|| (|| &greeting)())(); greeting = "DEALLOCATED".to_string(); - //[migrate]~^ ERROR cannot assign - //[nll]~^^ ERROR cannot assign + //~^ ERROR cannot assign drop(greeting); - //[migrate]~^ ERROR cannot move - //[nll]~^^ ERROR cannot move + //~^ ERROR cannot move println!("thread result: {:?}", res); } diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr similarity index 91% rename from src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr rename to src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr index efd4e1a1716d3..9b1d6fa7d3575 100644 --- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `greeting` because it is borrowed - --> $DIR/issue-58776-borrowck-scans-children.rs:11:5 + --> $DIR/issue-58776-borrowck-scans-children.rs:5:5 | LL | let res = (|| (|| &greeting)())(); | -- -------- borrow occurs due to use in closure @@ -13,7 +13,7 @@ LL | println!("thread result: {:?}", res); | --- borrow later used here error[E0505]: cannot move out of `greeting` because it is borrowed - --> $DIR/issue-58776-borrowck-scans-children.rs:14:10 + --> $DIR/issue-58776-borrowck-scans-children.rs:7:10 | LL | let res = (|| (|| &greeting)())(); | -- -------- borrow occurs due to use in closure diff --git a/src/test/ui/borrowck/issue-7573.nll.stderr b/src/test/ui/borrowck/issue-7573.nll.stderr new file mode 100644 index 0000000000000..0da715bbdb764 --- /dev/null +++ b/src/test/ui/borrowck/issue-7573.nll.stderr @@ -0,0 +1,14 @@ +error[E0521]: borrowed data escapes outside of closure + --> $DIR/issue-7573.rs:21:9 + | +LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); + | ---------------- `lines_to_use` is declared here, outside of the closure body +LL | +LL | let push_id = |installed_id: &CrateId| { + | ------------ `installed_id` is a reference that is only valid in the closure body +... +LL | lines_to_use.push(installed_id); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here + +error: aborting due to previous error + 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 new file mode 100644 index 0000000000000..4797a9d456cc1 --- /dev/null +++ b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr @@ -0,0 +1,12 @@ +error[E0521]: borrowed data escapes outside of closure + --> $DIR/regions-escape-bound-fn-2.rs:8:18 + | +LL | let mut x = None; + | ----- `x` is declared here, outside of the closure body +LL | with_int(|y| x = Some(y)); + | - ^^^^^^^^^^^ `y` escapes the closure body here + | | + | `y` is a reference that is only valid in the closure body + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr new file mode 100644 index 0000000000000..2b3a9816e454d --- /dev/null +++ b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr @@ -0,0 +1,12 @@ +error[E0521]: borrowed data escapes outside of closure + --> $DIR/regions-escape-bound-fn.rs:8:18 + | +LL | let mut x: Option<&isize> = None; + | ----- `x` is declared here, outside of the closure body +LL | with_int(|y| x = Some(y)); + | - ^^^^^^^^^^^ `y` escapes the closure body here + | | + | `y` is a reference that is only valid in the closure body + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr new file mode 100644 index 0000000000000..8ceefd25344a4 --- /dev/null +++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr @@ -0,0 +1,12 @@ +error[E0521]: borrowed data escapes outside of closure + --> $DIR/regions-escape-unboxed-closure.rs:6:23 + | +LL | let mut x: Option<&isize> = None; + | ----- `x` is declared here, outside of the closure body +LL | with_int(&mut |y| x = Some(y)); + | - ^^^^^^^^^^^ `y` escapes the closure body here + | | + | `y` is a reference that is only valid in the closure body + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/two-phase-across-loop.rs b/src/test/ui/borrowck/two-phase-across-loop.rs index b1a4c54f49b15..12222342c95a1 100644 --- a/src/test/ui/borrowck/two-phase-across-loop.rs +++ b/src/test/ui/borrowck/two-phase-across-loop.rs @@ -1,8 +1,6 @@ // Test that a borrow which starts as a 2-phase borrow and gets // carried around a loop winds up conflicting with itself. -#![feature(nll)] - struct Foo { x: String } impl Foo { diff --git a/src/test/ui/borrowck/two-phase-across-loop.stderr b/src/test/ui/borrowck/two-phase-across-loop.stderr index 933d3eb71117c..38993a50bf6b2 100644 --- a/src/test/ui/borrowck/two-phase-across-loop.stderr +++ b/src/test/ui/borrowck/two-phase-across-loop.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/two-phase-across-loop.rs:19:22 + --> $DIR/two-phase-across-loop.rs:17:22 | LL | strings.push(foo.get_string()); | ^^^ mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/two-phase-multi-mut.rs b/src/test/ui/borrowck/two-phase-multi-mut.rs index ed3d257da9f0f..bb646d7caf1e2 100644 --- a/src/test/ui/borrowck/two-phase-multi-mut.rs +++ b/src/test/ui/borrowck/two-phase-multi-mut.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Foo { } diff --git a/src/test/ui/borrowck/two-phase-multi-mut.stderr b/src/test/ui/borrowck/two-phase-multi-mut.stderr index c4168503e4cca..33fa4a3a15075 100644 --- a/src/test/ui/borrowck/two-phase-multi-mut.stderr +++ b/src/test/ui/borrowck/two-phase-multi-mut.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/two-phase-multi-mut.rs:13:5 + --> $DIR/two-phase-multi-mut.rs:11:5 | LL | foo.method(&mut foo); | ^^^^------^--------^ @@ -9,7 +9,7 @@ LL | foo.method(&mut foo); | second mutable borrow occurs here error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/two-phase-multi-mut.rs:13:16 + --> $DIR/two-phase-multi-mut.rs:11:16 | LL | foo.method(&mut foo); | --- ------ ^^^^^^^^ second mutable borrow occurs here diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr new file mode 100644 index 0000000000000..d2ea5ab2077e5 --- /dev/null +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.nll.stderr @@ -0,0 +1,36 @@ +error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable + --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:13:9 + | +LL | let shared = &v; + | -- immutable borrow occurs here +LL | +LL | v.push(shared.len()); + | ^ ------ immutable borrow later used here + | | + | mutable borrow occurs here + +error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable + --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:24:9 + | +LL | let shared = &v; + | -- immutable borrow occurs here +LL | +LL | v.push(shared.len()); + | ^ ------ immutable borrow later used here + | | + | mutable borrow occurs here + +error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable + --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:37:9 + | +LL | let shared = &v; + | -- immutable borrow occurs here +LL | +LL | v.push(shared.len()); + | ^ ------ immutable borrow later used here + | | + | mutable borrow occurs here + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/c-variadic/variadic-ffi-5.stderr b/src/test/ui/c-variadic/variadic-ffi-4.nll.stderr similarity index 65% rename from src/test/ui/c-variadic/variadic-ffi-5.stderr rename to src/test/ui/c-variadic/variadic-ffi-4.nll.stderr index 27421010a97c4..a1afbb06390f8 100644 --- a/src/test/ui/c-variadic/variadic-ffi-5.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-4.nll.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `ap` - --> $DIR/variadic-ffi-5.rs:11:5 + --> $DIR/variadic-ffi-4.rs:8:5 | LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { | --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>` @@ -7,7 +7,7 @@ LL | ap | ^^ lifetime `'a` required error[E0621]: explicit lifetime required in the type of `ap` - --> $DIR/variadic-ffi-5.rs:15:5 + --> $DIR/variadic-ffi-4.rs:12:5 | LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { | --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>` @@ -15,7 +15,7 @@ LL | ap | ^^ lifetime `'static` required error: lifetime may not live long enough - --> $DIR/variadic-ffi-5.rs:19:33 + --> $DIR/variadic-ffi-4.rs:16:33 | LL | let _ = ap.with_copy(|ap| { ap }); | --- ^^ returning this value requires that `'1` must outlive `'2` @@ -24,40 +24,48 @@ LL | let _ = ap.with_copy(|ap| { ap }); | has type `core::ffi::VaList<'1>` error: lifetime may not live long enough - --> $DIR/variadic-ffi-5.rs:23:5 + --> $DIR/variadic-ffi-4.rs:20:5 | -LL | pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) { - | --- ------- has type `core::ffi::VaList<'1>` +LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + | ------- ------- has type `core::ffi::VaList<'1>` | | | has type `&mut core::ffi::VaList<'2>` LL | *ap0 = ap1; | ^^^^^^^^^^ assignment requires that `'1` must outlive `'2` error: lifetime may not live long enough - --> $DIR/variadic-ffi-5.rs:27:5 + --> $DIR/variadic-ffi-4.rs:24:5 | -LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { - | ------- ------- has type `core::ffi::VaList<'2>` +LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { + | --- ------- has type `core::ffi::VaList<'2>` | | | has type `&mut core::ffi::VaList<'1>` LL | ap0 = &mut ap1; | ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` error: lifetime may not live long enough - --> $DIR/variadic-ffi-5.rs:27:5 + --> $DIR/variadic-ffi-4.rs:24:5 | -LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { - | ------- ------- has type `core::ffi::VaList<'1>` +LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { + | --- ------- has type `core::ffi::VaList<'1>` | | | has type `&mut core::ffi::VaList<'2>` LL | ap0 = &mut ap1; | ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` +error[E0384]: cannot assign to immutable argument `ap0` + --> $DIR/variadic-ffi-4.rs:24:5 + | +LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { + | --- help: make this binding mutable: `mut ap0` +LL | ap0 = &mut ap1; + | ^^^^^^^^^^^^^^ cannot assign to immutable argument + error[E0597]: `ap1` does not live long enough - --> $DIR/variadic-ffi-5.rs:27:11 + --> $DIR/variadic-ffi-4.rs:24:11 | -LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { - | - let's call the lifetime of this reference `'1` +LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { + | - let's call the lifetime of this reference `'1` LL | ap0 = &mut ap1; | ------^^^^^^^^ | | | @@ -67,7 +75,7 @@ LL | ap0 = &mut ap1; LL | } | - `ap1` dropped here while still borrowed -error: aborting due to 7 previous errors +error: aborting due to 8 previous errors -Some errors have detailed explanations: E0597, E0621. -For more information about an error, try `rustc --explain E0597`. +Some errors have detailed explanations: E0384, E0597, E0621. +For more information about an error, try `rustc --explain E0384`. diff --git a/src/test/ui/c-variadic/variadic-ffi-5.rs b/src/test/ui/c-variadic/variadic-ffi-5.rs deleted file mode 100644 index fcc80d9b0cca0..0000000000000 --- a/src/test/ui/c-variadic/variadic-ffi-5.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![crate_type="lib"] -#![no_std] -#![feature(c_variadic)] -// The tests in this file are similar to that of variadic-ffi-4, but this -// one enables nll. -#![feature(nll)] - -use core::ffi::VaList; - -pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { - ap //~ ERROR: explicit lifetime required -} - -pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { - ap //~ ERROR: explicit lifetime required -} - -pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) { - let _ = ap.with_copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough -} - -pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) { - *ap0 = ap1; //~ ERROR: lifetime may not live long enough -} - -pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { - ap0 = &mut ap1; - //~^ ERROR: lifetime may not live long enough - //~^^ ERROR: lifetime may not live long enough - //~^^^ ERROR: `ap1` does not live long enough -} diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr new file mode 100644 index 0000000000000..7e4ac4e8ce656 --- /dev/null +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr @@ -0,0 +1,53 @@ +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:30:5 + | +LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _` + | | + | expected signature of `fn(fn(&'a u32), &i32) -> _` + | +note: required by `with_closure_expecting_fn_with_free_region` + --> $DIR/expect-fn-supply-fn.rs:1:1 + | +LL | / fn with_closure_expecting_fn_with_free_region(_: F) +LL | | where F: for<'a> FnOnce(fn(&'a u32), &i32) +LL | | { +LL | | } + | |_^ + +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:37:5 + | +LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _` + | | + | expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _` + | +note: required by `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:6:1 + | +LL | / fn with_closure_expecting_fn_with_bound_region(_: F) +LL | | where F: FnOnce(fn(&u32), &i32) +LL | | { +LL | | } + | |_^ + +error[E0631]: type mismatch in closure arguments + --> $DIR/expect-fn-supply-fn.rs:46:5 + | +LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _` + | | + | expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _` + | +note: required by `with_closure_expecting_fn_with_bound_region` + --> $DIR/expect-fn-supply-fn.rs:6:1 + | +LL | / fn with_closure_expecting_fn_with_bound_region(_: F) +LL | | where F: FnOnce(fn(&u32), &i32) +LL | | { +LL | | } + | |_^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr new file mode 100644 index 0000000000000..1d12e2f585e8d --- /dev/null +++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr @@ -0,0 +1,37 @@ +error[E0621]: explicit lifetime required in the type of `x` + --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5 + | +LL | fn foo(x: &()) { + | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()` +LL | / bar(|| { +LL | | +LL | | let _ = x; +LL | | }) + | |______^ lifetime `'static` required + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9 + | +LL | bar(|| { + | ^^ may outlive borrowed value `x` +LL | +LL | let _ = x; + | - `x` is borrowed here + | +note: function requires argument type to outlive `'static` + --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5 + | +LL | / bar(|| { +LL | | +LL | | let _ = x; +LL | | }) + | |______^ +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +LL | bar(move || { + | ^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0373, E0621. +For more information about an error, try `rustc --explain E0373`. diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr new file mode 100644 index 0000000000000..bbf75302d564a --- /dev/null +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr @@ -0,0 +1,42 @@ +error[E0521]: borrowed data escapes outside of closure + --> $DIR/expect-region-supply-region.rs:18:9 + | +LL | let mut f: Option<&u32> = None; + | ----- `f` is declared here, outside of the closure body +LL | closure_expecting_bound(|x| { + | - `x` is a reference that is only valid in the closure body +LL | f = Some(x); + | ^^^^^^^^^^^ `x` escapes the closure body here + +error[E0521]: borrowed data escapes outside of closure + --> $DIR/expect-region-supply-region.rs:28:9 + | +LL | let mut f: Option<&u32> = None; + | ----- `f` is declared here, outside of the closure body +LL | closure_expecting_bound(|x: &u32| { + | - `x` is a reference that is only valid in the closure body +LL | f = Some(x); + | ^^^^^^^^^^^ `x` escapes the closure body here + +error: lifetime may not live long enough + --> $DIR/expect-region-supply-region.rs:37:30 + | +LL | fn expect_bound_supply_named<'x>() { + | -- lifetime `'x` defined here +... +LL | closure_expecting_bound(|x: &'x u32| { + | ^ - let's call the lifetime of this reference `'1` + | | + | requires that `'1` must outlive `'x` + +error: lifetime may not live long enough + --> $DIR/expect-region-supply-region.rs:37:30 + | +LL | fn expect_bound_supply_named<'x>() { + | -- lifetime `'x` defined here +... +LL | closure_expecting_bound(|x: &'x u32| { + | ^ requires that `'x` must outlive `'static` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs b/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs index 06b1727258dc2..34f61ed5a3474 100644 --- a/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs +++ b/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs @@ -1,7 +1,5 @@ // compile-pass -#![feature(nll)] - pub fn main() { let y: &'static mut [u8; 0] = &mut []; } diff --git a/src/test/ui/consts/const_let_refutable.nll.stderr b/src/test/ui/consts/const_let_refutable.nll.stderr new file mode 100644 index 0000000000000..30ab1f4d5ec0d --- /dev/null +++ b/src/test/ui/consts/const_let_refutable.nll.stderr @@ -0,0 +1,31 @@ +error[E0005]: refutable pattern in function argument: `&[]` not covered + --> $DIR/const_let_refutable.rs:3:16 + | +LL | const fn slice([a, b]: &[i32]) -> i32 { + | ^^^^^^ pattern `&[]` not covered + +error[E0723]: can only call other `const fn` within a `const fn`, but `const std::ops::Add::add` is not stable as `const fn` + --> $DIR/const_let_refutable.rs:4:5 + | +LL | a + b + | ^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0381]: use of possibly uninitialized variable: `a` + --> $DIR/const_let_refutable.rs:4:5 + | +LL | a + b + | ^ use of possibly uninitialized `a` + +error[E0381]: use of possibly uninitialized variable: `b` + --> $DIR/const_let_refutable.rs:4:9 + | +LL | a + b + | ^ use of possibly uninitialized `b` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0005, E0381, E0723. +For more information about an error, try `rustc --explain E0005`. diff --git a/src/test/ui/consts/issue-54224.rs b/src/test/ui/consts/issue-54224.rs index b5a8fe8819cdd..f1947933d6707 100644 --- a/src/test/ui/consts/issue-54224.rs +++ b/src/test/ui/consts/issue-54224.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); //~ ERROR temporary value dropped while borrowed use std::borrow::Cow; diff --git a/src/test/ui/consts/issue-54224.stderr b/src/test/ui/consts/issue-54224.stderr index 9b6638b228e75..8dcb4daca3b70 100644 --- a/src/test/ui/consts/issue-54224.stderr +++ b/src/test/ui/consts/issue-54224.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-54224.rs:3:39 + --> $DIR/issue-54224.rs:1:39 | LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); | ------^^^^^^^^^- @@ -9,7 +9,7 @@ LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); | using this value as a constant requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-54224.rs:11:57 + --> $DIR/issue-54224.rs:9:57 | LL | pub const Z: Cow<'static, [ [u8; 3] ]> = Cow::Borrowed(&[*b"ABC"]); | ---------------^^^^^^^^^- diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr new file mode 100644 index 0000000000000..8d962384a121a --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -0,0 +1,328 @@ +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/min_const_fn.rs:37:25 + | +LL | const fn into_inner(self) -> T { self.0 } + | ^^^^ constant functions cannot evaluate destructors + +error[E0723]: mutable references in const fn are unstable + --> $DIR/min_const_fn.rs:39:36 + | +LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/min_const_fn.rs:44:28 + | +LL | const fn into_inner_lt(self) -> T { self.0 } + | ^^^^ constant functions cannot evaluate destructors + +error[E0723]: mutable references in const fn are unstable + --> $DIR/min_const_fn.rs:46:42 + | +LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/min_const_fn.rs:51:27 + | +LL | const fn into_inner_s(self) -> T { self.0 } + | ^^^^ constant functions cannot evaluate destructors + +error[E0723]: mutable references in const fn are unstable + --> $DIR/min_const_fn.rs:53:38 + | +LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: mutable references in const fn are unstable + --> $DIR/min_const_fn.rs:58:39 + | +LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:76:16 + | +LL | const fn foo11(t: T) -> T { t } + | ^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:78:18 + | +LL | const fn foo11_2(t: T) -> T { t } + | ^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: only int, `bool` and `char` operations are stable in const fn + --> $DIR/min_const_fn.rs:80:33 + | +LL | const fn foo19(f: f32) -> f32 { f * 2.0 } + | ^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: only int, `bool` and `char` operations are stable in const fn + --> $DIR/min_const_fn.rs:82:35 + | +LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f } + | ^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: only int and `bool` operations are stable in const fn + --> $DIR/min_const_fn.rs:84:35 + | +LL | const fn foo19_3(f: f32) -> f32 { -f } + | ^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: only int, `bool` and `char` operations are stable in const fn + --> $DIR/min_const_fn.rs:86:43 + | +LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } + | ^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: cannot access `static` items in const fn + --> $DIR/min_const_fn.rs:90:27 + | +LL | const fn foo25() -> u32 { BAR } + | ^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: cannot access `static` items in const fn + --> $DIR/min_const_fn.rs:91:36 + | +LL | const fn foo26() -> &'static u32 { &BAR } + | ^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:92:42 + | +LL | const fn foo30(x: *const u32) -> usize { x as usize } + | ^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:94:63 + | +LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } } + | ^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:96:42 + | +LL | const fn foo30_2(x: *mut u32) -> usize { x as usize } + | ^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:98:63 + | +LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } } + | ^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn + --> $DIR/min_const_fn.rs:100:38 + | +LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn + --> $DIR/min_const_fn.rs:102:29 + | +LL | const fn foo30_5(b: bool) { while b { } } + | ^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn + --> $DIR/min_const_fn.rs:104:44 + | +LL | const fn foo36(a: bool, b: bool) -> bool { a && b } + | ^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn + --> $DIR/min_const_fn.rs:106:44 + | +LL | const fn foo37(a: bool, b: bool) -> bool { a || b } + | ^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: mutable references in const fn are unstable + --> $DIR/min_const_fn.rs:108:14 + | +LL | const fn inc(x: &mut i32) { *x += 1 } + | ^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:113:6 + | +LL | impl Foo { + | ^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:118:6 + | +LL | impl Foo { + | ^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:123:6 + | +LL | impl Foo { + | ^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: `impl Trait` in const fn is unstable + --> $DIR/min_const_fn.rs:129:24 + | +LL | const fn no_rpit2() -> AlanTuring { AlanTuring(0) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:131:34 + | +LL | const fn no_apit2(_x: AlanTuring) {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:133:22 + | +LL | const fn no_apit(_x: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: `impl Trait` in const fn is unstable + --> $DIR/min_const_fn.rs:134:23 + | +LL | const fn no_rpit() -> impl std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:135:23 + | +LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} + | ^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:136:32 + | +LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0515]: cannot return reference to temporary value + --> $DIR/min_const_fn.rs:136:63 + | +LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } + | ^-- + | || + | |temporary value created here + | returns a reference to data owned by the current function + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn.rs:144:41 + | +LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: function pointers in const fn are unstable + --> $DIR/min_const_fn.rs:147:21 + | +LL | const fn no_fn_ptrs(_x: fn()) {} + | ^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: function pointers in const fn are unstable + --> $DIR/min_const_fn.rs:149:27 + | +LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } + | ^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error: aborting due to 37 previous errors + +Some errors have detailed explanations: E0515, E0723. +For more information about an error, try `rustc --explain E0515`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr new file mode 100644 index 0000000000000..9ffb549057bc6 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr @@ -0,0 +1,31 @@ +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn_dyn.rs:9:5 + | +LL | x.0.field; + | ^^^^^^^^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable + --> $DIR/min_const_fn_dyn.rs:12:66 + | +LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } + | ^^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add #![feature(const_fn)] to the crate attributes to enable + +error[E0716]: temporary value dropped while borrowed + --> $DIR/min_const_fn_dyn.rs:12:67 + | +LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } + | -^ - temporary value is freed at the end of this statement + | || + | |creates a temporary which is freed while still in use + | cast requires that borrow lasts for `'static` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0716, E0723. +For more information about an error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/promote_evaluation_unused_result.rs b/src/test/ui/consts/promote_evaluation_unused_result.rs index d199e34775e4b..dc21b9fe8cd1b 100644 --- a/src/test/ui/consts/promote_evaluation_unused_result.rs +++ b/src/test/ui/consts/promote_evaluation_unused_result.rs @@ -1,7 +1,5 @@ //compile-pass -#![feature(nll)] - fn main() { let _: &'static usize = &(loop {}, 1).1; diff --git a/src/test/ui/consts/promote_fn_calls.rs b/src/test/ui/consts/promote_fn_calls.rs index 045322de34708..6b6eea36361bf 100644 --- a/src/test/ui/consts/promote_fn_calls.rs +++ b/src/test/ui/consts/promote_fn_calls.rs @@ -1,8 +1,6 @@ // compile-pass // aux-build:promotable_const_fn_lib.rs -#![feature(nll)] - extern crate promotable_const_fn_lib; use promotable_const_fn_lib::{foo, Foo}; diff --git a/src/test/ui/consts/promote_fn_calls_std.rs b/src/test/ui/consts/promote_fn_calls_std.rs index 0350708d673d7..d982f350208e2 100644 --- a/src/test/ui/consts/promote_fn_calls_std.rs +++ b/src/test/ui/consts/promote_fn_calls_std.rs @@ -1,7 +1,5 @@ // compile-pass -#![feature(nll)] - fn main() { let x: &'static u8 = &u8::max_value(); let x: &'static u16 = &u16::max_value(); diff --git a/src/test/ui/continue-after-missing-main.nll.stderr b/src/test/ui/continue-after-missing-main.nll.stderr new file mode 100644 index 0000000000000..aceabf3316479 --- /dev/null +++ b/src/test/ui/continue-after-missing-main.nll.stderr @@ -0,0 +1,7 @@ +error[E0601]: `main` function not found in crate `continue_after_missing_main` + | + = note: consider adding a `main` function to `$DIR/continue-after-missing-main.rs` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/empty/empty-never-array.nll.stderr b/src/test/ui/empty/empty-never-array.nll.stderr new file mode 100644 index 0000000000000..01ee1c3a4d7fa --- /dev/null +++ b/src/test/ui/empty/empty-never-array.nll.stderr @@ -0,0 +1,23 @@ +error[E0005]: refutable pattern in local binding: `T(_, _)` not covered + --> $DIR/empty-never-array.rs:10:9 + | +LL | / enum Helper { +LL | | T(T, [!; 0]), +LL | | #[allow(dead_code)] +LL | | U(U), +LL | | } + | |_- `Helper` defined here +... +LL | let Helper::U(u) = Helper::T(t, []); + | ^^^^^^^^^^^^ pattern `T(_, _)` not covered + +error[E0381]: use of possibly uninitialized variable: `u` + --> $DIR/empty-never-array.rs:12:5 + | +LL | u + | ^ use of possibly uninitialized `u` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0005, E0381. +For more information about an error, try `rustc --explain E0005`. diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr new file mode 100644 index 0000000000000..e5671ee49e654 --- /dev/null +++ b/src/test/ui/error-codes/E0502.nll.stderr @@ -0,0 +1,13 @@ +error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable + --> $DIR/E0502.rs:4:9 + | +LL | let ref y = a; + | ----- immutable borrow occurs here +LL | bar(a); + | ^ mutable borrow occurs here +LL | y.use_ref(); + | - immutable borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. 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 new file mode 100644 index 0000000000000..5140d1a9a7add --- /dev/null +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45 + | +LL | invoke(&x, |a, b| if a > b { a } else { b }); + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 i32 + | has type `&'1 i32` + +error: aborting due to previous error + diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr new file mode 100644 index 0000000000000..f316644156dc5 --- /dev/null +++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.nll.stderr @@ -0,0 +1,18 @@ +error: at least one trait must be specified + --> $DIR/generic_type_does_not_live_long_enough.rs:9:35 + | +LL | existential type WrongGeneric: 'static; + | ^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 + | +LL | let z: i32 = x; + | ^ expected i32, found opaque type + | + = note: expected type `i32` + found type `WrongGeneric::<&{integer}>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/generator/auto-trait-regions.nll.stderr b/src/test/ui/generator/auto-trait-regions.nll.stderr new file mode 100644 index 0000000000000..4c157a05a5e05 --- /dev/null +++ b/src/test/ui/generator/auto-trait-regions.nll.stderr @@ -0,0 +1,41 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:44:24 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary which is freed while still in use +LL | yield; +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:44:35 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary which is freed while still in use +LL | yield; +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error: higher-ranked subtype error + --> $DIR/auto-trait-regions.rs:30:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/auto-trait-regions.rs:48:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/generator/generator-region-requirements.rs b/src/test/ui/generator/generator-region-requirements.rs index cd9abaae056c1..41cb339f45911 100644 --- a/src/test/ui/generator/generator-region-requirements.rs +++ b/src/test/ui/generator/generator-region-requirements.rs @@ -1,8 +1,4 @@ -// revisions: migrate nll -// ignore-compare-mode-nll - #![feature(generators, generator_trait)] -#![cfg_attr(nll, feature(nll))] use std::ops::{Generator, GeneratorState}; use std::pin::Pin; @@ -14,8 +10,7 @@ fn dangle(x: &mut i32) -> &'static mut i32 { loop { match Pin::new(&mut g).resume() { GeneratorState::Complete(c) => return c, -//[nll]~^ ERROR explicit lifetime required -//[migrate]~^^ ERROR explicit lifetime required + //~^ ERROR explicit lifetime required GeneratorState::Yielded(_) => (), } } diff --git a/src/test/ui/generator/generator-region-requirements.nll.stderr b/src/test/ui/generator/generator-region-requirements.stderr similarity index 90% rename from src/test/ui/generator/generator-region-requirements.nll.stderr rename to src/test/ui/generator/generator-region-requirements.stderr index 8a96d187f6b1c..53d48bc4f56ac 100644 --- a/src/test/ui/generator/generator-region-requirements.nll.stderr +++ b/src/test/ui/generator/generator-region-requirements.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/generator-region-requirements.rs:16:51 + --> $DIR/generator-region-requirements.rs:12:51 | LL | fn dangle(x: &mut i32) -> &'static mut i32 { | -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32` diff --git a/src/test/ui/generator/generator-with-nll.rs b/src/test/ui/generator/generator-with-nll.rs index 87afa57ab5198..cee3e6d226c12 100644 --- a/src/test/ui/generator/generator-with-nll.rs +++ b/src/test/ui/generator/generator-with-nll.rs @@ -1,5 +1,4 @@ #![feature(generators)] -#![feature(nll)] fn main() { || { diff --git a/src/test/ui/generator/generator-with-nll.stderr b/src/test/ui/generator/generator-with-nll.stderr index bd5abb202068c..14199aeb93056 100644 --- a/src/test/ui/generator/generator-with-nll.stderr +++ b/src/test/ui/generator/generator-with-nll.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/generator-with-nll.rs:8:17 + --> $DIR/generator-with-nll.rs:7:17 | LL | let b = &mut true; | ^^^^^^^^^ diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr new file mode 100644 index 0000000000000..312a91adca678 --- /dev/null +++ b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr @@ -0,0 +1,15 @@ +error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable + --> $DIR/hashmap-iter-value-lifetime.rs:7:5 + | +LL | let (_, thing) = my_stuff.iter().next().unwrap(); + | -------- immutable borrow occurs here +LL | +LL | my_stuff.clear(); + | ^^^^^^^^ mutable borrow occurs here +LL | +LL | println!("{}", *thing); + | ------ immutable borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr new file mode 100644 index 0000000000000..aa8e890c168dc --- /dev/null +++ b/src/test/ui/hashmap-lifetimes.nll.stderr @@ -0,0 +1,13 @@ +error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable + --> $DIR/hashmap-lifetimes.rs:6:5 + | +LL | let mut it = my_stuff.iter(); + | -------- immutable borrow occurs here +LL | my_stuff.insert(1, 43); + | ^^^^^^^^ mutable borrow occurs here +LL | it; + | -- immutable borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr new file mode 100644 index 0000000000000..070fe12a2849f --- /dev/null +++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr @@ -0,0 +1,30 @@ +error: lifetime may not live long enough + --> $DIR/hr-subtype.rs:33:13 + | +LL | fn subtype<'x,'y:'x,'z:'y>() { + | -- -- lifetime `'y` defined here + | | + | lifetime `'x` defined here +LL | gimme::<$t2>(None::<$t1>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y` +... +LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>), +LL | | fn(Inv<'y>)) } + | |__________________________________________________- in this macro invocation + +error: lifetime may not live long enough + --> $DIR/hr-subtype.rs:39:13 + | +LL | fn supertype<'x,'y:'x,'z:'y>() { + | -- -- lifetime `'y` defined here + | | + | lifetime `'x` defined here +LL | gimme::<$t1>(None::<$t2>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y` +... +LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>), +LL | | fn(Inv<'y>)) } + | |__________________________________________________- in this macro invocation + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr new file mode 100644 index 0000000000000..e140eaadd48a5 --- /dev/null +++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr @@ -0,0 +1,16 @@ +error: lifetime may not live long enough + --> $DIR/hr-subtype.rs:39:13 + | +LL | fn supertype<'x,'y:'x,'z:'y>() { + | -- -- lifetime `'y` defined here + | | + | lifetime `'x` defined here +LL | gimme::<$t1>(None::<$t2>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y` +... +LL | / check! { free_x_vs_free_y: (fn(&'x u32), +LL | | fn(&'y u32)) } + | |__________________________________________- in this macro invocation + +error: aborting due to previous error + diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr b/src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr new file mode 100644 index 0000000000000..4de35d70c30a3 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-cache-issue-54302.nll.stderr @@ -0,0 +1,8 @@ +error: higher-ranked subtype error + --> $DIR/hrtb-cache-issue-54302.rs:19:5 + | +LL | assert_deserialize_owned::<&'static str>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr new file mode 100644 index 0000000000000..0522fc45d68f0 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr @@ -0,0 +1,77 @@ +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:22:1 + | +LL | / fn no_hrtb<'b,T>(mut t: T) +LL | | where T : Bar<&'b isize> +LL | | { +LL | | // OK -- `T : Bar<&'b isize>`, and thus the impl above ensures that +LL | | // `&mut T : Bar<&'b isize>`. +LL | | no_hrtb(&mut t); + | | --------------- recursive call site +LL | | } + | |_^ cannot return without recursing + | + = note: #[warn(unconditional_recursion)] on by default + = help: a `loop` may express intention better if this is on purpose + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:30:1 + | +LL | / fn bar_hrtb(mut t: T) +LL | | where T : for<'b> Bar<&'b isize> +LL | | { +LL | | // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above +... | +LL | | bar_hrtb(&mut t); + | | ---------------- recursive call site +LL | | } + | |_^ cannot return without recursing + | + = help: a `loop` may express intention better if this is on purpose + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:39:1 + | +LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T) +LL | | where T : for<'a> Foo<&'a isize> + Bar<&'b isize> +LL | | { +LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also +... | +LL | | foo_hrtb_bar_not(&mut t); + | | ------------------------ recursive call site +LL | | } + | |_^ cannot return without recursing + | + = help: a `loop` may express intention better if this is on purpose + +error: higher-ranked subtype error + --> $DIR/hrtb-perfect-forwarding.rs:46:5 + | +LL | foo_hrtb_bar_not(&mut t); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: lifetime may not live long enough + --> $DIR/hrtb-perfect-forwarding.rs:46:5 + | +LL | fn foo_hrtb_bar_not<'b,T>(mut t: T) + | -- lifetime `'b` defined here +... +LL | foo_hrtb_bar_not(&mut t); + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:49:1 + | +LL | / fn foo_hrtb_bar_hrtb(mut t: T) +LL | | where T : for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize> +LL | | { +LL | | // OK -- now we have `T : for<'b> Bar&'b isize>`. +LL | | foo_hrtb_bar_hrtb(&mut t); + | | ------------------------- recursive call site +LL | | } + | |_^ cannot return without recursing + | + = help: a `loop` may express intention better if this is on purpose + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr new file mode 100644 index 0000000000000..da30997a23111 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr @@ -0,0 +1,10 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/dyn-trait.rs:20:5 + | +LL | fn with_dyn_debug_static<'a>(x: Box) { + | - `x` is a reference that is only valid in the function body +LL | static_val(x); + | ^^^^^^^^^^^^^ `x` escapes the function body here + +error: aborting due to previous error + diff --git a/src/test/ui/impl-trait/closure-calling-parent-fn.rs b/src/test/ui/impl-trait/closure-calling-parent-fn.rs index cb5f78bd6fc0f..58d7875ccd034 100644 --- a/src/test/ui/impl-trait/closure-calling-parent-fn.rs +++ b/src/test/ui/impl-trait/closure-calling-parent-fn.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // Regression test for #54593: the MIR type checker was going wrong // when a closure returns the `impl Copy` from its parent fn. It was // (incorrectly) replacing the `impl Copy` in its return type with the diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr new file mode 100644 index 0000000000000..4b7c04f1e4331 --- /dev/null +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr @@ -0,0 +1,51 @@ +error: lifetime may not live long enough + --> $DIR/must_outlive_least_region_or_bound.rs:3:23 + | +LL | fn elided(x: &i32) -> impl Copy { x } + | - ^^^^^^^^^ opaque type requires that `'1` must outlive `'static` + | | + | let's call the lifetime of this reference `'1` +help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint + | +LL | fn elided(x: &i32) -> impl Copy + '_ { x } + | ^^^^^^^^^^^^^^ + +error: lifetime may not live long enough + --> $DIR/must_outlive_least_region_or_bound.rs:6:32 + | +LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } + | -- ^^^^^^^^^ opaque type requires that `'a` must outlive `'static` + | | + | lifetime `'a` defined here +help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint + | +LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x } + | ^^^^^^^^^^^^^^ + +error: lifetime may not live long enough + --> $DIR/must_outlive_least_region_or_bound.rs:12:69 + | +LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } + | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` + +error: lifetime may not live long enough + --> $DIR/must_outlive_least_region_or_bound.rs:17:61 + | +LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { + | -- -- lifetime `'b` defined here ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a` + | | + | lifetime `'a` defined here + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/must_outlive_least_region_or_bound.rs:22:51 + | +LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs index cb40d90ae551a..adaa474474f67 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs @@ -9,7 +9,6 @@ #![allow(dead_code)] #![feature(in_band_lifetimes)] -#![feature(nll)] fn foo(x: &'x u32) -> impl Fn() -> &'y u32 where 'x: 'y diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs index e2310a3907f7e..204c2ff304114 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs @@ -9,7 +9,6 @@ #![allow(dead_code)] #![feature(in_band_lifetimes)] -#![feature(nll)] trait Trait<'a> { } diff --git a/src/test/ui/impl-trait/region-escape-via-bound.rs b/src/test/ui/impl-trait/region-escape-via-bound.rs index d62aec800e8ce..29243699e44fd 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound.rs @@ -5,7 +5,6 @@ #![allow(dead_code)] #![feature(in_band_lifetimes)] -#![feature(nll)] use std::cell::Cell; diff --git a/src/test/ui/impl-trait/region-escape-via-bound.stderr b/src/test/ui/impl-trait/region-escape-via-bound.stderr index 81b44b7eba7fd..5c8e322f712d1 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.stderr +++ b/src/test/ui/impl-trait/region-escape-via-bound.stderr @@ -1,11 +1,11 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/region-escape-via-bound.rs:16:29 + --> $DIR/region-escape-via-bound.rs:15:29 | LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> | ^^^^^^^^^^^^^^ | -note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 18:7 - --> $DIR/region-escape-via-bound.rs:18:7 +note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 17:7 + --> $DIR/region-escape-via-bound.rs:17:7 | LL | where 'x: 'y | ^^ diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr new file mode 100644 index 0000000000000..0bf120cf7ecc1 --- /dev/null +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr @@ -0,0 +1,26 @@ +error: lifetime may not live long enough + --> $DIR/static-return-lifetime-infered.rs:6:35 + | +LL | fn iter_values_anon(&self) -> impl Iterator { + | - ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static` + | | + | let's call the lifetime of this reference `'1` +help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint + | +LL | fn iter_values_anon(&self) -> impl Iterator + '_ { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: lifetime may not live long enough + --> $DIR/static-return-lifetime-infered.rs:10:37 + | +LL | fn iter_values<'a>(&'a self) -> impl Iterator { + | -- ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static` + | | + | lifetime `'a` defined here +help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint + | +LL | fn iter_values<'a>(&'a self) -> impl Iterator + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr new file mode 100644 index 0000000000000..039cb62f86656 --- /dev/null +++ b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr @@ -0,0 +1,11 @@ +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/type_parameters_captured.rs:7:20 + | +LL | fn foo(x: T) -> impl Any + 'static { + | ^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr new file mode 100644 index 0000000000000..f5aee2d2d7e5c --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr @@ -0,0 +1,20 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $DIR/mismatched.rs:4:42 + | +LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } + | ---- ^ lifetime `'a` required + | | + | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` + +error: lifetime may not live long enough + --> $DIR/mismatched.rs:6:46 + | +LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } + | -- -- ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | | | + | | lifetime `'b` defined here + | lifetime `'a` defined here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr new file mode 100644 index 0000000000000..cd65bab2d4668 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr @@ -0,0 +1,24 @@ +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements + --> $DIR/mismatched_trait_impl.rs:9:5 + | +LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5... + --> $DIR/mismatched_trait_impl.rs:9:5 + | +LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { +LL | | x +LL | | } + | |_____^ +note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32... + --> $DIR/mismatched_trait_impl.rs:9:32 + | +LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { + | ^^ + = note: ...so that the method type is compatible with trait: + expected fn(&i32, &'a u32, &u32) -> &'a u32 + found fn(&i32, &u32, &u32) -> &u32 + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr new file mode 100644 index 0000000000000..45f29fd79565b --- /dev/null +++ b/src/test/ui/issues/issue-10291.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-10291.rs:3:9 + | +LL | fn test<'x>(x: &'x isize) { + | -- lifetime `'x` defined here +LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { +LL | x + | ^ returning this value requires that `'x` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-13058.nll.stderr b/src/test/ui/issues/issue-13058.nll.stderr new file mode 100644 index 0000000000000..8368978deab1a --- /dev/null +++ b/src/test/ui/issues/issue-13058.nll.stderr @@ -0,0 +1,12 @@ +error[E0621]: explicit lifetime required in the type of `cont` + --> $DIR/issue-13058.rs:14:21 + | +LL | fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool + | -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T` +LL | { +LL | let cont_iter = cont.iter(); + | ^^^^^^^^^^^ lifetime `'r` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/issues/issue-15034.nll.stderr b/src/test/ui/issues/issue-15034.nll.stderr new file mode 100644 index 0000000000000..f142e260a2313 --- /dev/null +++ b/src/test/ui/issues/issue-15034.nll.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `lexer` + --> $DIR/issue-15034.rs:17:9 + | +LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { + | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>` +LL | Parser { lexer: lexer } + | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/issues/issue-15381.nll.stderr b/src/test/ui/issues/issue-15381.nll.stderr new file mode 100644 index 0000000000000..a8495846b3610 --- /dev/null +++ b/src/test/ui/issues/issue-15381.nll.stderr @@ -0,0 +1,16 @@ +error[E0005]: refutable pattern in `for` loop binding: `&[]` not covered + --> $DIR/issue-15381.rs:4:9 + | +LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { + | ^^^^^^^^ pattern `&[]` not covered + +error[E0381]: borrow of possibly uninitialized variable: `y` + --> $DIR/issue-15381.rs:6:26 + | +LL | println!("y={}", y); + | ^ use of possibly uninitialized `y` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0005, E0381. +For more information about an error, try `rustc --explain E0005`. diff --git a/src/test/ui/issues/issue-16683.nll.stderr b/src/test/ui/issues/issue-16683.nll.stderr new file mode 100644 index 0000000000000..ea6b69d1a76c6 --- /dev/null +++ b/src/test/ui/issues/issue-16683.nll.stderr @@ -0,0 +1,10 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/issue-16683.rs:4:9 + | +LL | fn b(&self) { + | ----- `self` is a reference that is only valid in the function body +LL | self.a(); + | ^^^^^^^^ `self` escapes the function body here + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-17728.nll.stderr b/src/test/ui/issues/issue-17728.nll.stderr new file mode 100644 index 0000000000000..7436ebd920ee2 --- /dev/null +++ b/src/test/ui/issues/issue-17728.nll.stderr @@ -0,0 +1,21 @@ +error[E0308]: match arms have incompatible types + --> $DIR/issue-17728.rs:109:14 + | +LL | / match to_parse { +LL | | "w" | "west" => RoomDirection::West, +LL | | "e" | "east" => RoomDirection::East, +LL | | "n" | "north" => RoomDirection::North, +... | +LL | | "down" => RoomDirection::Down, + | | ------------------- this and all prior arms are found to be of type `RoomDirection` +LL | | _ => None + | | ^^^^ expected enum `RoomDirection`, found enum `std::option::Option` +LL | | } + | |_____- `match` arms have incompatible types + | + = note: expected type `RoomDirection` + found type `std::option::Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-17758.nll.stderr b/src/test/ui/issues/issue-17758.nll.stderr new file mode 100644 index 0000000000000..b9dc9da3683d6 --- /dev/null +++ b/src/test/ui/issues/issue-17758.nll.stderr @@ -0,0 +1,10 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/issue-17758.rs:7:9 + | +LL | fn bar(&self) { + | ----- `self` is a reference that is only valid in the function body +LL | self.foo(); + | ^^^^^^^^^^ `self` escapes the function body here + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-26217.nll.stderr b/src/test/ui/issues/issue-26217.nll.stderr new file mode 100644 index 0000000000000..c7601caacdca3 --- /dev/null +++ b/src/test/ui/issues/issue-26217.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/issue-26217.rs:4:5 + | +LL | fn bar<'a>() { + | -- lifetime `'a` defined here +LL | foo::<&'a i32>(); + | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-28848.nll.stderr b/src/test/ui/issues/issue-28848.nll.stderr new file mode 100644 index 0000000000000..5cf9856e4dc7e --- /dev/null +++ b/src/test/ui/issues/issue-28848.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/issue-28848.rs:10:5 + | +LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | Foo::<'a, 'b>::xmute(u) + | ^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-34721.rs b/src/test/ui/issues/issue-34721.rs index 226c21446b1ed..bdc9fe43a8bd9 100644 --- a/src/test/ui/issues/issue-34721.rs +++ b/src/test/ui/issues/issue-34721.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - pub trait Foo { fn zero(self) -> Self; } diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr index 2ed7b543e713c..d5cede990a335 100644 --- a/src/test/ui/issues/issue-34721.stderr +++ b/src/test/ui/issues/issue-34721.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/issue-34721.rs:27:9 + --> $DIR/issue-34721.rs:25:9 | LL | pub fn baz(x: T) -> T { | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait diff --git a/src/test/ui/issues/issue-40510-1.migrate.nll.stderr b/src/test/ui/issues/issue-40510-1.migrate.nll.stderr new file mode 100644 index 0000000000000..776a724d3106a --- /dev/null +++ b/src/test/ui/issues/issue-40510-1.migrate.nll.stderr @@ -0,0 +1,13 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-1.rs:11:9 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | &mut x + | ^^^^^^ returns a reference to a captured variable which escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-40510-1.stderr b/src/test/ui/issues/issue-40510-1.migrate.stderr similarity index 79% rename from src/test/ui/issues/issue-40510-1.stderr rename to src/test/ui/issues/issue-40510-1.migrate.stderr index 44234cbc8816e..17d1c48d07546 100644 --- a/src/test/ui/issues/issue-40510-1.stderr +++ b/src/test/ui/issues/issue-40510-1.migrate.stderr @@ -1,5 +1,5 @@ warning: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-40510-1.rs:8:9 + --> $DIR/issue-40510-1.rs:11:9 | LL | || { | - inferred to be a `FnMut` closure @@ -11,3 +11,11 @@ LL | &mut x = warning: this error has been downgraded to a warning for backwards compatibility with previous releases = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future +error: compilation successful + --> $DIR/issue-40510-1.rs:20:1 + | +LL | fn main() {} + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.nll.stderr new file mode 100644 index 0000000000000..776a724d3106a --- /dev/null +++ b/src/test/ui/issues/issue-40510-1.nll.stderr @@ -0,0 +1,13 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-1.rs:11:9 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | &mut x + | ^^^^^^ returns a reference to a captured variable which escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-40510-1.rs b/src/test/ui/issues/issue-40510-1.rs index dd8a6bc5ab2bd..6ecbeefd88115 100644 --- a/src/test/ui/issues/issue-40510-1.rs +++ b/src/test/ui/issues/issue-40510-1.rs @@ -1,13 +1,21 @@ -// compile-pass +#![feature(rustc_attrs)] #![allow(unused)] +// revisions: migrate nll +#![cfg_attr(nll, feature(nll))] + fn f() { let mut x: Box<()> = Box::new(()); || { &mut x }; + //[migrate]~^^ WARNING captured variable cannot escape `FnMut` closure body + //[migrate]~| WARNING this error has been downgraded to a warning + //[migrate]~| WARNING this warning will become a hard error in the future + //[nll]~^^^^^ ERROR captured variable cannot escape `FnMut` closure body } - +#[rustc_error] fn main() {} +//[migrate]~^ ERROR diff --git a/src/test/ui/issues/issue-40510-3.migrate.nll.stderr b/src/test/ui/issues/issue-40510-3.migrate.nll.stderr new file mode 100644 index 0000000000000..a49475a8570a1 --- /dev/null +++ b/src/test/ui/issues/issue-40510-3.migrate.nll.stderr @@ -0,0 +1,15 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-3.rs:11:9 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | / || { +LL | | x.push(()) +LL | | } + | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-40510-3.stderr b/src/test/ui/issues/issue-40510-3.migrate.stderr similarity index 80% rename from src/test/ui/issues/issue-40510-3.stderr rename to src/test/ui/issues/issue-40510-3.migrate.stderr index 1297e1418981f..692aa1053779a 100644 --- a/src/test/ui/issues/issue-40510-3.stderr +++ b/src/test/ui/issues/issue-40510-3.migrate.stderr @@ -1,5 +1,5 @@ warning: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-40510-3.rs:8:9 + --> $DIR/issue-40510-3.rs:11:9 | LL | || { | - inferred to be a `FnMut` closure @@ -13,3 +13,11 @@ LL | | } = warning: this error has been downgraded to a warning for backwards compatibility with previous releases = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future +error: compilation successful + --> $DIR/issue-40510-3.rs:22:1 + | +LL | fn main() {} + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-40510-3.nll.stderr b/src/test/ui/issues/issue-40510-3.nll.stderr new file mode 100644 index 0000000000000..a49475a8570a1 --- /dev/null +++ b/src/test/ui/issues/issue-40510-3.nll.stderr @@ -0,0 +1,15 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-3.rs:11:9 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | / || { +LL | | x.push(()) +LL | | } + | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-40510-3.rs b/src/test/ui/issues/issue-40510-3.rs index bc95c461d1e1e..205d982363128 100644 --- a/src/test/ui/issues/issue-40510-3.rs +++ b/src/test/ui/issues/issue-40510-3.rs @@ -1,6 +1,9 @@ -// compile-pass +#![feature(rustc_attrs)] #![allow(unused)] +// revisions: migrate nll +#![cfg_attr(nll, feature(nll))] + fn f() { let mut x: Vec<()> = Vec::new(); @@ -8,8 +11,13 @@ fn f() { || { x.push(()) } + //[migrate]~^^^ WARNING captured variable cannot escape `FnMut` closure body + //[migrate]~| WARNING this error has been downgraded to a warning + //[migrate]~| WARNING this warning will become a hard error in the future + //[nll]~^^^^^^ ERROR captured variable cannot escape `FnMut` closure body }; } - +#[rustc_error] fn main() {} +//[migrate]~^ ERROR diff --git a/src/test/ui/issues/issue-45696-no-variant-box-recur.rs b/src/test/ui/issues/issue-45696-no-variant-box-recur.rs index b5d9036aba67c..c688261fa1cb1 100644 --- a/src/test/ui/issues/issue-45696-no-variant-box-recur.rs +++ b/src/test/ui/issues/issue-45696-no-variant-box-recur.rs @@ -6,11 +6,6 @@ // We will explicitly test NLL, and migration modes; thus we will also skip the // automated compare-mode=nll. -// revisions: nll migrate -// ignore-compare-mode-nll - -#![cfg_attr(nll, feature(nll))] - // run-pass // This test has structs and functions that are by definition unusable diff --git a/src/test/ui/issues/issue-46036.rs b/src/test/ui/issues/issue-46036.rs index c517bbe57e82b..18af33c1821c0 100644 --- a/src/test/ui/issues/issue-46036.rs +++ b/src/test/ui/issues/issue-46036.rs @@ -1,6 +1,5 @@ // Issue 46036: [NLL] false edges on infinite loops // Infinite loops should create false edges to the cleanup block. -#![feature(nll)] struct Foo { x: &'static u32 } diff --git a/src/test/ui/issues/issue-46036.stderr b/src/test/ui/issues/issue-46036.stderr index 9c1746e0fa1ee..49dd0e267b8ea 100644 --- a/src/test/ui/issues/issue-46036.stderr +++ b/src/test/ui/issues/issue-46036.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/issue-46036.rs:9:24 + --> $DIR/issue-46036.rs:8:24 | LL | let foo = Foo { x: &a }; | ^^ diff --git a/src/test/ui/issues/issue-46983.rs b/src/test/ui/issues/issue-46983.rs index a5c1e17a58c3b..c1fd7729bdefb 100644 --- a/src/test/ui/issues/issue-46983.rs +++ b/src/test/ui/issues/issue-46983.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn foo(x: &u32) -> &'static u32 { &*x //~^ ERROR explicit lifetime required in the type of `x` [E0621] diff --git a/src/test/ui/issues/issue-46983.stderr b/src/test/ui/issues/issue-46983.stderr index 43d351ec905e3..8a4a6bdb39fa4 100644 --- a/src/test/ui/issues/issue-46983.stderr +++ b/src/test/ui/issues/issue-46983.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/issue-46983.rs:4:5 + --> $DIR/issue-46983.rs:2:5 | LL | fn foo(x: &u32) -> &'static u32 { | ---- help: add explicit lifetime `'static` to the type of `x`: `&'static u32` diff --git a/src/test/ui/issues/issue-47184.rs b/src/test/ui/issues/issue-47184.rs index 04f1146a8f8ff..2f78ce0002ba3 100644 --- a/src/test/ui/issues/issue-47184.rs +++ b/src/test/ui/issues/issue-47184.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn main() { let _vec: Vec<&'static String> = vec![&String::new()]; //~^ ERROR temporary value dropped while borrowed [E0716] diff --git a/src/test/ui/issues/issue-47184.stderr b/src/test/ui/issues/issue-47184.stderr index 2b4d576e726f8..f97713b4ac438 100644 --- a/src/test/ui/issues/issue-47184.stderr +++ b/src/test/ui/issues/issue-47184.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-47184.rs:4:44 + --> $DIR/issue-47184.rs:2:44 | LL | let _vec: Vec<&'static String> = vec![&String::new()]; | -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement diff --git a/src/test/ui/issues/issue-47646.rs b/src/test/ui/issues/issue-47646.rs index c3c07bf641161..ace6cdce841a7 100644 --- a/src/test/ui/issues/issue-47646.rs +++ b/src/test/ui/issues/issue-47646.rs @@ -1,6 +1,3 @@ -#![allow(warnings)] -#![feature(nll)] - use std::collections::BinaryHeap; fn main() { diff --git a/src/test/ui/issues/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr index db9f227d6b776..c0b8763684806 100644 --- a/src/test/ui/issues/issue-47646.stderr +++ b/src/test/ui/issues/issue-47646.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as mutable - --> $DIR/issue-47646.rs:12:30 + --> $DIR/issue-47646.rs:9:30 | LL | let borrow = heap.peek_mut(); | ---- mutable borrow occurs here diff --git a/src/test/ui/issues/issue-47703-1.rs b/src/test/ui/issues/issue-47703-1.rs index 9add314fdaf09..74323317f1956 100644 --- a/src/test/ui/issues/issue-47703-1.rs +++ b/src/test/ui/issues/issue-47703-1.rs @@ -1,6 +1,4 @@ // compile-pass -#![allow(dead_code)] -#![feature(nll)] struct AtomicRefMut<'a> { value: &'a mut i32, diff --git a/src/test/ui/issues/issue-47703-tuple.rs b/src/test/ui/issues/issue-47703-tuple.rs index 850771cffd0cf..377eeb67ae1b9 100644 --- a/src/test/ui/issues/issue-47703-tuple.rs +++ b/src/test/ui/issues/issue-47703-tuple.rs @@ -1,6 +1,4 @@ // compile-pass -#![allow(dead_code)] -#![feature(nll)] struct WithDrop; diff --git a/src/test/ui/issues/issue-47703.rs b/src/test/ui/issues/issue-47703.rs index 06b17e931a974..22f2a1f364d1d 100644 --- a/src/test/ui/issues/issue-47703.rs +++ b/src/test/ui/issues/issue-47703.rs @@ -1,6 +1,4 @@ // compile-pass -#![allow(dead_code)] -#![feature(nll)] struct MyStruct<'a> { field: &'a mut (), diff --git a/src/test/ui/issues/issue-47722.rs b/src/test/ui/issues/issue-47722.rs index c9bc6147aa9ca..cefc872668ceb 100644 --- a/src/test/ui/issues/issue-47722.rs +++ b/src/test/ui/issues/issue-47722.rs @@ -1,10 +1,8 @@ // compile-pass -#![allow(dead_code)] // Tests that automatic coercions from &mut T to *mut T // allow borrows of T to expire immediately - essentially, that // they work identically to 'foo as *mut T' -#![feature(nll)] struct SelfReference { self_reference: *mut SelfReference, diff --git a/src/test/ui/issues/issue-47789.rs b/src/test/ui/issues/issue-47789.rs index d15a27a2a2e65..334bd608add15 100644 --- a/src/test/ui/issues/issue-47789.rs +++ b/src/test/ui/issues/issue-47789.rs @@ -1,9 +1,6 @@ // compile-pass -#![allow(dead_code)] #![allow(non_upper_case_globals)] -#![feature(nll)] - static mut x: &'static u32 = &0; fn foo() { diff --git a/src/test/ui/issues/issue-48132.rs b/src/test/ui/issues/issue-48132.rs index b3cef78f3e6b4..ea325ea695f66 100644 --- a/src/test/ui/issues/issue-48132.rs +++ b/src/test/ui/issues/issue-48132.rs @@ -3,9 +3,6 @@ // run-pass -#![feature(nll)] -#![allow(warnings)] - struct Inner { iterator: I, item: V, diff --git a/src/test/ui/issues/issue-48179.rs b/src/test/ui/issues/issue-48179.rs index 245f13b2b609d..90e9858d74197 100644 --- a/src/test/ui/issues/issue-48179.rs +++ b/src/test/ui/issues/issue-48179.rs @@ -3,9 +3,6 @@ // run-pass -#![feature(nll)] -#![allow(warnings)] - pub struct Container { value: Option, } diff --git a/src/test/ui/issues/issue-48803.rs b/src/test/ui/issues/issue-48803.rs index bc1bc29c98f2e..f7fd04179f26e 100644 --- a/src/test/ui/issues/issue-48803.rs +++ b/src/test/ui/issues/issue-48803.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn flatten<'a, 'b, T>(x: &'a &'b T) -> &'a T { x } diff --git a/src/test/ui/issues/issue-48803.stderr b/src/test/ui/issues/issue-48803.stderr index 9a6da9e625da4..2f94039c0c3a9 100644 --- a/src/test/ui/issues/issue-48803.stderr +++ b/src/test/ui/issues/issue-48803.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/issue-48803.rs:12:5 + --> $DIR/issue-48803.rs:10:5 | LL | let y = &x; | -- borrow of `x` occurs here diff --git a/src/test/ui/issues/issue-49579.rs b/src/test/ui/issues/issue-49579.rs index 34f277af01e97..dd7b9eeb8d54e 100644 --- a/src/test/ui/issues/issue-49579.rs +++ b/src/test/ui/issues/issue-49579.rs @@ -1,8 +1,6 @@ // compile-pass // ignore-emscripten no i128 support -#![feature(nll)] - fn fibs(n: u32) -> impl Iterator { (0 .. n) .scan((0, 1), |st, _| { diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr new file mode 100644 index 0000000000000..9c6f8d4532a70 --- /dev/null +++ b/src/test/ui/issues/issue-49824.nll.stderr @@ -0,0 +1,18 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-49824.rs:10:9 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | / || { +LL | | +LL | | +LL | | +LL | | let _y = &mut x; +LL | | } + | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-51515.rs b/src/test/ui/issues/issue-51515.rs index 64d9822bab4da..8eab7b2fa3ae9 100644 --- a/src/test/ui/issues/issue-51515.rs +++ b/src/test/ui/issues/issue-51515.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn main() { let foo = &16; //~^ HELP consider changing this to be a mutable reference diff --git a/src/test/ui/issues/issue-51515.stderr b/src/test/ui/issues/issue-51515.stderr index 0e6c8fd48f19f..827bb8fe2b892 100644 --- a/src/test/ui/issues/issue-51515.stderr +++ b/src/test/ui/issues/issue-51515.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*foo` which is behind a `&` reference - --> $DIR/issue-51515.rs:7:5 + --> $DIR/issue-51515.rs:5:5 | LL | let foo = &16; | --- help: consider changing this to be a mutable reference: `&mut 16` @@ -8,7 +8,7 @@ LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*bar` which is behind a `&` reference - --> $DIR/issue-51515.rs:12:5 + --> $DIR/issue-51515.rs:10:5 | LL | let bar = foo; | --- help: consider changing this to be a mutable reference: `&mut i32` diff --git a/src/test/ui/issues/issue-52057.rs b/src/test/ui/issues/issue-52057.rs index 356efd5dfedba..911983445e6d6 100644 --- a/src/test/ui/issues/issue-52057.rs +++ b/src/test/ui/issues/issue-52057.rs @@ -4,8 +4,6 @@ // // run-pass -#![feature(nll)] - pub trait Parser { type Input; diff --git a/src/test/ui/issues/issue-52213.nll.stderr b/src/test/ui/issues/issue-52213.nll.stderr new file mode 100644 index 0000000000000..eba875de2152b --- /dev/null +++ b/src/test/ui/issues/issue-52213.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/issue-52213.rs:3:20 + | +LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | match (&t,) { +LL | ((u,),) => u, + | ^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-52533-1.nll.stderr b/src/test/ui/issues/issue-52533-1.nll.stderr new file mode 100644 index 0000000000000..20f19b2596716 --- /dev/null +++ b/src/test/ui/issues/issue-52533-1.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-52533-1.rs:9:18 + | +LL | gimme(|x, y| y) + | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | | | + | | has type `&Foo<'_, '1, u32>` + | has type `&Foo<'_, '2, u32>` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-52533.nll.stderr b/src/test/ui/issues/issue-52533.nll.stderr new file mode 100644 index 0000000000000..c764736d79878 --- /dev/null +++ b/src/test/ui/issues/issue-52533.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-52533.rs:5:16 + | +LL | foo(|a, b| b) + | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | | | + | | has type `&'1 u32` + | has type `&'2 u32` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-52992.rs b/src/test/ui/issues/issue-52992.rs index 0fdf077d2fc15..c58656330e12b 100644 --- a/src/test/ui/issues/issue-52992.rs +++ b/src/test/ui/issues/issue-52992.rs @@ -4,8 +4,6 @@ // // compile-pass -#![feature(nll)] - fn main() {} fn fail<'a>() -> Struct<'a, Generic<()>> { diff --git a/src/test/ui/issues/issue-53568.rs b/src/test/ui/issues/issue-53568.rs index f04d861250b40..4d3b3f80a97e5 100644 --- a/src/test/ui/issues/issue-53568.rs +++ b/src/test/ui/issues/issue-53568.rs @@ -3,9 +3,6 @@ // // compile-pass -#![feature(nll)] -#![allow(dead_code)] - trait Future { type Item; } diff --git a/src/test/ui/issues/issue-54302-cases.nll.stderr b/src/test/ui/issues/issue-54302-cases.nll.stderr new file mode 100644 index 0000000000000..7463a3f286f4c --- /dev/null +++ b/src/test/ui/issues/issue-54302-cases.nll.stderr @@ -0,0 +1,26 @@ +error: higher-ranked subtype error + --> $DIR/issue-54302-cases.rs:63:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/issue-54302-cases.rs:69:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/issue-54302-cases.rs:75:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/issue-54302-cases.rs:81:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/issues/issue-54302.nll.stderr b/src/test/ui/issues/issue-54302.nll.stderr new file mode 100644 index 0000000000000..e68de0312824d --- /dev/null +++ b/src/test/ui/issues/issue-54302.nll.stderr @@ -0,0 +1,8 @@ +error: higher-ranked subtype error + --> $DIR/issue-54302.rs:13:5 + | +LL | assert_deserialize_owned::<&'static str>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-54943-1.rs b/src/test/ui/issues/issue-54943-1.rs index 7750e34036192..8d3a4e72de411 100644 --- a/src/test/ui/issues/issue-54943-1.rs +++ b/src/test/ui/issues/issue-54943-1.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // This test is a minimal version of an ICE in the dropck-eyepatch tests // found in the fix for #54943. diff --git a/src/test/ui/issues/issue-54943-2.rs b/src/test/ui/issues/issue-54943-2.rs index f829c38c35d23..41ca7c1498265 100644 --- a/src/test/ui/issues/issue-54943-2.rs +++ b/src/test/ui/issues/issue-54943-2.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // This test is a minimal version of an ICE in the dropck-eyepatch tests // found in the fix for #54943. In particular, this test is in unreachable // code as the initial fix for this ICE only worked if the code was reachable. diff --git a/src/test/ui/issues/issue-54943.nll.stderr b/src/test/ui/issues/issue-54943.nll.stderr new file mode 100644 index 0000000000000..59be0f983b907 --- /dev/null +++ b/src/test/ui/issues/issue-54943.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-54943.rs:6:13 + | +LL | fn boo<'a>() { + | -- lifetime `'a` defined here +... +LL | let x = foo::<&'a u32>(); + | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-54943.rs b/src/test/ui/issues/issue-54943.rs index ce4e010674359..85722300bf006 100644 --- a/src/test/ui/issues/issue-54943.rs +++ b/src/test/ui/issues/issue-54943.rs @@ -1,13 +1,10 @@ -#![feature(nll)] -#![allow(warnings)] - fn foo() { } fn boo<'a>() { return; let x = foo::<&'a u32>(); - //~^ ERROR lifetime may not live long enough + //~^ ERROR } fn main() {} diff --git a/src/test/ui/issues/issue-54943.stderr b/src/test/ui/issues/issue-54943.stderr index aa68177bcdb58..d0f03f90c8330 100644 --- a/src/test/ui/issues/issue-54943.stderr +++ b/src/test/ui/issues/issue-54943.stderr @@ -1,11 +1,10 @@ -error: lifetime may not live long enough - --> $DIR/issue-54943.rs:9:13 +error[E0477]: the type `&'a u32` does not fulfill the required lifetime + --> $DIR/issue-54943.rs:6:13 | -LL | fn boo<'a>() { - | -- lifetime `'a` defined here -... LL | let x = foo::<&'a u32>(); - | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ + | + = note: type must satisfy the static lifetime error: aborting due to previous error diff --git a/src/test/ui/issues/issue-55731.nll.stderr b/src/test/ui/issues/issue-55731.nll.stderr new file mode 100644 index 0000000000000..dd38bb6291251 --- /dev/null +++ b/src/test/ui/issues/issue-55731.nll.stderr @@ -0,0 +1,11 @@ +error: higher-ranked subtype error + --> $DIR/issue-55731.rs:48:5 + | +LL | / multi(Map { +LL | | i: Cloned(PhantomData), +LL | | f: X, +LL | | }); + | |______^ + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-55796.nll.stderr b/src/test/ui/issues/issue-55796.nll.stderr new file mode 100644 index 0000000000000..5809a56cd4b6b --- /dev/null +++ b/src/test/ui/issues/issue-55796.nll.stderr @@ -0,0 +1,20 @@ +error: lifetime may not live long enough + --> $DIR/issue-55796.rs:16:9 + | +LL | pub trait Graph<'a> { + | -- lifetime `'a` defined here +... +LL | Box::new(self.out_edges(u).map(|e| e.target())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/issue-55796.rs:21:9 + | +LL | pub trait Graph<'a> { + | -- lifetime `'a` defined here +... +LL | Box::new(self.in_edges(u).map(|e| e.target())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issues/issue-57843.nll.stderr b/src/test/ui/issues/issue-57843.nll.stderr new file mode 100644 index 0000000000000..70310780b4330 --- /dev/null +++ b/src/test/ui/issues/issue-57843.nll.stderr @@ -0,0 +1,8 @@ +error: higher-ranked subtype error + --> $DIR/issue-57843.rs:23:9 + | +LL | Foo(Box::new(|_| ())); + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr new file mode 100644 index 0000000000000..c1f662fda610b --- /dev/null +++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr @@ -0,0 +1,63 @@ +error[E0277]: `T` cannot be sent between threads safely + --> $DIR/kindck-impl-type-params.rs:18:13 + | +LL | let a = &t as &Gettable; + | ^^ `T` cannot be sent between threads safely + | + = help: the trait `std::marker::Send` is not implemented for `T` + = help: consider adding a `where T: std::marker::Send` bound + = note: required because of the requirements on the impl of `Gettable` for `S` + = note: required for the cast to the object type `dyn Gettable` + +error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied + --> $DIR/kindck-impl-type-params.rs:18:13 + | +LL | let a = &t as &Gettable; + | ^^ the trait `std::marker::Copy` is not implemented for `T` + | + = help: consider adding a `where T: std::marker::Copy` bound + = note: required because of the requirements on the impl of `Gettable` for `S` + = note: required for the cast to the object type `dyn Gettable` + +error[E0277]: `T` cannot be sent between threads safely + --> $DIR/kindck-impl-type-params.rs:25:27 + | +LL | let a: &Gettable = &t; + | ^^ `T` cannot be sent between threads safely + | + = help: the trait `std::marker::Send` is not implemented for `T` + = help: consider adding a `where T: std::marker::Send` bound + = note: required because of the requirements on the impl of `Gettable` for `S` + = note: required for the cast to the object type `dyn Gettable` + +error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied + --> $DIR/kindck-impl-type-params.rs:25:27 + | +LL | let a: &Gettable = &t; + | ^^ the trait `std::marker::Copy` is not implemented for `T` + | + = help: consider adding a `where T: std::marker::Copy` bound + = note: required because of the requirements on the impl of `Gettable` for `S` + = note: required for the cast to the object type `dyn Gettable` + +error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied + --> $DIR/kindck-impl-type-params.rs:38:13 + | +LL | let a = t as Box>; + | ^ the trait `std::marker::Copy` is not implemented for `std::string::String` + | + = note: required because of the requirements on the impl of `Gettable` for `S` + = note: required for the cast to the object type `dyn Gettable` + +error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied + --> $DIR/kindck-impl-type-params.rs:46:33 + | +LL | let a: Box> = t; + | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` + | + = note: required because of the requirements on the impl of `Gettable` for `S` + = note: required for the cast to the object type `dyn Gettable` + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/kindck/kindck-send-object1.nll.stderr b/src/test/ui/kindck/kindck-send-object1.nll.stderr new file mode 100644 index 0000000000000..1df7412132bd9 --- /dev/null +++ b/src/test/ui/kindck/kindck-send-object1.nll.stderr @@ -0,0 +1,32 @@ +error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely + --> $DIR/kindck-send-object1.rs:10:5 + | +LL | assert_send::<&'a Dummy>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely + | + = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)` + = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)` +note: required by `assert_send` + --> $DIR/kindck-send-object1.rs:5:1 + | +LL | fn assert_send() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely + --> $DIR/kindck-send-object1.rs:29:5 + | +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely + | + = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)` + = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>` + = note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>` +note: required by `assert_send` + --> $DIR/kindck-send-object1.rs:5:1 + | +LL | fn assert_send() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr new file mode 100644 index 0000000000000..8b24563e92004 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr @@ -0,0 +1,20 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/lifetime-bound-will-change-warning.rs:34:5 + | +LL | fn test2<'a>(x: &'a Box) { + | - `x` is a reference that is only valid in the function body +LL | // but ref_obj will not, so warn. +LL | ref_obj(x) + | ^^^^^^^^^^ `x` escapes the function body here + +error[E0521]: borrowed data escapes outside of function + --> $DIR/lifetime-bound-will-change-warning.rs:39:5 + | +LL | fn test2cc<'a>(x: &'a Box) { + | - `x` is a reference that is only valid in the function body +LL | // same as test2, but cross crate +LL | lib::ref_obj(x) + | ^^^^^^^^^^^^^^^ `x` escapes the function body here + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr new file mode 100644 index 0000000000000..fc9093bb2e4b8 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20 + | +LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here +LL | +LL | if x > y { x } else { y } + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr new file mode 100644 index 0000000000000..3384c24da8fbe --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5 + | +LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here +LL | +LL | x + | ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr new file mode 100644 index 0000000000000..5ef29076e07bf --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30 + | +LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here +LL | +LL | if true { x } else { self } + | ^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr new file mode 100644 index 0000000000000..90d4754ebab82 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `x` + --> $DIR/ex2a-push-one-existing-name-2.rs:6:5 + | +LL | fn foo<'a>(x: Ref, y: &mut Vec>) { + | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` +LL | y.push(x); + | ^^^^^^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr new file mode 100644 index 0000000000000..a03e16b3b7919 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr @@ -0,0 +1,12 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:5 + | +LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` +... +LL | x.push(y); + | ^^^^^^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr new file mode 100644 index 0000000000000..487b34e3d18f4 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $DIR/ex2a-push-one-existing-name.rs:6:5 + | +LL | fn foo<'a>(x: &mut Vec>, y: Ref) { + | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` +LL | x.push(y); + | ^^^^^^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr new file mode 100644 index 0000000000000..735f7a0dfc633 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex2b-push-no-existing-names.rs:6:5 + | +LL | fn foo(x: &mut Vec>, y: Ref) { + | - - has type `Ref<'1, i32>` + | | + | has type `&mut std::vec::Vec>` +LL | x.push(y); + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr new file mode 100644 index 0000000000000..fbefa1f5667c7 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex2c-push-inference-variable.rs:7:5 + | +LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here +LL | let z = Ref { data: y.data }; +LL | x.push(z); + | ^^^^^^^^^ argument requires that `'c` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr new file mode 100644 index 0000000000000..d889eb4afdbe5 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex2d-push-inference-variable-2.rs:8:5 + | +LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here +... +LL | a.push(b); + | ^^^^^^^^^ argument requires that `'c` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr new file mode 100644 index 0000000000000..39eb4079352c3 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex2e-push-inference-variable-3.rs:8:5 + | +LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here +... +LL | Vec::push(a, b); + | ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr new file mode 100644 index 0000000000000..a94f9a799061a --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-2.rs:2:5 + | +LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | *v = x; + | ^^^^^^ assignment requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr new file mode 100644 index 0000000000000..779e2eb8b9205 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr @@ -0,0 +1,22 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-3.rs:2:5 + | +LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | z.push((x,y)); + | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-3.rs:2:5 + | +LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | z.push((x,y)); + | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr new file mode 100644 index 0000000000000..4c0ffe5c0901a --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5 + | +LL | fn foo(mut x: Ref, y: Ref) { + | ----- - has type `Ref<'_, '1>` + | | + | has type `Ref<'_, '2>` +LL | x.b = y.b; + | ^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr new file mode 100644 index 0000000000000..97c665347f6ec --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:5 + | +LL | fn foo(mut x: Ref) { + | ----- + | | + | has type `Ref<'_, '1>` + | has type `Ref<'2, '_>` +LL | x.a = x.b; + | ^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr new file mode 100644 index 0000000000000..a39bb165806f2 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:5 + | +LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | x.push(y); + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr new file mode 100644 index 0000000000000..48ce5301adef3 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:5 + | +LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x.push(y); + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr new file mode 100644 index 0000000000000..f9c33c2480693 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:5 + | +LL | fn foo(mut x: Vec, y: Ref) { + | ----- - has type `Ref<'1>` + | | + | has type `std::vec::Vec>` +LL | x.push(y); + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr new file mode 100644 index 0000000000000..0996068398009 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:5 + | +LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x.push(y); + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr new file mode 100644 index 0000000000000..5751c3194894e --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr @@ -0,0 +1,21 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5 + | +LL | fn foo(mut x: Ref, y: &u32) { + | ----- - let's call the lifetime of this reference `'2` + | | + | has type `Ref<'_, '1>` +LL | y = x.b; + | ^^^^^^^ assignment requires that `'1` must outlive `'2` + +error[E0384]: cannot assign to immutable argument `y` + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5 + | +LL | fn foo(mut x: Ref, y: &u32) { + | - help: make this binding mutable: `mut y` +LL | y = x.b; + | ^^^^^^^ cannot assign to immutable argument + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0384`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr new file mode 100644 index 0000000000000..79e7e8e157d95 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:5 + | +LL | fn foo(mut y: Ref, x: &u32) { + | ----- - let's call the lifetime of this reference `'1` + | | + | has type `Ref<'_, '2>` +LL | y.b = x; + | ^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr new file mode 100644 index 0000000000000..53615fd1aba69 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:5 + | +LL | fn foo(mut y: Ref, x: &u32) { + | ----- - let's call the lifetime of this reference `'1` + | | + | has type `Ref<'_, '2>` +LL | y.b = x; + | ^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr new file mode 100644 index 0000000000000..6ff4411673756 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:5 + | +LL | fn foo(mut x: Ref, y: &u32) { + | ----- - let's call the lifetime of this reference `'1` + | | + | has type `Ref<'_, '2>` +LL | x.b = y; + | ^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr new file mode 100644 index 0000000000000..1c258ad98ba10 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5 + | +LL | fn foo<'a>(&self, x: &i32) -> &i32 { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | x + | ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr new file mode 100644 index 0000000000000..ffe39fdd8c9f5 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19 + | +LL | fn foo<'a>(&self, x: &Foo) -> &Foo { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | if true { x } else { self } + | ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr new file mode 100644 index 0000000000000..33be98c64910d --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr @@ -0,0 +1,21 @@ +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable + --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3 + | +LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { + | - help: consider changing this to be mutable: `mut y` +LL | y.push(z); + | ^ cannot borrow as mutable + +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3 + | +LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | y.push(z); + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr new file mode 100644 index 0000000000000..f3502674849ef --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:9 + | +LL | fn foo(x: &mut Vec<&u8>, y: &u8) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | x.push(y); + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr new file mode 100644 index 0000000000000..c4e7ff90069db --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr @@ -0,0 +1,21 @@ +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable + --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 + | +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | - help: consider changing this to be mutable: `mut y` +LL | y.push(z); + | ^ cannot borrow as mutable + +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 + | +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | y.push(z); + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr new file mode 100644 index 0000000000000..6989acfa1963b --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/ex3-both-anon-regions.rs:2:5 + | +LL | fn foo(x: &mut Vec<&u8>, y: &u8) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` +LL | x.push(y); + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr new file mode 100644 index 0000000000000..832688f5162b3 --- /dev/null +++ b/src/test/ui/lub-if.nll.stderr @@ -0,0 +1,20 @@ +error: lifetime may not live long enough + --> $DIR/lub-if.rs:28:9 + | +LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { + | -- lifetime `'a` defined here +... +LL | s + | ^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/lub-if.rs:35:9 + | +LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { + | -- lifetime `'a` defined here +... +LL | s + | ^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/lub-match.nll.stderr b/src/test/ui/lub-match.nll.stderr new file mode 100644 index 0000000000000..3a344a77d2c2d --- /dev/null +++ b/src/test/ui/lub-match.nll.stderr @@ -0,0 +1,20 @@ +error: lifetime may not live long enough + --> $DIR/lub-match.rs:30:13 + | +LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { + | -- lifetime `'a` defined here +... +LL | s + | ^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/lub-match.rs:39:13 + | +LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { + | -- lifetime `'a` defined here +... +LL | s + | ^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/match/match-ref-mut-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-invariance.nll.stderr new file mode 100644 index 0000000000000..505b8db6a3332 --- /dev/null +++ b/src/test/ui/match/match-ref-mut-invariance.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/match-ref-mut-invariance.rs:10:9 + | +LL | impl<'b> S<'b> { + | -- lifetime `'b` defined here +LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { + | -- lifetime `'a` defined here +LL | match self.0 { ref mut x => x } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr new file mode 100644 index 0000000000000..ab5f43d022281 --- /dev/null +++ b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/match-ref-mut-let-invariance.rs:11:9 + | +LL | impl<'b> S<'b> { + | -- lifetime `'b` defined here +LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { + | -- lifetime `'a` defined here +LL | let ref mut x = self.0; +LL | x + | ^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/mir-dataflow/def-inits-1.rs b/src/test/ui/mir-dataflow/def-inits-1.rs index 07ac1900bc71c..91d41e9b5794e 100644 --- a/src/test/ui/mir-dataflow/def-inits-1.rs +++ b/src/test/ui/mir-dataflow/def-inits-1.rs @@ -1,6 +1,5 @@ // General test of maybe_uninits state computed by MIR dataflow. -#![feature(nll)] #![feature(core_intrinsics, rustc_attrs)] use std::intrinsics::rustc_peek; diff --git a/src/test/ui/mir-dataflow/def-inits-1.stderr b/src/test/ui/mir-dataflow/def-inits-1.stderr index 6bc5f7dcb99fc..48d8450489488 100644 --- a/src/test/ui/mir-dataflow/def-inits-1.stderr +++ b/src/test/ui/mir-dataflow/def-inits-1.stderr @@ -1,23 +1,23 @@ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:15:14 + --> $DIR/def-inits-1.rs:14:14 | LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:31:14 + --> $DIR/def-inits-1.rs:30:14 | LL | unsafe { rustc_peek(&z); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:34:14 + --> $DIR/def-inits-1.rs:33:14 | LL | unsafe { rustc_peek(&y); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:42:14 + --> $DIR/def-inits-1.rs:41:14 | LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/mir-dataflow/inits-1.rs b/src/test/ui/mir-dataflow/inits-1.rs index 13f900e4a75ee..4a4786a2a7378 100644 --- a/src/test/ui/mir-dataflow/inits-1.rs +++ b/src/test/ui/mir-dataflow/inits-1.rs @@ -1,6 +1,5 @@ // General test of maybe_inits state computed by MIR dataflow. -#![feature(nll)] #![feature(core_intrinsics, rustc_attrs)] use std::intrinsics::rustc_peek; diff --git a/src/test/ui/mir-dataflow/inits-1.stderr b/src/test/ui/mir-dataflow/inits-1.stderr index 38a9c60b168d1..23d0679cb1ac1 100644 --- a/src/test/ui/mir-dataflow/inits-1.stderr +++ b/src/test/ui/mir-dataflow/inits-1.stderr @@ -1,17 +1,17 @@ error: rustc_peek: bit not set - --> $DIR/inits-1.rs:15:14 + --> $DIR/inits-1.rs:14:14 | LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/inits-1.rs:35:14 + --> $DIR/inits-1.rs:34:14 | LL | unsafe { rustc_peek(&y); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/inits-1.rs:43:14 + --> $DIR/inits-1.rs:42:14 | LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/mir-dataflow/uninits-1.rs b/src/test/ui/mir-dataflow/uninits-1.rs index 4c64359693296..66b3f458a5159 100644 --- a/src/test/ui/mir-dataflow/uninits-1.rs +++ b/src/test/ui/mir-dataflow/uninits-1.rs @@ -1,6 +1,5 @@ // General test of maybe_uninits state computed by MIR dataflow. -#![feature(nll)] #![feature(core_intrinsics, rustc_attrs)] use std::intrinsics::rustc_peek; diff --git a/src/test/ui/mir-dataflow/uninits-1.stderr b/src/test/ui/mir-dataflow/uninits-1.stderr index c60987050e638..5f6dbde212d0a 100644 --- a/src/test/ui/mir-dataflow/uninits-1.stderr +++ b/src/test/ui/mir-dataflow/uninits-1.stderr @@ -1,29 +1,29 @@ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:19:14 + --> $DIR/uninits-1.rs:18:14 | LL | unsafe { rustc_peek(&x) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:20:14 + --> $DIR/uninits-1.rs:19:14 | LL | unsafe { rustc_peek(&y) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:21:14 + --> $DIR/uninits-1.rs:20:14 | LL | unsafe { rustc_peek(&z) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:37:14 + --> $DIR/uninits-1.rs:36:14 | LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:45:14 + --> $DIR/uninits-1.rs:44:14 | LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mir-dataflow/uninits-2.rs b/src/test/ui/mir-dataflow/uninits-2.rs index 2247e68d097fc..2ccf1c7f9d6c6 100644 --- a/src/test/ui/mir-dataflow/uninits-2.rs +++ b/src/test/ui/mir-dataflow/uninits-2.rs @@ -1,6 +1,5 @@ // General test of maybe_uninits state computed by MIR dataflow. -#![feature(nll)] #![feature(core_intrinsics, rustc_attrs)] use std::intrinsics::rustc_peek; diff --git a/src/test/ui/mir-dataflow/uninits-2.stderr b/src/test/ui/mir-dataflow/uninits-2.stderr index de3e58e52de41..dcb61371994db 100644 --- a/src/test/ui/mir-dataflow/uninits-2.stderr +++ b/src/test/ui/mir-dataflow/uninits-2.stderr @@ -1,5 +1,5 @@ error: rustc_peek: bit not set - --> $DIR/uninits-2.rs:15:14 + --> $DIR/uninits-2.rs:14:14 | LL | unsafe { rustc_peek(&x) }; | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/borrow-use-issue-46875.rs b/src/test/ui/nll/borrow-use-issue-46875.rs index 03db28fc508b1..42e28b9674b30 100644 --- a/src/test/ui/nll/borrow-use-issue-46875.rs +++ b/src/test/ui/nll/borrow-use-issue-46875.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // run-pass fn vec() { diff --git a/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs b/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs index 59936a8092534..7d3b00dfc7163 100644 --- a/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs +++ b/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs @@ -3,7 +3,6 @@ // // FIXME(#54366) - We probably shouldn't allow #[thread_local] static mut to get a 'static lifetime. -#![feature(nll)] #![feature(thread_local)] #[thread_local] diff --git a/src/test/ui/nll/borrowed-local-error.rs b/src/test/ui/nll/borrowed-local-error.rs index d37e61b63a814..d333356d964ce 100644 --- a/src/test/ui/nll/borrowed-local-error.rs +++ b/src/test/ui/nll/borrowed-local-error.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn gimme(x: &(u32,)) -> &u32 { &x.0 } diff --git a/src/test/ui/nll/borrowed-local-error.stderr b/src/test/ui/nll/borrowed-local-error.stderr index 799eec9d3422c..d629caa435319 100644 --- a/src/test/ui/nll/borrowed-local-error.stderr +++ b/src/test/ui/nll/borrowed-local-error.stderr @@ -1,5 +1,5 @@ error[E0597]: `v` does not live long enough - --> $DIR/borrowed-local-error.rs:10:9 + --> $DIR/borrowed-local-error.rs:8:9 | LL | let x = gimme({ | ----- borrow later used by call diff --git a/src/test/ui/nll/borrowed-referent-issue-38899.rs b/src/test/ui/nll/borrowed-referent-issue-38899.rs index 7bad6dc2cd335..d4b05fb793160 100644 --- a/src/test/ui/nll/borrowed-referent-issue-38899.rs +++ b/src/test/ui/nll/borrowed-referent-issue-38899.rs @@ -1,7 +1,6 @@ // Regression test for issue #38899 #![feature(nll)] -#![allow(dead_code)] pub struct Block<'a> { current: &'a u8, diff --git a/src/test/ui/nll/borrowed-referent-issue-38899.stderr b/src/test/ui/nll/borrowed-referent-issue-38899.stderr index 5c9c48f5b1d83..38a6e27a0e560 100644 --- a/src/test/ui/nll/borrowed-referent-issue-38899.stderr +++ b/src/test/ui/nll/borrowed-referent-issue-38899.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowed-referent-issue-38899.rs:14:21 + --> $DIR/borrowed-referent-issue-38899.rs:13:21 | LL | let x = &mut block; | ---------- mutable borrow occurs here diff --git a/src/test/ui/nll/borrowed-temporary-error.rs b/src/test/ui/nll/borrowed-temporary-error.rs index 5ad987c721470..37d0e670d350d 100644 --- a/src/test/ui/nll/borrowed-temporary-error.rs +++ b/src/test/ui/nll/borrowed-temporary-error.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn gimme(x: &(u32,)) -> &u32 { &x.0 } diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr index c0d42312eb1ad..2c6bd92641f60 100644 --- a/src/test/ui/nll/borrowed-temporary-error.stderr +++ b/src/test/ui/nll/borrowed-temporary-error.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowed-temporary-error.rs:10:10 + --> $DIR/borrowed-temporary-error.rs:8:10 | LL | &(v,) | ^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/nll/borrowed-universal-error-2.rs b/src/test/ui/nll/borrowed-universal-error-2.rs index a10a62b470d76..3f9b2f2924c2c 100644 --- a/src/test/ui/nll/borrowed-universal-error-2.rs +++ b/src/test/ui/nll/borrowed-universal-error-2.rs @@ -1,6 +1,3 @@ -#![feature(nll)] -#![allow(warnings)] - fn foo<'a>(x: &'a (u32,)) -> &'a u32 { let v = 22; &v diff --git a/src/test/ui/nll/borrowed-universal-error-2.stderr b/src/test/ui/nll/borrowed-universal-error-2.stderr index e89a77a2d360f..7213ed3bafb37 100644 --- a/src/test/ui/nll/borrowed-universal-error-2.stderr +++ b/src/test/ui/nll/borrowed-universal-error-2.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to local variable `v` - --> $DIR/borrowed-universal-error-2.rs:6:5 + --> $DIR/borrowed-universal-error-2.rs:3:5 | LL | &v | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/nll/borrowed-universal-error.rs b/src/test/ui/nll/borrowed-universal-error.rs index 18a0a72c4bb83..fc9ffd47061b4 100644 --- a/src/test/ui/nll/borrowed-universal-error.rs +++ b/src/test/ui/nll/borrowed-universal-error.rs @@ -1,6 +1,3 @@ -#![feature(nll)] -#![allow(warnings)] - fn gimme(x: &(u32,)) -> &u32 { &x.0 } diff --git a/src/test/ui/nll/borrowed-universal-error.stderr b/src/test/ui/nll/borrowed-universal-error.stderr index 4b76795943e64..88a2d8fcf8cc0 100644 --- a/src/test/ui/nll/borrowed-universal-error.stderr +++ b/src/test/ui/nll/borrowed-universal-error.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/borrowed-universal-error.rs:10:5 + --> $DIR/borrowed-universal-error.rs:7:5 | LL | gimme(&(v,)) | ^^^^^^^----^ diff --git a/src/test/ui/nll/capture-mut-ref.rs b/src/test/ui/nll/capture-mut-ref.rs index 222f4e71c52fe..9d2624a9d6fa6 100644 --- a/src/test/ui/nll/capture-mut-ref.rs +++ b/src/test/ui/nll/capture-mut-ref.rs @@ -1,7 +1,6 @@ // Check that capturing a mutable reference by move and assigning to its // referent doesn't make the unused mut lint think that it is mutable. -#![feature(nll)] #![deny(unused_mut)] fn mutable_upvar() { diff --git a/src/test/ui/nll/capture-mut-ref.stderr b/src/test/ui/nll/capture-mut-ref.stderr index 327ce0c6e81f0..883b2d05a7f51 100644 --- a/src/test/ui/nll/capture-mut-ref.stderr +++ b/src/test/ui/nll/capture-mut-ref.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/capture-mut-ref.rs:8:9 + --> $DIR/capture-mut-ref.rs:7:9 | LL | let mut x = &mut 0; | ----^ @@ -7,7 +7,7 @@ LL | let mut x = &mut 0; | help: remove this `mut` | note: lint level defined here - --> $DIR/capture-mut-ref.rs:5:9 + --> $DIR/capture-mut-ref.rs:4:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ diff --git a/src/test/ui/nll/capture-ref-in-struct.rs b/src/test/ui/nll/capture-ref-in-struct.rs index bf2db32901e68..db6ac7d66ccc4 100644 --- a/src/test/ui/nll/capture-ref-in-struct.rs +++ b/src/test/ui/nll/capture-ref-in-struct.rs @@ -1,9 +1,6 @@ // Test that a structure which tries to store a pointer to `y` into // `p` (indirectly) fails to compile. -#![feature(rustc_attrs)] -#![feature(nll)] - struct SomeStruct<'a, 'b: 'a> { p: &'a mut &'b i32, y: &'b i32, diff --git a/src/test/ui/nll/capture-ref-in-struct.stderr b/src/test/ui/nll/capture-ref-in-struct.stderr index 7fafb4474fdb3..521e543bd2693 100644 --- a/src/test/ui/nll/capture-ref-in-struct.stderr +++ b/src/test/ui/nll/capture-ref-in-struct.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/capture-ref-in-struct.rs:21:16 + --> $DIR/capture-ref-in-struct.rs:18:16 | LL | y: &y, | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/closure-access-spans.rs b/src/test/ui/nll/closure-access-spans.rs index 1e11b4818183b..2a59e80b25cd9 100644 --- a/src/test/ui/nll/closure-access-spans.rs +++ b/src/test/ui/nll/closure-access-spans.rs @@ -1,7 +1,5 @@ // check that accesses due to a closure capture give a special note -#![feature(nll)] - fn closure_imm_capture_conflict(mut x: i32) { let r = &mut x; || x; //~ ERROR diff --git a/src/test/ui/nll/closure-access-spans.stderr b/src/test/ui/nll/closure-access-spans.stderr index 32958e28a3d08..4a8086905b7df 100644 --- a/src/test/ui/nll/closure-access-spans.stderr +++ b/src/test/ui/nll/closure-access-spans.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/closure-access-spans.rs:7:5 + --> $DIR/closure-access-spans.rs:5:5 | LL | let r = &mut x; | ------ mutable borrow occurs here @@ -11,7 +11,7 @@ LL | r.use_mut(); | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/closure-access-spans.rs:13:5 + --> $DIR/closure-access-spans.rs:11:5 | LL | let r = &mut x; | ------ first mutable borrow occurs here @@ -23,7 +23,7 @@ LL | r.use_mut(); | - first borrow later used here error[E0500]: closure requires unique access to `x` but it is already borrowed - --> $DIR/closure-access-spans.rs:19:5 + --> $DIR/closure-access-spans.rs:17:5 | LL | let r = &mut x; | ------ borrow occurs here @@ -35,7 +35,7 @@ LL | r.use_mut(); | - first borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/closure-access-spans.rs:25:13 + --> $DIR/closure-access-spans.rs:23:13 | LL | let r = &mut x; | ------ borrow of `x` occurs here @@ -45,7 +45,7 @@ LL | r.use_ref(); | - borrow later used here error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/closure-access-spans.rs:31:5 + --> $DIR/closure-access-spans.rs:29:5 | LL | let r = &x; | -- borrow of `x` occurs here @@ -57,7 +57,7 @@ LL | r.use_ref(); | - borrow later used here error[E0382]: borrow of moved value: `x` - --> $DIR/closure-access-spans.rs:37:5 + --> $DIR/closure-access-spans.rs:35:5 | LL | fn closure_imm_capture_moved(mut x: String) { | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -69,7 +69,7 @@ LL | || x.len(); | value borrowed here after move error[E0382]: borrow of moved value: `x` - --> $DIR/closure-access-spans.rs:42:5 + --> $DIR/closure-access-spans.rs:40:5 | LL | fn closure_mut_capture_moved(mut x: String) { | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -81,7 +81,7 @@ LL | || x = String::new(); | value borrowed here after move error[E0382]: borrow of moved value: `x` - --> $DIR/closure-access-spans.rs:47:5 + --> $DIR/closure-access-spans.rs:45:5 | LL | fn closure_unique_capture_moved(x: &mut String) { | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait @@ -93,7 +93,7 @@ LL | || *x = String::new(); | value borrowed here after move error[E0382]: use of moved value: `x` - --> $DIR/closure-access-spans.rs:52:5 + --> $DIR/closure-access-spans.rs:50:5 | LL | fn closure_move_capture_moved(x: &mut String) { | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/closure-borrow-spans.rs b/src/test/ui/nll/closure-borrow-spans.rs index 7fc301b70380b..b38f7900e8e5e 100644 --- a/src/test/ui/nll/closure-borrow-spans.rs +++ b/src/test/ui/nll/closure-borrow-spans.rs @@ -1,7 +1,5 @@ // check that existing borrows due to a closure capture give a special note -#![feature(nll)] - fn move_while_borrowed(x: String) { let f = || x.len(); let y = x; //~ ERROR diff --git a/src/test/ui/nll/closure-borrow-spans.stderr b/src/test/ui/nll/closure-borrow-spans.stderr index 30d99d56678ce..a3bcbbab3ec69 100644 --- a/src/test/ui/nll/closure-borrow-spans.stderr +++ b/src/test/ui/nll/closure-borrow-spans.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:7:13 + --> $DIR/closure-borrow-spans.rs:5:13 | LL | let f = || x.len(); | -- - borrow occurs due to use in closure @@ -11,7 +11,7 @@ LL | f.use_ref(); | - borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/closure-borrow-spans.rs:13:13 + --> $DIR/closure-borrow-spans.rs:11:13 | LL | let f = || x; | -- - first borrow occurs due to use of `x` in closure @@ -23,7 +23,7 @@ LL | f.use_ref(); | - immutable borrow later used here error[E0597]: `x` does not live long enough - --> $DIR/closure-borrow-spans.rs:21:16 + --> $DIR/closure-borrow-spans.rs:19:16 | LL | f = || x; | -- ^ borrowed value does not live long enough @@ -35,7 +35,7 @@ LL | f.use_ref(); | - borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:28:5 + --> $DIR/closure-borrow-spans.rs:26:5 | LL | let f = || x; | -- - borrow occurs due to use in closure @@ -47,7 +47,7 @@ LL | f.use_ref(); | - borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/closure-borrow-spans.rs:34:13 + --> $DIR/closure-borrow-spans.rs:32:13 | LL | let f = || x = 0; | -- - borrow occurs due to use of `x` in closure @@ -59,7 +59,7 @@ LL | f.use_ref(); | - borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/closure-borrow-spans.rs:40:13 + --> $DIR/closure-borrow-spans.rs:38:13 | LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure @@ -71,7 +71,7 @@ LL | f.use_ref(); | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/closure-borrow-spans.rs:46:13 + --> $DIR/closure-borrow-spans.rs:44:13 | LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure @@ -83,7 +83,7 @@ LL | f.use_ref(); | - first borrow later used here error[E0597]: `x` does not live long enough - --> $DIR/closure-borrow-spans.rs:54:16 + --> $DIR/closure-borrow-spans.rs:52:16 | LL | f = || x = 0; | -- ^ borrowed value does not live long enough @@ -95,7 +95,7 @@ LL | f.use_ref(); | - borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:61:5 + --> $DIR/closure-borrow-spans.rs:59:5 | LL | let f = || x = 0; | -- - borrow occurs due to use in closure @@ -107,7 +107,7 @@ LL | f.use_ref(); | - borrow later used here error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:67:13 + --> $DIR/closure-borrow-spans.rs:65:13 | LL | let f = || *x = 0; | -- - borrow occurs due to use in closure @@ -119,7 +119,7 @@ LL | f.use_ref(); | - borrow later used here error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access - --> $DIR/closure-borrow-spans.rs:73:13 + --> $DIR/closure-borrow-spans.rs:71:13 | LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure @@ -131,7 +131,7 @@ LL | f.use_ref(); | - first borrow later used here error[E0501]: cannot borrow `x` as mutable because previous closure requires unique access - --> $DIR/closure-borrow-spans.rs:79:13 + --> $DIR/closure-borrow-spans.rs:77:13 | LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure @@ -143,7 +143,7 @@ LL | f.use_ref(); | - first borrow later used here error[E0597]: `x` does not live long enough - --> $DIR/closure-borrow-spans.rs:88:17 + --> $DIR/closure-borrow-spans.rs:86:17 | LL | f = || *x = 0; | -- ^ borrowed value does not live long enough @@ -155,7 +155,7 @@ LL | f.use_ref(); | - borrow later used here error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:95:5 + --> $DIR/closure-borrow-spans.rs:93:5 | LL | let f = || *x = 0; | -- - borrow occurs due to use in closure diff --git a/src/test/ui/nll/closure-captures.rs b/src/test/ui/nll/closure-captures.rs index 3a01f86cad890..16d90b971745a 100644 --- a/src/test/ui/nll/closure-captures.rs +++ b/src/test/ui/nll/closure-captures.rs @@ -1,8 +1,5 @@ // Some cases with closures that might be problems -#![allow(unused)] -#![feature(nll)] - // Should have one error per assignment fn one_closure(x: i32) { diff --git a/src/test/ui/nll/closure-captures.stderr b/src/test/ui/nll/closure-captures.stderr index fbd02bc8095a7..77f7d815eeb4c 100644 --- a/src/test/ui/nll/closure-captures.stderr +++ b/src/test/ui/nll/closure-captures.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:10:5 + --> $DIR/closure-captures.rs:7:5 | LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -8,7 +8,7 @@ LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:12:5 + --> $DIR/closure-captures.rs:9:5 | LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:18:9 + --> $DIR/closure-captures.rs:15:9 | LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -26,7 +26,7 @@ LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:22:9 + --> $DIR/closure-captures.rs:19:9 | LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -35,7 +35,7 @@ LL | x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:30:9 + --> $DIR/closure-captures.rs:27:9 | LL | || | ^^ cannot borrow as mutable @@ -43,7 +43,7 @@ LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:29:12 + --> $DIR/closure-captures.rs:26:12 | LL | fn_ref(|| { | ____________^ @@ -52,7 +52,7 @@ LL | | x = 1;} | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:34:9 + --> $DIR/closure-captures.rs:31:9 | LL | || | ^^ cannot borrow as mutable @@ -60,7 +60,7 @@ LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:33:12 + --> $DIR/closure-captures.rs:30:12 | LL | fn_ref(move || { | ____________^ @@ -69,7 +69,7 @@ LL | | x = 1;}); | |___________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:42:10 + --> $DIR/closure-captures.rs:39:10 | LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -78,7 +78,7 @@ LL | x = 1;} | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:41:9 + --> $DIR/closure-captures.rs:38:9 | LL | || | ^^ cannot borrow as mutable @@ -86,7 +86,7 @@ LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:40:12 + --> $DIR/closure-captures.rs:37:12 | LL | fn_ref(|| { | ____________^ @@ -95,7 +95,7 @@ LL | | x = 1;} | |________________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:46:5 + --> $DIR/closure-captures.rs:43:5 | LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -104,7 +104,7 @@ LL | x = 1;}); | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:45:9 + --> $DIR/closure-captures.rs:42:9 | LL | || | ^^ cannot borrow as mutable @@ -112,7 +112,7 @@ LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:44:12 + --> $DIR/closure-captures.rs:41:12 | LL | fn_ref(move || { | ____________^ @@ -121,7 +121,7 @@ LL | | x = 1;}); | |___________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:51:9 + --> $DIR/closure-captures.rs:48:9 | LL | || | ^^ cannot borrow as mutable @@ -129,7 +129,7 @@ LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:50:12 + --> $DIR/closure-captures.rs:47:12 | LL | fn_ref(|| { | ____________^ @@ -138,7 +138,7 @@ LL | | *x = 1;}); | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:54:9 + --> $DIR/closure-captures.rs:51:9 | LL | || | ^^ cannot borrow as mutable @@ -146,7 +146,7 @@ LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:53:12 + --> $DIR/closure-captures.rs:50:12 | LL | fn_ref(move || { | ____________^ diff --git a/src/test/ui/nll/closure-move-spans.rs b/src/test/ui/nll/closure-move-spans.rs index ffbfa9f8ae483..bf2431870a942 100644 --- a/src/test/ui/nll/closure-move-spans.rs +++ b/src/test/ui/nll/closure-move-spans.rs @@ -1,7 +1,5 @@ // check that moves due to a closure capture give a special note -#![feature(nll)] - fn move_after_move(x: String) { || x; let y = x; //~ ERROR diff --git a/src/test/ui/nll/closure-move-spans.stderr b/src/test/ui/nll/closure-move-spans.stderr index 1cc4ca85b9ff3..972dbc6a61d08 100644 --- a/src/test/ui/nll/closure-move-spans.stderr +++ b/src/test/ui/nll/closure-move-spans.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/closure-move-spans.rs:7:13 + --> $DIR/closure-move-spans.rs:5:13 | LL | fn move_after_move(x: String) { | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -11,7 +11,7 @@ LL | let y = x; | ^ value used here after move error[E0382]: borrow of moved value: `x` - --> $DIR/closure-move-spans.rs:12:13 + --> $DIR/closure-move-spans.rs:10:13 | LL | fn borrow_after_move(x: String) { | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ LL | let y = &x; | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` - --> $DIR/closure-move-spans.rs:17:13 + --> $DIR/closure-move-spans.rs:15:13 | LL | fn borrow_mut_after_move(mut x: String) { | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs b/src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs index 71d5d4053ee25..8ed6554877eae 100644 --- a/src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs +++ b/src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs @@ -1,7 +1,3 @@ -// revisions: migrate nll -//[migrate]compile-flags: -Z borrowck=migrate -#![cfg_attr(nll, feature(nll))] - // compile-pass // Test that we propagate region relations from closures precisely when there is diff --git a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs index dbc659b4aeef9..a9d2a07715d49 100644 --- a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs +++ b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs @@ -1,8 +1,6 @@ // Test that we propagate *all* requirements to the caller, not just the first // one. -#![feature(nll)] - fn once U>(f: F, s: S, t: T) -> U { f(s, t) } diff --git a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr index 332724daaa8bd..2fec9bc62d1c7 100644 --- a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr @@ -1,5 +1,5 @@ error[E0597]: `local_arr` does not live long enough - --> $DIR/propagate-multiple-requirements.rs:17:14 + --> $DIR/propagate-multiple-requirements.rs:15:14 | LL | let mut out: &mut &'static [i32] = &mut (&[1] as _); | ------------------- type annotation requires that `local_arr` is borrowed for `'static` diff --git a/src/test/ui/nll/closure-use-spans.rs b/src/test/ui/nll/closure-use-spans.rs index c7cd519cffbce..6768250dcbc0a 100644 --- a/src/test/ui/nll/closure-use-spans.rs +++ b/src/test/ui/nll/closure-use-spans.rs @@ -1,7 +1,5 @@ // check that liveness due to a closure capture gives a special note -#![feature(nll)] - fn use_as_borrow_capture(mut x: i32) { let y = &x; x = 0; //~ ERROR diff --git a/src/test/ui/nll/closure-use-spans.stderr b/src/test/ui/nll/closure-use-spans.stderr index 20696da3b8e82..ec7e0f308557d 100644 --- a/src/test/ui/nll/closure-use-spans.stderr +++ b/src/test/ui/nll/closure-use-spans.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-use-spans.rs:7:5 + --> $DIR/closure-use-spans.rs:5:5 | LL | let y = &x; | -- borrow of `x` occurs here @@ -9,7 +9,7 @@ LL | || *y; | - borrow later captured here by closure error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-use-spans.rs:13:5 + --> $DIR/closure-use-spans.rs:11:5 | LL | let y = &mut x; | ------ borrow of `x` occurs here @@ -19,7 +19,7 @@ LL | || *y = 1; | - borrow later captured here by closure error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-use-spans.rs:19:5 + --> $DIR/closure-use-spans.rs:17:5 | LL | let y = &x; | -- borrow of `x` occurs here diff --git a/src/test/ui/nll/closures-in-loops.rs b/src/test/ui/nll/closures-in-loops.rs index d2afa564734c8..491c186ecb5a0 100644 --- a/src/test/ui/nll/closures-in-loops.rs +++ b/src/test/ui/nll/closures-in-loops.rs @@ -1,8 +1,6 @@ // Test messages where a closure capture conflicts with itself because it's in // a loop. -#![feature(nll)] - fn repreated_move(x: String) { for i in 0..10 { || x; //~ ERROR diff --git a/src/test/ui/nll/closures-in-loops.stderr b/src/test/ui/nll/closures-in-loops.stderr index 692eaea92b83b..7603f9650b54a 100644 --- a/src/test/ui/nll/closures-in-loops.stderr +++ b/src/test/ui/nll/closures-in-loops.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/closures-in-loops.rs:8:9 + --> $DIR/closures-in-loops.rs:6:9 | LL | fn repreated_move(x: String) { | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -10,7 +10,7 @@ LL | || x; | value moved into closure here, in previous iteration of loop error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/closures-in-loops.rs:15:16 + --> $DIR/closures-in-loops.rs:13:16 | LL | v.push(|| x = String::new()); | ^^ - borrows occur due to use of `x` in closure @@ -18,7 +18,7 @@ LL | v.push(|| x = String::new()); | mutable borrow starts here in previous iteration of loop error[E0524]: two closures require unique access to `x` at the same time - --> $DIR/closures-in-loops.rs:22:16 + --> $DIR/closures-in-loops.rs:20:16 | LL | v.push(|| *x = String::new()); | ^^ - borrows occur due to use of `x` in closure diff --git a/src/test/ui/nll/constant-thread-locals-issue-47053.rs b/src/test/ui/nll/constant-thread-locals-issue-47053.rs index 4dd01410c5e4d..dde0ef7a5bb83 100644 --- a/src/test/ui/nll/constant-thread-locals-issue-47053.rs +++ b/src/test/ui/nll/constant-thread-locals-issue-47053.rs @@ -1,6 +1,5 @@ // Regression test for issue #47053 -#![feature(nll)] #![feature(thread_local)] #[thread_local] diff --git a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr index 16a6e59e4da3a..8afb42d66a61a 100644 --- a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr +++ b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item `FOO` - --> $DIR/constant-thread-locals-issue-47053.rs:10:5 + --> $DIR/constant-thread-locals-issue-47053.rs:9:5 | LL | FOO = 6; | ^^^^^^^ cannot assign diff --git a/src/test/ui/nll/decl-macro-illegal-copy.rs b/src/test/ui/nll/decl-macro-illegal-copy.rs index 38bdb7dd270f8..f7243294669a6 100644 --- a/src/test/ui/nll/decl-macro-illegal-copy.rs +++ b/src/test/ui/nll/decl-macro-illegal-copy.rs @@ -1,6 +1,5 @@ // Regression test for #46314 -#![feature(nll)] #![feature(decl_macro)] struct NonCopy(String); diff --git a/src/test/ui/nll/decl-macro-illegal-copy.stderr b/src/test/ui/nll/decl-macro-illegal-copy.stderr index 9232ff52393e1..7948485bd6866 100644 --- a/src/test/ui/nll/decl-macro-illegal-copy.stderr +++ b/src/test/ui/nll/decl-macro-illegal-copy.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `wrapper.inner` - --> $DIR/decl-macro-illegal-copy.rs:22:9 + --> $DIR/decl-macro-illegal-copy.rs:21:9 | LL | $wrapper.inner | -------------- value moved here diff --git a/src/test/ui/nll/get_default.nll.stderr b/src/test/ui/nll/get_default.nll.stderr new file mode 100644 index 0000000000000..279123069877f --- /dev/null +++ b/src/test/ui/nll/get_default.nll.stderr @@ -0,0 +1,48 @@ +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable + --> $DIR/get_default.rs:21:17 + | +LL | fn ok(map: &mut Map) -> &String { + | - let's call the lifetime of this reference `'1` +LL | loop { +LL | match map.get() { + | --- immutable borrow occurs here +LL | Some(v) => { +LL | return v; + | - returning this value requires that `*map` is borrowed for `'1` +... +LL | map.set(String::new()); // Ideally, this would not error. + | ^^^ mutable borrow occurs here + +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable + --> $DIR/get_default.rs:32:17 + | +LL | fn err(map: &mut Map) -> &String { + | - let's call the lifetime of this reference `'1` +LL | loop { +LL | match map.get() { + | --- immutable borrow occurs here +LL | Some(v) => { +LL | map.set(String::new()); // Both AST and MIR error here + | ^^^ mutable borrow occurs here +LL | +LL | return v; + | - returning this value requires that `*map` is borrowed for `'1` + +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable + --> $DIR/get_default.rs:37:17 + | +LL | fn err(map: &mut Map) -> &String { + | - let's call the lifetime of this reference `'1` +LL | loop { +LL | match map.get() { + | --- immutable borrow occurs here +... +LL | return v; + | - returning this value requires that `*map` is borrowed for `'1` +... +LL | map.set(String::new()); // Ideally, just AST would error here + | ^^^ mutable borrow occurs here + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/nll/issue-16223.rs b/src/test/ui/nll/issue-16223.rs index 881e202acf8d3..e75362750645c 100644 --- a/src/test/ui/nll/issue-16223.rs +++ b/src/test/ui/nll/issue-16223.rs @@ -15,7 +15,6 @@ // compile-pass -#![feature(nll)] #![feature(box_patterns)] struct Root { diff --git a/src/test/ui/nll/issue-21114-ebfull.rs b/src/test/ui/nll/issue-21114-ebfull.rs index f5738968746ee..1fe4fffa324a6 100644 --- a/src/test/ui/nll/issue-21114-ebfull.rs +++ b/src/test/ui/nll/issue-21114-ebfull.rs @@ -1,6 +1,4 @@ -// (this works, but only in NLL) // compile-pass -#![feature(nll)] use std::collections::HashMap; use std::sync::Mutex; diff --git a/src/test/ui/nll/issue-21114-kixunil.rs b/src/test/ui/nll/issue-21114-kixunil.rs index 2add951b70bc0..80a85293e5a5c 100644 --- a/src/test/ui/nll/issue-21114-kixunil.rs +++ b/src/test/ui/nll/issue-21114-kixunil.rs @@ -1,6 +1,4 @@ -// (this works, but only in NLL) // compile-pass -#![feature(nll)] fn from_stdin(min: u64) -> Vec { use std::io::BufRead; diff --git a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs index abafd330573ee..906ea32b9c42d 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs +++ b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs @@ -8,8 +8,6 @@ // meant to compile and run successfully once rust-lang/rust#54987 is // implemented. -#![feature(nll)] - struct D { x: u32, s: S, diff --git a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr index 862432a5bc6af..153d9bdf3215d 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr @@ -1,17 +1,17 @@ error[E0381]: assign of possibly uninitialized variable: `d` - --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:30:5 + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:28:5 | LL | d.x = 10; | ^^^^^^^^ use of possibly uninitialized `d` error[E0381]: assign of possibly uninitialized variable: `d` - --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:36:5 + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:34:5 | LL | d.x = 10; | ^^^^^^^^ use of possibly uninitialized `d` error[E0382]: assign of moved value: `d` - --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:43:5 + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:41:5 | LL | let mut d = D { x: 0, s: S{ y: 0, z: 0 } }; | ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait @@ -21,19 +21,19 @@ LL | d.x = 10; | ^^^^^^^^ value assigned here after move error[E0381]: assign to part of possibly uninitialized variable: `d` - --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:49:5 + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:47:5 | LL | d.s.y = 20; | ^^^^^^^^^^ use of possibly uninitialized `d.s` error[E0381]: assign to part of possibly uninitialized variable: `d` - --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:55:5 + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:53:5 | LL | d.s.y = 20; | ^^^^^^^^^^ use of possibly uninitialized `d.s` error[E0382]: assign to part of moved value: `d` - --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:62:5 + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:60:5 | LL | let mut d = D { x: 0, s: S{ y: 0, z: 0} }; | ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-22323-temp-destruction.rs b/src/test/ui/nll/issue-22323-temp-destruction.rs index 2c547fb7c7da7..6357c3ccef1f8 100644 --- a/src/test/ui/nll/issue-22323-temp-destruction.rs +++ b/src/test/ui/nll/issue-22323-temp-destruction.rs @@ -3,8 +3,6 @@ // compile-pass -#![feature(nll)] - fn main() { let _s = construct().borrow().consume_borrowed(); } diff --git a/src/test/ui/nll/issue-30104.rs b/src/test/ui/nll/issue-30104.rs index 88e49bf8df70d..27e519005f62b 100644 --- a/src/test/ui/nll/issue-30104.rs +++ b/src/test/ui/nll/issue-30104.rs @@ -2,8 +2,6 @@ // compile-pass -#![feature(nll)] - use std::ops::{Deref, DerefMut}; fn box_two_field(v: &mut Box<(i32, i32)>) { diff --git a/src/test/ui/nll/issue-32382-index-assoc-type-with-lifetime.rs b/src/test/ui/nll/issue-32382-index-assoc-type-with-lifetime.rs index a114d7092ecf9..7e0ffd6cf3644 100644 --- a/src/test/ui/nll/issue-32382-index-assoc-type-with-lifetime.rs +++ b/src/test/ui/nll/issue-32382-index-assoc-type-with-lifetime.rs @@ -1,4 +1,3 @@ -#![feature(nll)] // compile-pass // rust-lang/rust#32382: Borrow checker used to complain about diff --git a/src/test/ui/nll/issue-43058.rs b/src/test/ui/nll/issue-43058.rs index c5bae7a12d7e7..c50473511f116 100644 --- a/src/test/ui/nll/issue-43058.rs +++ b/src/test/ui/nll/issue-43058.rs @@ -1,7 +1,5 @@ // compile-pass -#![feature(nll)] - use std::borrow::Cow; #[derive(Clone, Debug)] diff --git a/src/test/ui/nll/issue-46589.rs b/src/test/ui/nll/issue-46589.rs index 690f6f269ebcd..8c0c356e96721 100644 --- a/src/test/ui/nll/issue-46589.rs +++ b/src/test/ui/nll/issue-46589.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Foo; impl Foo { diff --git a/src/test/ui/nll/issue-46589.stderr b/src/test/ui/nll/issue-46589.stderr index 7b02b905303f1..397909a436610 100644 --- a/src/test/ui/nll/issue-46589.stderr +++ b/src/test/ui/nll/issue-46589.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `**other` as mutable more than once at a time - --> $DIR/issue-46589.rs:19:21 + --> $DIR/issue-46589.rs:17:21 | LL | *other = match (*other).get_self() { | -------- first mutable borrow occurs here diff --git a/src/test/ui/nll/issue-47022.rs b/src/test/ui/nll/issue-47022.rs index 1add2c334dae0..3f8e0f5ad3d7a 100644 --- a/src/test/ui/nll/issue-47022.rs +++ b/src/test/ui/nll/issue-47022.rs @@ -1,8 +1,5 @@ // compile-pass -#![allow(warnings)] -#![feature(nll)] - struct LoadedObject { bodies: Vec, color: Color, diff --git a/src/test/ui/nll/issue-47388.rs b/src/test/ui/nll/issue-47388.rs index df47baa3c17f0..207af380e62dd 100644 --- a/src/test/ui/nll/issue-47388.rs +++ b/src/test/ui/nll/issue-47388.rs @@ -1,4 +1,3 @@ -#![feature(nll)] struct FancyNum { num: u8, } diff --git a/src/test/ui/nll/issue-47388.stderr b/src/test/ui/nll/issue-47388.stderr index a5f5bf6ee2fdd..d4064b3f50a34 100644 --- a/src/test/ui/nll/issue-47388.stderr +++ b/src/test/ui/nll/issue-47388.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference - --> $DIR/issue-47388.rs:9:5 + --> $DIR/issue-47388.rs:8:5 | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` diff --git a/src/test/ui/nll/issue-47470.rs b/src/test/ui/nll/issue-47470.rs index 67150b46c3599..72ee7f88650e1 100644 --- a/src/test/ui/nll/issue-47470.rs +++ b/src/test/ui/nll/issue-47470.rs @@ -2,8 +2,6 @@ // causing region relations not to be enforced at all the places where // they have to be enforced. -#![feature(nll)] - struct Foo<'a>(&'a ()); trait Bar { type Assoc; diff --git a/src/test/ui/nll/issue-47470.stderr b/src/test/ui/nll/issue-47470.stderr index d23cee3fc7c4b..0b1247d60ec67 100644 --- a/src/test/ui/nll/issue-47470.stderr +++ b/src/test/ui/nll/issue-47470.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to local variable `local` - --> $DIR/issue-47470.rs:17:9 + --> $DIR/issue-47470.rs:15:9 | LL | &local | ^^^^^^ returns a reference to data owned by the current function diff --git a/src/test/ui/nll/issue-48070.rs b/src/test/ui/nll/issue-48070.rs index c69bd3dbe90a5..47426cdfa57ef 100644 --- a/src/test/ui/nll/issue-48070.rs +++ b/src/test/ui/nll/issue-48070.rs @@ -1,8 +1,6 @@ // run-pass // revisions: lxl nll -#![cfg_attr(nll, feature(nll))] - struct Foo { x: u32 } diff --git a/src/test/ui/nll/issue-48697.rs b/src/test/ui/nll/issue-48697.rs index ececd6fccd84b..16e29ab2a8ad2 100644 --- a/src/test/ui/nll/issue-48697.rs +++ b/src/test/ui/nll/issue-48697.rs @@ -1,7 +1,5 @@ // Regression test for #48697 -#![feature(nll)] - fn foo(x: &i32) -> &i32 { let z = 4; let f = &|y| y; diff --git a/src/test/ui/nll/issue-48697.stderr b/src/test/ui/nll/issue-48697.stderr index 73832fd57879c..f0c29b72b4298 100644 --- a/src/test/ui/nll/issue-48697.stderr +++ b/src/test/ui/nll/issue-48697.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `z` - --> $DIR/issue-48697.rs:9:5 + --> $DIR/issue-48697.rs:7:5 | LL | let k = f(&z); | -- `z` is borrowed here diff --git a/src/test/ui/nll/issue-50716-1.rs b/src/test/ui/nll/issue-50716-1.rs index d963a620c9ac7..ec992959a66ca 100644 --- a/src/test/ui/nll/issue-50716-1.rs +++ b/src/test/ui/nll/issue-50716-1.rs @@ -3,12 +3,8 @@ // bounds derived from `Sized` requirements” that checks that the fixed compiler // accepts this code fragment with both AST and MIR borrow checkers. // -// revisions: migrate nll -// // compile-pass -#![cfg_attr(nll, feature(nll))] - struct Qey(Q); fn main() {} diff --git a/src/test/ui/nll/issue-50716.nll.stderr b/src/test/ui/nll/issue-50716.nll.stderr new file mode 100644 index 0000000000000..38dd1b5f6fe73 --- /dev/null +++ b/src/test/ui/nll/issue-50716.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-50716.rs:14:14 + | +LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) + | -- lifetime `'a` defined here +... +LL | let _x = *s; + | ^^ proving this value is `Sized` requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/issue-50716.rs b/src/test/ui/nll/issue-50716.rs index ce4bee366567c..c2fc345fa2ba2 100644 --- a/src/test/ui/nll/issue-50716.rs +++ b/src/test/ui/nll/issue-50716.rs @@ -2,8 +2,6 @@ // Regression test for the issue #50716: NLL ignores lifetimes bounds // derived from `Sized` requirements -#![feature(nll)] - trait A { type X: ?Sized; } diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.stderr index 7e5ffb515011b..b19e3a9dfb345 100644 --- a/src/test/ui/nll/issue-50716.stderr +++ b/src/test/ui/nll/issue-50716.stderr @@ -1,11 +1,18 @@ -error: lifetime may not live long enough - --> $DIR/issue-50716.rs:16:14 +error[E0308]: mismatched types + --> $DIR/issue-50716.rs:14:9 | -LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) - | -- lifetime `'a` defined here -... LL | let _x = *s; - | ^^ proving this value is `Sized` requires that `'a` must outlive `'static` + | ^^ lifetime mismatch + | + = note: expected type `std::marker::Sized` + found type `std::marker::Sized` +note: the lifetime 'a as defined on the function body at 9:8... + --> $DIR/issue-50716.rs:9:8 + | +LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) + | ^^ + = note: ...does not necessarily outlive the static lifetime error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/nll/issue-51191.rs b/src/test/ui/nll/issue-51191.rs index 6704b64869914..747bfe3a8a575 100644 --- a/src/test/ui/nll/issue-51191.rs +++ b/src/test/ui/nll/issue-51191.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Struct; impl Struct { diff --git a/src/test/ui/nll/issue-51191.stderr b/src/test/ui/nll/issue-51191.stderr index e80cd873d5aca..e226de15dc2f0 100644 --- a/src/test/ui/nll/issue-51191.stderr +++ b/src/test/ui/nll/issue-51191.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-51191.rs:6:5 + --> $DIR/issue-51191.rs:4:5 | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -11,7 +11,7 @@ LL | (&mut self).bar(); = help: a `loop` may express intention better if this is on purpose error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:8:9 + --> $DIR/issue-51191.rs:6:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | (&mut self).bar(); | try removing `&mut` here error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:13:9 + --> $DIR/issue-51191.rs:11:9 | LL | fn imm(self) { | ---- help: consider changing this to be mutable: `mut self` @@ -28,19 +28,19 @@ LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:22:9 + --> $DIR/issue-51191.rs:20:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/issue-51191.rs:22:9 + --> $DIR/issue-51191.rs:20:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:28:9 + --> $DIR/issue-51191.rs:26:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ diff --git a/src/test/ui/nll/issue-51244.rs b/src/test/ui/nll/issue-51244.rs index aaf98ddfa2777..743415d58afad 100644 --- a/src/test/ui/nll/issue-51244.rs +++ b/src/test/ui/nll/issue-51244.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn main() { let ref my_ref @ _ = 0; *my_ref = 0; diff --git a/src/test/ui/nll/issue-51244.stderr b/src/test/ui/nll/issue-51244.stderr index 6b543389af508..8a7e71e0326a0 100644 --- a/src/test/ui/nll/issue-51244.stderr +++ b/src/test/ui/nll/issue-51244.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference - --> $DIR/issue-51244.rs:5:5 + --> $DIR/issue-51244.rs:3:5 | LL | let ref my_ref @ _ = 0; | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` diff --git a/src/test/ui/nll/issue-51268.rs b/src/test/ui/nll/issue-51268.rs index c14146a3de2a1..12d0449abb19b 100644 --- a/src/test/ui/nll/issue-51268.rs +++ b/src/test/ui/nll/issue-51268.rs @@ -1,7 +1,5 @@ // ignore-tidy-linelength -#![feature(nll)] - struct Bar; impl Bar { diff --git a/src/test/ui/nll/issue-51268.stderr b/src/test/ui/nll/issue-51268.stderr index 0be181745fde2..420c94f8e1bd2 100644 --- a/src/test/ui/nll/issue-51268.stderr +++ b/src/test/ui/nll/issue-51268.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `self.thing` as mutable because it is also borrowed as immutable - --> $DIR/issue-51268.rs:18:9 + --> $DIR/issue-51268.rs:16:9 | LL | self.thing.bar(|| { | ^ --- -- immutable borrow occurs here diff --git a/src/test/ui/nll/issue-51351.rs b/src/test/ui/nll/issue-51351.rs index 939993f154f8f..b45477c7fb10d 100644 --- a/src/test/ui/nll/issue-51351.rs +++ b/src/test/ui/nll/issue-51351.rs @@ -8,8 +8,6 @@ // // compile-pass -#![feature(nll)] - fn creash<'a>() { let x: &'a () = &(); } diff --git a/src/test/ui/nll/issue-51512.rs b/src/test/ui/nll/issue-51512.rs index 7e2e6e0a16cc0..691760eb91e52 100644 --- a/src/test/ui/nll/issue-51512.rs +++ b/src/test/ui/nll/issue-51512.rs @@ -1,6 +1,3 @@ -#![allow(warnings)] -#![feature(nll)] - fn main() { let range = 0..1; let r = range; diff --git a/src/test/ui/nll/issue-51512.stderr b/src/test/ui/nll/issue-51512.stderr index a84a236ca7772..e591ca08290eb 100644 --- a/src/test/ui/nll/issue-51512.stderr +++ b/src/test/ui/nll/issue-51512.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `range` - --> $DIR/issue-51512.rs:7:13 + --> $DIR/issue-51512.rs:4:13 | LL | let range = 0..1; | ----- move occurs because `range` has type `std::ops::Range`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs index eaa809d2b3706..58416c31edde7 100644 --- a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs +++ b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs @@ -4,7 +4,6 @@ // of the fact that the type implements Drop. #![feature(nll)] -#![allow(dead_code)] pub struct S<'a> { url: &'a mut String } diff --git a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr index e8741036e1d93..34259d06d3836 100644 --- a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr +++ b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr @@ -1,5 +1,5 @@ error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:14:5 + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:13:5 | LL | fn finish_1(s: S) -> &mut String { | - has type `S<'1>` @@ -9,7 +9,7 @@ LL | } | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:19:13 + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:18:13 | LL | fn finish_2(s: S) -> &mut String { | - has type `S<'1>` @@ -19,7 +19,7 @@ LL | } | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:24:21 + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:23:21 | LL | fn finish_3(s: S) -> &mut String { | - has type `S<'1>` @@ -29,7 +29,7 @@ LL | } | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait error[E0509]: cannot move out of type `S<'_>`, which implements the `Drop` trait - --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:29:13 + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:28:13 | LL | let p = s.url; p | ^^^^^ diff --git a/src/test/ui/nll/issue-52078.rs b/src/test/ui/nll/issue-52078.rs index ebe442adbd945..4b8e6c6807530 100644 --- a/src/test/ui/nll/issue-52078.rs +++ b/src/test/ui/nll/issue-52078.rs @@ -1,6 +1,3 @@ -#![feature(nll)] -#![allow(unused_variables)] - // Regression test for #52078: we were failing to infer a relationship // between `'a` and `'b` below due to inference variables introduced // during the normalization process. diff --git a/src/test/ui/nll/issue-52086.rs b/src/test/ui/nll/issue-52086.rs index 78765283ec29e..0414428e48150 100644 --- a/src/test/ui/nll/issue-52086.rs +++ b/src/test/ui/nll/issue-52086.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - use std::rc::Rc; use std::sync::Arc; diff --git a/src/test/ui/nll/issue-52086.stderr b/src/test/ui/nll/issue-52086.stderr index ed4171ff14261..da453fb1f921f 100644 --- a/src/test/ui/nll/issue-52086.stderr +++ b/src/test/ui/nll/issue-52086.stderr @@ -1,11 +1,11 @@ error[E0507]: cannot move out of an `Rc` - --> $DIR/issue-52086.rs:10:10 + --> $DIR/issue-52086.rs:8:10 | LL | drop(x.field); | ^^^^^^^ cannot move out of an `Rc` error[E0507]: cannot move out of an `Arc` - --> $DIR/issue-52086.rs:14:10 + --> $DIR/issue-52086.rs:12:10 | LL | drop(y.field); | ^^^^^^^ cannot move out of an `Arc` diff --git a/src/test/ui/nll/issue-52113.rs b/src/test/ui/nll/issue-52113.rs index 795f4f426ffff..0d7ee0376924d 100644 --- a/src/test/ui/nll/issue-52113.rs +++ b/src/test/ui/nll/issue-52113.rs @@ -1,6 +1,3 @@ -// - -#![allow(warnings)] #![feature(nll)] trait Bazinga {} diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index 8638fe2576980..590963ded78bc 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-52113.rs:37:5 + --> $DIR/issue-52113.rs:34:5 | LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/nll/issue-52534-1.rs b/src/test/ui/nll/issue-52534-1.rs index 7ab3593c89f7e..d9ea3ae42c49e 100644 --- a/src/test/ui/nll/issue-52534-1.rs +++ b/src/test/ui/nll/issue-52534-1.rs @@ -1,6 +1,3 @@ -#![feature(nll)] -#![allow(warnings)] - struct Test; impl Test { diff --git a/src/test/ui/nll/issue-52534-1.stderr b/src/test/ui/nll/issue-52534-1.stderr index 7d82f5e710fb1..743179f05c1af 100644 --- a/src/test/ui/nll/issue-52534-1.stderr +++ b/src/test/ui/nll/issue-52534-1.stderr @@ -1,17 +1,17 @@ error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:9:9 + --> $DIR/issue-52534-1.rs:6:9 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:16:5 + --> $DIR/issue-52534-1.rs:13:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return value referencing local variable `x` - --> $DIR/issue-52534-1.rs:22:5 + --> $DIR/issue-52534-1.rs:19:5 | LL | &&x | ^-- @@ -20,7 +20,7 @@ LL | &&x | returns a value referencing data owned by the current function error[E0515]: cannot return reference to temporary value - --> $DIR/issue-52534-1.rs:22:5 + --> $DIR/issue-52534-1.rs:19:5 | LL | &&x | ^-- @@ -29,25 +29,25 @@ LL | &&x | returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:29:5 + --> $DIR/issue-52534-1.rs:26:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:35:5 + --> $DIR/issue-52534-1.rs:32:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:41:5 + --> $DIR/issue-52534-1.rs:38:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:47:5 + --> $DIR/issue-52534-1.rs:44:5 | LL | &x | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/nll/issue-52534-2.rs b/src/test/ui/nll/issue-52534-2.rs index 6e84869dd6d3b..e416264ed09fd 100644 --- a/src/test/ui/nll/issue-52534-2.rs +++ b/src/test/ui/nll/issue-52534-2.rs @@ -1,6 +1,3 @@ -#![feature(nll)] -#![allow(warnings)] - fn foo(x: &u32) -> &u32 { let y; diff --git a/src/test/ui/nll/issue-52534-2.stderr b/src/test/ui/nll/issue-52534-2.stderr index f98deaea7183e..dd8a87f7e29aa 100644 --- a/src/test/ui/nll/issue-52534-2.stderr +++ b/src/test/ui/nll/issue-52534-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-52534-2.rs:9:9 + --> $DIR/issue-52534-2.rs:6:9 | LL | y = &x | ^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-52534.rs b/src/test/ui/nll/issue-52534.rs index 1394560df19ba..559d4c8591b34 100644 --- a/src/test/ui/nll/issue-52534.rs +++ b/src/test/ui/nll/issue-52534.rs @@ -1,6 +1,3 @@ -#![feature(nll)] -#![allow(warnings)] - fn foo(_: impl FnOnce(&u32) -> &u32) { } diff --git a/src/test/ui/nll/issue-52534.stderr b/src/test/ui/nll/issue-52534.stderr index 9ac79eda1614c..b2b727fd43893 100644 --- a/src/test/ui/nll/issue-52534.stderr +++ b/src/test/ui/nll/issue-52534.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-52534.rs:12:14 + --> $DIR/issue-52534.rs:9:14 | LL | foo(|a| &x) | - ^ `x` would have to be valid for `'0`... @@ -13,7 +13,7 @@ LL | } = note: to learn more, visit error[E0597]: `y` does not live long enough - --> $DIR/issue-52534.rs:18:26 + --> $DIR/issue-52534.rs:15:26 | LL | baz(|first, second| &y) | ----- ^ `y` would have to be valid for `'0`... diff --git a/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs b/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs index 3e57d26745a95..24a4267f653f4 100644 --- a/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs +++ b/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn expect_fn(f: F) where F : Fn() { f(); } diff --git a/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr b/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr index 0162c6bcbd1ec..8958bdf4c2a8d 100644 --- a/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr +++ b/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/issue-52663-span-decl-captured-variable.rs:10:26 + --> $DIR/issue-52663-span-decl-captured-variable.rs:8:26 | LL | let x = (vec![22], vec![44]); | - captured outer variable diff --git a/src/test/ui/nll/issue-52663-trait-object.rs b/src/test/ui/nll/issue-52663-trait-object.rs index 121c3ef4e6109..e8e571aadc368 100644 --- a/src/test/ui/nll/issue-52663-trait-object.rs +++ b/src/test/ui/nll/issue-52663-trait-object.rs @@ -1,5 +1,4 @@ #![feature(box_syntax)] -#![feature(nll)] trait Foo { fn get(&self); } diff --git a/src/test/ui/nll/issue-52663-trait-object.stderr b/src/test/ui/nll/issue-52663-trait-object.stderr index b9437d88ff674..9262117f39755 100644 --- a/src/test/ui/nll/issue-52663-trait-object.stderr +++ b/src/test/ui/nll/issue-52663-trait-object.stderr @@ -1,5 +1,5 @@ error[E0597]: `tmp0` does not live long enough - --> $DIR/issue-52663-trait-object.rs:13:20 + --> $DIR/issue-52663-trait-object.rs:12:20 | LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-52669.rs b/src/test/ui/nll/issue-52669.rs index 6027e98814128..e33528ac59e68 100644 --- a/src/test/ui/nll/issue-52669.rs +++ b/src/test/ui/nll/issue-52669.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct A { b: B, } diff --git a/src/test/ui/nll/issue-52669.stderr b/src/test/ui/nll/issue-52669.stderr index f51768c3859e4..db53e444b9e4a 100644 --- a/src/test/ui/nll/issue-52669.stderr +++ b/src/test/ui/nll/issue-52669.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `a.b` - --> $DIR/issue-52669.rs:15:5 + --> $DIR/issue-52669.rs:13:5 | LL | fn bar(mut a: A) -> B { | ----- move occurs because `a` has type `A`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-52742.nll.stderr b/src/test/ui/nll/issue-52742.nll.stderr new file mode 100644 index 0000000000000..e8b7b3333eb6b --- /dev/null +++ b/src/test/ui/nll/issue-52742.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/issue-52742.rs:14:9 + | +LL | fn take_bar(&mut self, b: Bar<'_>) { + | --------- -- let's call this `'1` + | | + | has type `&mut Foo<'_, '2>` +LL | self.y = b.z + | ^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/issue-52742.rs b/src/test/ui/nll/issue-52742.rs index 150e67fe09481..db9ddfff285b3 100644 --- a/src/test/ui/nll/issue-52742.rs +++ b/src/test/ui/nll/issue-52742.rs @@ -1,4 +1,3 @@ -#![feature(nll)] #![feature(in_band_lifetimes)] struct Foo<'a, 'b> { @@ -13,7 +12,7 @@ struct Bar<'b> { impl Foo<'_, '_> { fn take_bar(&mut self, b: Bar<'_>) { self.y = b.z - //~^ ERROR lifetime may not live long enough + //~^ ERROR } } diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.stderr index 6b25296c4bda1..b982915800294 100644 --- a/src/test/ui/nll/issue-52742.stderr +++ b/src/test/ui/nll/issue-52742.stderr @@ -1,12 +1,22 @@ -error: lifetime may not live long enough - --> $DIR/issue-52742.rs:15:9 +error[E0312]: lifetime of reference outlives lifetime of borrowed content... + --> $DIR/issue-52742.rs:14:18 | -LL | fn take_bar(&mut self, b: Bar<'_>) { - | --------- -- let's call this `'1` - | | - | has type `&mut Foo<'_, '2>` LL | self.y = b.z - | ^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + | ^^^ + | +note: ...the reference is valid for the lifetime '_ as defined on the impl at 12:10... + --> $DIR/issue-52742.rs:12:10 + | +LL | impl Foo<'_, '_> { + | ^^ +note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the method body at 13:5 + --> $DIR/issue-52742.rs:13:5 + | +LL | / fn take_bar(&mut self, b: Bar<'_>) { +LL | | self.y = b.z +LL | | +LL | | } + | |_____^ error: aborting due to previous error diff --git a/src/test/ui/nll/issue-53119.rs b/src/test/ui/nll/issue-53119.rs index 97e05c8810d09..7a47a77f6bb4c 100644 --- a/src/test/ui/nll/issue-53119.rs +++ b/src/test/ui/nll/issue-53119.rs @@ -1,7 +1,5 @@ // compile-pass -#![feature(nll)] - use std::ops::Deref; pub struct TypeFieldIterator<'a, T: 'a> { diff --git a/src/test/ui/nll/issue-53570.rs b/src/test/ui/nll/issue-53570.rs index d0baffa2702c3..cea458dcb65b9 100644 --- a/src/test/ui/nll/issue-53570.rs +++ b/src/test/ui/nll/issue-53570.rs @@ -8,10 +8,6 @@ // // compile-pass -#![feature(nll)] -#![feature(rustc_attrs)] -#![allow(dead_code)] - use std::cell::{RefCell, Ref}; trait AnyVec<'a> { diff --git a/src/test/ui/nll/issue-55288.rs b/src/test/ui/nll/issue-55288.rs index 9b3eb7f05ded4..c7b6ac5924837 100644 --- a/src/test/ui/nll/issue-55288.rs +++ b/src/test/ui/nll/issue-55288.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // run-pass struct Slice(&'static [&'static [u8]]); diff --git a/src/test/ui/nll/issue-55344.rs b/src/test/ui/nll/issue-55344.rs index b900acfa1599e..521d4d33d8633 100644 --- a/src/test/ui/nll/issue-55344.rs +++ b/src/test/ui/nll/issue-55344.rs @@ -1,7 +1,5 @@ // compile-pass -#![feature(nll)] -#![allow(unreachable_code)] #![deny(unused_mut)] pub fn foo() { diff --git a/src/test/ui/nll/issue-55394.nll.stderr b/src/test/ui/nll/issue-55394.nll.stderr new file mode 100644 index 0000000000000..d0723047ac08c --- /dev/null +++ b/src/test/ui/nll/issue-55394.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/issue-55394.rs:9:9 + | +LL | fn new(bar: &mut Bar) -> Self { + | - ---- return type is Foo<'2> + | | + | let's call the lifetime of this reference `'1` +LL | Foo { bar } + | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/issue-55394.rs b/src/test/ui/nll/issue-55394.rs index deb1034525edb..f813d1c915cf6 100644 --- a/src/test/ui/nll/issue-55394.rs +++ b/src/test/ui/nll/issue-55394.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Bar; struct Foo<'s> { @@ -8,7 +6,7 @@ struct Foo<'s> { impl Foo<'_> { fn new(bar: &mut Bar) -> Self { - Foo { bar } //~ERROR lifetime may not live long enough + Foo { bar } //~ERROR } } diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr index e9a70fd6b1617..ffb94ed7dd7c0 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.stderr @@ -1,12 +1,29 @@ -error: lifetime may not live long enough - --> $DIR/issue-55394.rs:11:9 +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements + --> $DIR/issue-55394.rs:9:9 | -LL | fn new(bar: &mut Bar) -> Self { - | - ---- return type is Foo<'2> - | | - | let's call the lifetime of this reference `'1` LL | Foo { bar } - | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` + | ^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 8:5... + --> $DIR/issue-55394.rs:8:5 + | +LL | / fn new(bar: &mut Bar) -> Self { +LL | | Foo { bar } +LL | | } + | |_____^ +note: ...so that reference does not outlive borrowed content + --> $DIR/issue-55394.rs:9:15 + | +LL | Foo { bar } + | ^^^ +note: but, the lifetime must be valid for the lifetime '_ as defined on the impl at 7:10... + --> $DIR/issue-55394.rs:7:10 + | +LL | impl Foo<'_> { + | ^^ + = note: ...so that the expression is assignable: + expected Foo<'_> + found Foo<'_> error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55401.nll.stderr b/src/test/ui/nll/issue-55401.nll.stderr new file mode 100644 index 0000000000000..4f797f26a1a7c --- /dev/null +++ b/src/test/ui/nll/issue-55401.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-55401.rs:3:5 + | +LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | let (ref y, _z): (&'a u32, u32) = (&22, 44); +LL | *y + | ^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/issue-55401.rs b/src/test/ui/nll/issue-55401.rs index 2fa234491087d..fc45824e903c8 100644 --- a/src/test/ui/nll/issue-55401.rs +++ b/src/test/ui/nll/issue-55401.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { let (ref y, _z): (&'a u32, u32) = (&22, 44); *y //~ ERROR diff --git a/src/test/ui/nll/issue-55401.stderr b/src/test/ui/nll/issue-55401.stderr index 622bc5a3f3411..50debc6386f6a 100644 --- a/src/test/ui/nll/issue-55401.stderr +++ b/src/test/ui/nll/issue-55401.stderr @@ -1,11 +1,15 @@ -error: lifetime may not live long enough - --> $DIR/issue-55401.rs:5:5 +error[E0312]: lifetime of reference outlives lifetime of borrowed content... + --> $DIR/issue-55401.rs:3:5 | -LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | let (ref y, _z): (&'a u32, u32) = (&22, 44); LL | *y - | ^^ returning this value requires that `'a` must outlive `'static` + | ^^ + | + = note: ...the reference is valid for the static lifetime... +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 1:47 + --> $DIR/issue-55401.rs:1:47 + | +LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { + | ^^ error: aborting due to previous error diff --git a/src/test/ui/nll/issue-57265-return-type-wf-check.rs b/src/test/ui/nll/issue-57265-return-type-wf-check.rs index 24c61a4926f0c..8fb8351cee260 100644 --- a/src/test/ui/nll/issue-57265-return-type-wf-check.rs +++ b/src/test/ui/nll/issue-57265-return-type-wf-check.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - use std::any::Any; #[derive(Debug, Clone)] diff --git a/src/test/ui/nll/issue-57265-return-type-wf-check.stderr b/src/test/ui/nll/issue-57265-return-type-wf-check.stderr index db01212597f5b..20add62b91ddf 100644 --- a/src/test/ui/nll/issue-57265-return-type-wf-check.stderr +++ b/src/test/ui/nll/issue-57265-return-type-wf-check.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-57265-return-type-wf-check.rs:22:23 + --> $DIR/issue-57265-return-type-wf-check.rs:20:23 | LL | let (_, z) = foo(&"hello".to_string()); | -----^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement diff --git a/src/test/ui/nll/issue-57280-1.rs b/src/test/ui/nll/issue-57280-1.rs index 356c477f1ba36..e02d6a0cb5a39 100644 --- a/src/test/ui/nll/issue-57280-1.rs +++ b/src/test/ui/nll/issue-57280-1.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // compile-pass trait Foo<'a> { diff --git a/src/test/ui/nll/issue-57280.rs b/src/test/ui/nll/issue-57280.rs index 4fe6a96f5dcc8..776a0d359cda6 100644 --- a/src/test/ui/nll/issue-57280.rs +++ b/src/test/ui/nll/issue-57280.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // compile-pass trait Foo { diff --git a/src/test/ui/nll/issue-57989.rs b/src/test/ui/nll/issue-57989.rs index 4f21cca97cc09..c410f0b0bfb4d 100644 --- a/src/test/ui/nll/issue-57989.rs +++ b/src/test/ui/nll/issue-57989.rs @@ -1,7 +1,5 @@ // Test for ICE from issue 57989 -#![feature(nll)] - fn f(x: &i32) { let g = &x; *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference diff --git a/src/test/ui/nll/issue-57989.stderr b/src/test/ui/nll/issue-57989.stderr index 7367dc095a31a..00a9bab486855 100644 --- a/src/test/ui/nll/issue-57989.stderr +++ b/src/test/ui/nll/issue-57989.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference - --> $DIR/issue-57989.rs:7:5 + --> $DIR/issue-57989.rs:5:5 | LL | fn f(x: &i32) { | ---- help: consider changing this to be a mutable reference: `&mut i32` @@ -8,7 +8,7 @@ LL | *x = 0; | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-57989.rs:7:5 + --> $DIR/issue-57989.rs:5:5 | LL | let g = &x; | -- borrow of `*x` occurs here diff --git a/src/test/ui/nll/issue-58053.rs b/src/test/ui/nll/issue-58053.rs index d4338905ed2df..0992e3a85ae94 100644 --- a/src/test/ui/nll/issue-58053.rs +++ b/src/test/ui/nll/issue-58053.rs @@ -1,4 +1,3 @@ -#![allow(warnings)] #![feature(nll)] fn main() { diff --git a/src/test/ui/nll/issue-58053.stderr b/src/test/ui/nll/issue-58053.stderr index 9048983318b36..297681ff4038a 100644 --- a/src/test/ui/nll/issue-58053.stderr +++ b/src/test/ui/nll/issue-58053.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-58053.rs:7:33 + --> $DIR/issue-58053.rs:6:33 | LL | let f = |x: &i32| -> &i32 { x }; | - ---- ^ returning this value requires that `'1` must outlive `'2` @@ -8,7 +8,7 @@ LL | let f = |x: &i32| -> &i32 { x }; | let's call the lifetime of this reference `'1` error: lifetime may not live long enough - --> $DIR/issue-58053.rs:11:25 + --> $DIR/issue-58053.rs:10:25 | LL | let g = |x: &i32| { x }; | - - ^ returning this value requires that `'1` must outlive `'2` diff --git a/src/test/ui/nll/issue-58299.rs b/src/test/ui/nll/issue-58299.rs index 9267cac5dd3d7..3277a9db8ec46 100644 --- a/src/test/ui/nll/issue-58299.rs +++ b/src/test/ui/nll/issue-58299.rs @@ -1,4 +1,3 @@ -#![allow(dead_code)] #![feature(nll)] struct A<'a>(&'a ()); diff --git a/src/test/ui/nll/issue-58299.stderr b/src/test/ui/nll/issue-58299.stderr index 0c69b70a97c77..aba07542d026e 100644 --- a/src/test/ui/nll/issue-58299.stderr +++ b/src/test/ui/nll/issue-58299.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-58299.rs:17:9 + --> $DIR/issue-58299.rs:16:9 | LL | fn foo<'a>(x: i32) { | -- lifetime `'a` defined here @@ -8,7 +8,7 @@ LL | A::<'a>::X..=A::<'static>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/issue-58299.rs:25:27 + --> $DIR/issue-58299.rs:24:27 | LL | fn bar<'a>(x: i32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs index 5b609820a237f..1de32ddf531c8 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs @@ -1,6 +1,3 @@ -#![allow(warnings)] -#![feature(nll)] - struct Wrap<'p> { p: &'p mut i32 } impl<'p> Drop for Wrap<'p> { diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr index e7755bdb89ccf..80e297807465d 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:20:5 + --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:17:5 | LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here diff --git a/src/test/ui/nll/move-errors.rs b/src/test/ui/nll/move-errors.rs index a34163737096c..e0fcd6250322d 100644 --- a/src/test/ui/nll/move-errors.rs +++ b/src/test/ui/nll/move-errors.rs @@ -1,6 +1,3 @@ -#![allow(unused)] -#![feature(nll)] - struct A(String); struct C(D); diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr index bb30da034af56..a4af11e3d40f7 100644 --- a/src/test/ui/nll/move-errors.stderr +++ b/src/test/ui/nll/move-errors.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:9:13 + --> $DIR/move-errors.rs:6:13 | LL | let b = *a; | ^^ @@ -8,7 +8,7 @@ LL | let b = *a; | help: consider removing the `*`: `a` error[E0508]: cannot move out of type `[A; 1]`, a non-copy array - --> $DIR/move-errors.rs:15:13 + --> $DIR/move-errors.rs:12:13 | LL | let b = a[0]; | ^^^^ @@ -17,7 +17,7 @@ LL | let b = a[0]; | help: consider borrowing here: `&a[0]` error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:22:13 + --> $DIR/move-errors.rs:19:13 | LL | let s = **r; | ^^^ @@ -26,7 +26,7 @@ LL | let s = **r; | help: consider removing the `*`: `*r` error[E0507]: cannot move out of an `Rc` - --> $DIR/move-errors.rs:30:13 + --> $DIR/move-errors.rs:27:13 | LL | let s = *r; | ^^ @@ -35,7 +35,7 @@ LL | let s = *r; | help: consider removing the `*`: `r` error[E0508]: cannot move out of type `[A; 1]`, a non-copy array - --> $DIR/move-errors.rs:35:13 + --> $DIR/move-errors.rs:32:13 | LL | let a = [A("".to_string())][0]; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | let a = [A("".to_string())][0]; | help: consider borrowing here: `&[A("".to_string())][0]` error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:41:16 + --> $DIR/move-errors.rs:38:16 | LL | let A(s) = *a; | - ^^ @@ -54,13 +54,13 @@ LL | let A(s) = *a; | data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:41:11 + --> $DIR/move-errors.rs:38:11 | LL | let A(s) = *a; | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait - --> $DIR/move-errors.rs:47:19 + --> $DIR/move-errors.rs:44:19 | LL | let C(D(s)) = c; | - ^ cannot move out of here @@ -68,19 +68,19 @@ LL | let C(D(s)) = c; | data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:47:13 + --> $DIR/move-errors.rs:44:13 | LL | let C(D(s)) = c; | ^ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:54:9 + --> $DIR/move-errors.rs:51:9 | LL | b = *a; | ^^ cannot move out of borrowed content error[E0508]: cannot move out of type `[B; 1]`, a non-copy array - --> $DIR/move-errors.rs:77:11 + --> $DIR/move-errors.rs:74:11 | LL | match x[0] { | ^^^^ @@ -94,7 +94,7 @@ LL | B::V(s) => (), | - ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/move-errors.rs:79:14 + --> $DIR/move-errors.rs:76:14 | LL | B::U(d) => (), | ^ @@ -102,7 +102,7 @@ LL | B::V(s) => (), | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait - --> $DIR/move-errors.rs:86:11 + --> $DIR/move-errors.rs:83:11 | LL | match x { | ^ cannot move out of here @@ -111,13 +111,13 @@ LL | B::U(D(s)) => (), | - data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:89:16 + --> $DIR/move-errors.rs:86:16 | LL | B::U(D(s)) => (), | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait - --> $DIR/move-errors.rs:95:11 + --> $DIR/move-errors.rs:92:11 | LL | match x { | ^ cannot move out of here @@ -126,13 +126,13 @@ LL | (D(s), &t) => (), | - data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:98:12 + --> $DIR/move-errors.rs:95:12 | LL | (D(s), &t) => (), | ^ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:95:11 + --> $DIR/move-errors.rs:92:11 | LL | match x { | ^ cannot move out of borrowed content @@ -141,13 +141,13 @@ LL | (D(s), &t) => (), | - data moved here | note: move occurs because `t` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:98:17 + --> $DIR/move-errors.rs:95:17 | LL | (D(s), &t) => (), | ^ error[E0509]: cannot move out of type `F`, which implements the `Drop` trait - --> $DIR/move-errors.rs:105:11 + --> $DIR/move-errors.rs:102:11 | LL | match x { | ^ cannot move out of here @@ -158,13 +158,13 @@ LL | F(s, mut t) => (), | data moved here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/move-errors.rs:107:11 + --> $DIR/move-errors.rs:104:11 | LL | F(s, mut t) => (), | ^ ^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:113:11 + --> $DIR/move-errors.rs:110:11 | LL | match *x { | ^^ @@ -176,7 +176,7 @@ LL | Ok(s) | Err(s) => (), | - data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:115:12 + --> $DIR/move-errors.rs:112:12 | LL | Ok(s) | Err(s) => (), | ^ diff --git a/src/test/ui/nll/move-subpaths-moves-root.rs b/src/test/ui/nll/move-subpaths-moves-root.rs index 72a36ef22dff7..e7caf89e78391 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.rs +++ b/src/test/ui/nll/move-subpaths-moves-root.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn main() { let x = (vec![1, 2, 3], ); drop(x.0); diff --git a/src/test/ui/nll/move-subpaths-moves-root.stderr b/src/test/ui/nll/move-subpaths-moves-root.stderr index bdbc25e9ee3d4..7030d5b3305f1 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.stderr +++ b/src/test/ui/nll/move-subpaths-moves-root.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-subpaths-moves-root.rs:6:10 + --> $DIR/move-subpaths-moves-root.rs:4:10 | LL | drop(x.0); | --- value moved here diff --git a/src/test/ui/nll/normalization-bounds-error.rs b/src/test/ui/nll/normalization-bounds-error.rs index d6610e158236c..b6cfcd98732b4 100644 --- a/src/test/ui/nll/normalization-bounds-error.rs +++ b/src/test/ui/nll/normalization-bounds-error.rs @@ -1,7 +1,6 @@ // Check that we error when a bound from the impl is not satisfied when // normalizing an associated type. -#![feature(nll)] trait Visitor<'d> { type Value; } diff --git a/src/test/ui/nll/normalization-bounds-error.stderr b/src/test/ui/nll/normalization-bounds-error.stderr index 8ee00168661bd..951e73e7fd765 100644 --- a/src/test/ui/nll/normalization-bounds-error.stderr +++ b/src/test/ui/nll/normalization-bounds-error.stderr @@ -1,16 +1,16 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements - --> $DIR/normalization-bounds-error.rs:13:1 + --> $DIR/normalization-bounds-error.rs:12:1 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 13:14... - --> $DIR/normalization-bounds-error.rs:13:14 +note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 12:14... + --> $DIR/normalization-bounds-error.rs:12:14 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ -note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 13:18... - --> $DIR/normalization-bounds-error.rs:13:18 +note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 12:18... + --> $DIR/normalization-bounds-error.rs:12:18 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ diff --git a/src/test/ui/nll/normalization-bounds.rs b/src/test/ui/nll/normalization-bounds.rs index ebc19d7cc8350..5d2825ef2d670 100644 --- a/src/test/ui/nll/normalization-bounds.rs +++ b/src/test/ui/nll/normalization-bounds.rs @@ -2,7 +2,6 @@ //run-pass -#![feature(nll)] trait Visitor<'d> { type Value; } diff --git a/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs b/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs index 061d0d69d099e..6d5bdfa4da2f0 100644 --- a/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs +++ b/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs @@ -3,8 +3,6 @@ // run-pass -#![feature(nll)] - pub fn main() { let mut x: Vec<&[i32; 0]> = Vec::new(); for i in 0..10 { diff --git a/src/test/ui/nll/promoted-bounds.rs b/src/test/ui/nll/promoted-bounds.rs index 59b21cf9ac2a9..5f95ae13c58af 100644 --- a/src/test/ui/nll/promoted-bounds.rs +++ b/src/test/ui/nll/promoted-bounds.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - fn shorten_lifetime<'a, 'b, 'min>(a: &'a i32, b: &'b i32) -> &'min i32 where 'a: 'min, diff --git a/src/test/ui/nll/promoted-bounds.stderr b/src/test/ui/nll/promoted-bounds.stderr index de185cc0d2947..df347f4e7f0fe 100644 --- a/src/test/ui/nll/promoted-bounds.stderr +++ b/src/test/ui/nll/promoted-bounds.stderr @@ -1,5 +1,5 @@ error[E0597]: `l` does not live long enough - --> $DIR/promoted-bounds.rs:21:17 + --> $DIR/promoted-bounds.rs:19:17 | LL | let ptr = { | --- borrow later stored here diff --git a/src/test/ui/nll/promoted-closure-pair.rs b/src/test/ui/nll/promoted-closure-pair.rs index 7b3bbad4c1e0c..cc9f17fd4e6bc 100644 --- a/src/test/ui/nll/promoted-closure-pair.rs +++ b/src/test/ui/nll/promoted-closure-pair.rs @@ -1,7 +1,5 @@ // Check that we handle multiple closures in the same promoted constant. -#![feature(nll)] - fn foo() -> &'static i32 { let z = 0; let p = &(|y| y, |y| y); diff --git a/src/test/ui/nll/promoted-closure-pair.stderr b/src/test/ui/nll/promoted-closure-pair.stderr index b04d1a9ccba7f..000bdf85804d8 100644 --- a/src/test/ui/nll/promoted-closure-pair.stderr +++ b/src/test/ui/nll/promoted-closure-pair.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `z` - --> $DIR/promoted-closure-pair.rs:9:5 + --> $DIR/promoted-closure-pair.rs:7:5 | LL | p.1(&z) | ^^^^--^ diff --git a/src/test/ui/nll/region-ends-after-if-condition.nll.stderr b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr new file mode 100644 index 0000000000000..322930984a545 --- /dev/null +++ b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr @@ -0,0 +1,15 @@ +error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable + --> $DIR/region-ends-after-if-condition.rs:26:9 + | +LL | let value = &my_struct.field; + | ---------------- immutable borrow occurs here +LL | if value.is_empty() { +LL | my_struct.field.push_str("Hello, world!"); + | ^^^^^^^^^^^^^^^ mutable borrow occurs here +... +LL | drop(value); + | ----- immutable borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/nll/relate_tys/issue-48071.rs b/src/test/ui/nll/relate_tys/issue-48071.rs index 9b8ac167466f7..72987629848c8 100644 --- a/src/test/ui/nll/relate_tys/issue-48071.rs +++ b/src/test/ui/nll/relate_tys/issue-48071.rs @@ -6,10 +6,6 @@ // // compile-pass -#![allow(warnings)] -#![feature(dyn_trait)] -#![feature(nll)] - trait Foo { fn foo(&self) { } } diff --git a/src/test/ui/nll/relate_tys/var-appears-twice.rs b/src/test/ui/nll/relate_tys/var-appears-twice.rs index 2f227c872598f..77129f4468f04 100644 --- a/src/test/ui/nll/relate_tys/var-appears-twice.rs +++ b/src/test/ui/nll/relate_tys/var-appears-twice.rs @@ -2,9 +2,6 @@ // function returning always its first argument can be upcast to one // that returns either first or second argument. -#![feature(nll)] -#![allow(warnings)] - use std::cell::Cell; type DoubleCell = Cell<(A, A)>; diff --git a/src/test/ui/nll/relate_tys/var-appears-twice.stderr b/src/test/ui/nll/relate_tys/var-appears-twice.stderr index 7c078d226dc0c..d032ce6f2132c 100644 --- a/src/test/ui/nll/relate_tys/var-appears-twice.stderr +++ b/src/test/ui/nll/relate_tys/var-appears-twice.stderr @@ -1,5 +1,5 @@ error[E0597]: `b` does not live long enough - --> $DIR/var-appears-twice.rs:23:38 + --> $DIR/var-appears-twice.rs:20:38 | LL | let x: DoubleCell<_> = make_cell(&b); | ------------- ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.rs b/src/test/ui/nll/return-ref-mut-issue-46557.rs index b535ab1f5e139..dca61d39dfe81 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.rs +++ b/src/test/ui/nll/return-ref-mut-issue-46557.rs @@ -1,8 +1,5 @@ // Regression test for issue #46557 -#![feature(nll)] -#![allow(dead_code)] - fn gimme_static_mut() -> &'static mut u32 { let ref mut x = 1234543; x //~ ERROR cannot return value referencing temporary value [E0515] diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr index cc201136ff212..720440a0ae5f8 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr +++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/return-ref-mut-issue-46557.rs:8:5 + --> $DIR/return-ref-mut-issue-46557.rs:5:5 | LL | let ref mut x = 1234543; | ------- temporary value created here diff --git a/src/test/ui/nll/ty-outlives/issue-53789-1.rs b/src/test/ui/nll/ty-outlives/issue-53789-1.rs index 586f076c8cabf..dc67c1a68aaf6 100644 --- a/src/test/ui/nll/ty-outlives/issue-53789-1.rs +++ b/src/test/ui/nll/ty-outlives/issue-53789-1.rs @@ -2,9 +2,6 @@ // // compile-pass -#![feature(nll)] -#![allow(unused_variables)] - use std::collections::BTreeMap; trait ValueTree { diff --git a/src/test/ui/nll/ty-outlives/issue-53789-2.rs b/src/test/ui/nll/ty-outlives/issue-53789-2.rs index de8b05aeed75c..1b80be2eaff99 100644 --- a/src/test/ui/nll/ty-outlives/issue-53789-2.rs +++ b/src/test/ui/nll/ty-outlives/issue-53789-2.rs @@ -2,9 +2,6 @@ // // compile-pass -#![feature(nll)] -#![allow(unused_variables)] - use std::collections::BTreeMap; use std::ops::Range; use std::cmp::Ord; diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr new file mode 100644 index 0000000000000..3a84cbfbedc09 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr @@ -0,0 +1,11 @@ +error[E0309]: the associated type `>::Output` may not live long enough + --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 + | +LL | bar::() + | ^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `>::Output: 'a`... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs index 9c2cbfd4a4530..dce88b88c7530 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // Test that we are able to establish that `>::Output` outlives `'b` here. We need to prove however // that `>::Output` outlives `'a`, so we also have to diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index 1aed0a545b478..1a5a3719fd86d 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -1,10 +1,15 @@ -error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-bound.rs:17:5 +error[E0309]: the associated type `>::Output` may not live long enough + --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 | LL | bar::() | ^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `>::Output: 'a`... + = help: consider adding an explicit lifetime bound `>::Output: 'a`... +note: ...so that the type `>::Output` will meet its required lifetime bounds + --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 + | +LL | bar::() + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr new file mode 100644 index 0000000000000..58bfb600452e0 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr @@ -0,0 +1,11 @@ +error[E0309]: the associated type `>::Output` may not live long enough + --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 + | +LL | bar::<>::Output>() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `>::Output: 'a`... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs index c6935badf54b2..7314766611121 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // Test that when we have a `>::Output: 'a` // relationship in the environment we take advantage of it. In this // case, that means we **don't** have to prove that `T: 'a`. diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs deleted file mode 100644 index ec5594375709b..0000000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Test that we assume that universal types like `T` outlive the -// function body. Same as ty-param-fn-body, but uses `feature(nll)`, -// which affects error reporting. - -#![feature(nll)] - -#![allow(warnings)] - -use std::cell::Cell; - -// No errors here, because `'a` is local to the body. -fn region_within_body(t: T) { - let some_int = 22; - let cell = Cell::new(&some_int); - outlives(cell, t) -} - -// Error here, because T: 'a is not satisfied. -fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) { - outlives(cell, t) - //~^ ERROR the parameter type `T` may not live long enough -} - -fn outlives<'a, T>(x: Cell<&'a usize>, y: T) -where - T: 'a, -{ -} - -fn main() {} diff --git a/src/test/ui/nll/type-alias-free-regions.nll.stderr b/src/test/ui/nll/type-alias-free-regions.nll.stderr new file mode 100644 index 0000000000000..235bf4167d521 --- /dev/null +++ b/src/test/ui/nll/type-alias-free-regions.nll.stderr @@ -0,0 +1,22 @@ +error: lifetime may not live long enough + --> $DIR/type-alias-free-regions.rs:17:9 + | +LL | impl<'a> FromBox<'a> for C<'a> { + | -- lifetime `'a` defined here +LL | fn from_box(b: Box) -> Self { + | - has type `std::boxed::Box>` +LL | C { f: b } + | ^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/type-alias-free-regions.rs:27:9 + | +LL | impl<'a> FromTuple<'a> for C<'a> { + | -- lifetime `'a` defined here +LL | fn from_tuple(b: (B,)) -> Self { + | - has type `(std::boxed::Box<&'1 isize>,)` +LL | C { f: Box::new(b.0) } + | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/type-alias-free-regions.rs b/src/test/ui/nll/type-alias-free-regions.rs index ebe6b9d20739a..fd5566f35d514 100644 --- a/src/test/ui/nll/type-alias-free-regions.rs +++ b/src/test/ui/nll/type-alias-free-regions.rs @@ -1,8 +1,6 @@ // Test that we don't assume that type aliases have the same type parameters // as the type they alias and then panic when we see this. -#![feature(nll)] - type A<'a> = &'a isize; type B<'a> = Box>; diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.stderr index 4facc2d0da0e6..00d58d34362e6 100644 --- a/src/test/ui/nll/type-alias-free-regions.stderr +++ b/src/test/ui/nll/type-alias-free-regions.stderr @@ -1,22 +1,52 @@ -error: lifetime may not live long enough - --> $DIR/type-alias-free-regions.rs:19:9 +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements + --> $DIR/type-alias-free-regions.rs:17:9 | -LL | impl<'a> FromBox<'a> for C<'a> { - | -- lifetime `'a` defined here -LL | fn from_box(b: Box) -> Self { - | - has type `std::boxed::Box>` LL | C { f: b } - | ^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` + | ^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 16:5... + --> $DIR/type-alias-free-regions.rs:16:5 + | +LL | / fn from_box(b: Box) -> Self { +LL | | C { f: b } +LL | | } + | |_____^ + = note: ...so that the expression is assignable: + expected std::boxed::Box> + found std::boxed::Box> +note: but, the lifetime must be valid for the lifetime 'a as defined on the impl at 15:6... + --> $DIR/type-alias-free-regions.rs:15:6 + | +LL | impl<'a> FromBox<'a> for C<'a> { + | ^^ + = note: ...so that the expression is assignable: + expected C<'a> + found C<'_> -error: lifetime may not live long enough - --> $DIR/type-alias-free-regions.rs:29:9 +error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements + --> $DIR/type-alias-free-regions.rs:27:16 | -LL | impl<'a> FromTuple<'a> for C<'a> { - | -- lifetime `'a` defined here -LL | fn from_tuple(b: (B,)) -> Self { - | - has type `(std::boxed::Box<&'1 isize>,)` LL | C { f: Box::new(b.0) } - | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` + | ^^^^^^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 26:5... + --> $DIR/type-alias-free-regions.rs:26:5 + | +LL | / fn from_tuple(b: (B,)) -> Self { +LL | | C { f: Box::new(b.0) } +LL | | } + | |_____^ + = note: ...so that the expression is assignable: + expected std::boxed::Box<&isize> + found std::boxed::Box<&isize> +note: but, the lifetime must be valid for the lifetime 'a as defined on the impl at 25:6... + --> $DIR/type-alias-free-regions.rs:25:6 + | +LL | impl<'a> FromTuple<'a> for C<'a> { + | ^^ + = note: ...so that the expression is assignable: + expected C<'a> + found C<'_> error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/unused-mut-issue-50343.rs b/src/test/ui/nll/unused-mut-issue-50343.rs index 06dbc47355739..da0d9229c1262 100644 --- a/src/test/ui/nll/unused-mut-issue-50343.rs +++ b/src/test/ui/nll/unused-mut-issue-50343.rs @@ -1,4 +1,3 @@ -#![feature(nll)] #![deny(unused_mut)] fn main() { diff --git a/src/test/ui/nll/unused-mut-issue-50343.stderr b/src/test/ui/nll/unused-mut-issue-50343.stderr index ef31dd7b29a40..261d678db6758 100644 --- a/src/test/ui/nll/unused-mut-issue-50343.stderr +++ b/src/test/ui/nll/unused-mut-issue-50343.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/unused-mut-issue-50343.rs:5:33 + --> $DIR/unused-mut-issue-50343.rs:4:33 | LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); | ----^ @@ -7,7 +7,7 @@ LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); | help: remove this `mut` | note: lint level defined here - --> $DIR/unused-mut-issue-50343.rs:2:9 + --> $DIR/unused-mut-issue-50343.rs:1:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.rs b/src/test/ui/nll/user-annotations/adt-brace-enums.rs index 842ebae261819..0d9828342d8cb 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.rs +++ b/src/test/ui/nll/user-annotations/adt-brace-enums.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - enum SomeEnum { SomeVariant { t: T } } diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr index 38f068746a678..e38b77fdcea01 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:27:48 + --> $DIR/adt-brace-enums.rs:25:48 | LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:32:43 + --> $DIR/adt-brace-enums.rs:30:43 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:42:47 + --> $DIR/adt-brace-enums.rs:40:47 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.rs b/src/test/ui/nll/user-annotations/adt-brace-structs.rs index d7ebbe8eb5fc0..bdbfd87d584d9 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.rs +++ b/src/test/ui/nll/user-annotations/adt-brace-structs.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - struct SomeStruct { t: T } fn no_annot() { diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr index 25a9de480b2ca..3c3003477c2d6 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:25:37 + --> $DIR/adt-brace-structs.rs:23:37 | LL | SomeStruct::<&'static u32> { t: &c }; | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:30:32 + --> $DIR/adt-brace-structs.rs:28:32 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:40:36 + --> $DIR/adt-brace-structs.rs:38:36 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.rs b/src/test/ui/nll/user-annotations/adt-nullary-enums.rs index 7a8f55a800b92..53853668d1978 100644 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.rs +++ b/src/test/ui/nll/user-annotations/adt-nullary-enums.rs @@ -1,7 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] #![allow(warnings)] use std::cell::Cell; diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr index 1afbac7c4b2ef..bb70341222880 100644 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:34:41 + --> $DIR/adt-nullary-enums.rs:33:41 | LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- @@ -11,7 +11,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:42:41 + --> $DIR/adt-nullary-enums.rs:41:41 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -26,7 +26,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:55:45 + --> $DIR/adt-nullary-enums.rs:54:45 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.rs b/src/test/ui/nll/user-annotations/adt-tuple-enums.rs index 085596ecc53ee..efe8dfda1910a 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.rs +++ b/src/test/ui/nll/user-annotations/adt-tuple-enums.rs @@ -1,7 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] #![allow(warnings)] enum SomeEnum { diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr index cd625653ace20..810912bf88618 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:29:43 + --> $DIR/adt-tuple-enums.rs:28:43 | LL | SomeEnum::SomeVariant::<&'static u32>(&c); | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:34:38 + --> $DIR/adt-tuple-enums.rs:33:38 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:44:42 + --> $DIR/adt-tuple-enums.rs:43:42 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.rs b/src/test/ui/nll/user-annotations/adt-tuple-struct.rs index ebbe3cd2c8988..37284e1fda82b 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.rs +++ b/src/test/ui/nll/user-annotations/adt-tuple-struct.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - struct SomeStruct(T); fn no_annot() { diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr index 2bb58bb2590b3..4d2140eca1b02 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:25:32 + --> $DIR/adt-tuple-struct.rs:23:32 | LL | SomeStruct::<&'static u32>(&c); | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:30:27 + --> $DIR/adt-tuple-struct.rs:28:27 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:40:31 + --> $DIR/adt-tuple-struct.rs:38:31 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs b/src/test/ui/nll/user-annotations/cast_static_lifetime.rs index 4756c771f6eaa..bb6129dacda8d 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.rs @@ -1,5 +1,4 @@ #![allow(warnings)] -#![feature(nll)] fn main() { let x = 22_u32; diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr index 0228b56d761f3..4599d04e7e230 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/cast_static_lifetime.rs:6:19 + --> $DIR/cast_static_lifetime.rs:5:19 | LL | let y: &u32 = (&x) as &'static u32; | ^^^^---------------- diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr new file mode 100644 index 0000000000000..c39301588acfa --- /dev/null +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/constant-in-expr-inherent-1.rs:8:5 + | +LL | fn foo<'a>(_: &'a u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | >::C + | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs index 9f0c60967efb2..e3a8a5f58dfda 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Foo<'a> { x: &'a u32 } impl<'a> Foo<'a> { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr index 9a28fbd11339f..77e1339dc161d 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr @@ -1,10 +1,23 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-inherent-1.rs:10:5 +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements + --> $DIR/constant-in-expr-inherent-1.rs:8:5 + | +LL | >::C + | ^^^^^^^^^^^^ + | +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 7:8... + --> $DIR/constant-in-expr-inherent-1.rs:7:8 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here + | ^^ + = note: ...so that the types are compatible: + expected Foo<'_> + found Foo<'a> + = note: but, the lifetime must be valid for the static lifetime... +note: ...so that reference does not outlive borrowed content + --> $DIR/constant-in-expr-inherent-1.rs:8:5 + | LL | >::C - | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs index 123be6b3e4098..90696d4b17d8d 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs @@ -1,8 +1,6 @@ // Test that we still check constants are well-formed, even when we there's no // type annotation to check. -#![feature(nll)] - const FUN: fn(&'static ()) = |_| {}; struct A; impl A { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr index 07e2e1e85cb78..12065a85aa4a0 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:25:9 + --> $DIR/constant-in-expr-inherent-2.rs:23:9 | LL | FUN(&x); | ----^^- @@ -11,7 +11,7 @@ LL | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:26:23 + --> $DIR/constant-in-expr-inherent-2.rs:24:23 | LL | A::ASSOCIATED_FUN(&x); | ------------------^^- @@ -23,7 +23,7 @@ LL | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:27:28 + --> $DIR/constant-in-expr-inherent-2.rs:25:28 | LL | B::ALSO_ASSOCIATED_FUN(&x); | -----------------------^^- @@ -35,7 +35,7 @@ LL | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:28:31 + --> $DIR/constant-in-expr-inherent-2.rs:26:31 | LL | <_>::TRAIT_ASSOCIATED_FUN(&x); | --------------------------^^- diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr new file mode 100644 index 0000000000000..541a2cfaf299a --- /dev/null +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/constant-in-expr-normalize.rs:18:5 + | +LL | fn foo<'a>(_: &'a u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | <() as Foo<'a>>::C + | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs index 4292fc710e98b..b7095430d8bd2 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - trait Mirror { type Me; } diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr index 5e66a30d7c332..f49d68458bea5 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr @@ -1,10 +1,15 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-normalize.rs:20:5 +error[E0312]: lifetime of reference outlives lifetime of borrowed content... + --> $DIR/constant-in-expr-normalize.rs:18:5 | -LL | fn foo<'a>(_: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here LL | <() as Foo<'a>>::C - | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^^^^^ + | + = note: ...the reference is valid for the static lifetime... +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 17:8 + --> $DIR/constant-in-expr-normalize.rs:17:8 + | +LL | fn foo<'a>(_: &'a u32) -> &'static u32 { + | ^^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr new file mode 100644 index 0000000000000..ea0fcb6d634cd --- /dev/null +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/constant-in-expr-trait-item-1.rs:10:5 + | +LL | fn foo<'a>(_: &'a u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | <() as Foo<'a>>::C + | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs index daa0d7bc24140..e0400b2cc0267 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - trait Foo<'a> { const C: &'a u32; } diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr index c96838f259a81..451bcf41e42a9 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr @@ -1,10 +1,15 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-1.rs:12:5 +error[E0312]: lifetime of reference outlives lifetime of borrowed content... + --> $DIR/constant-in-expr-trait-item-1.rs:10:5 | -LL | fn foo<'a>(_: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here LL | <() as Foo<'a>>::C - | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^^^^^ + | + = note: ...the reference is valid for the static lifetime... +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 9:8 + --> $DIR/constant-in-expr-trait-item-1.rs:9:8 + | +LL | fn foo<'a>(_: &'a u32) -> &'static u32 { + | ^^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr new file mode 100644 index 0000000000000..ff549f1d88bd4 --- /dev/null +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/constant-in-expr-trait-item-2.rs:10:5 + | +LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { + | -- lifetime `'a` defined here +LL | >::C + | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs index cd66e7a49cb83..73c4e577b05c0 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - trait Foo<'a> { const C: &'a u32; } diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr index fcc3c40e43f74..d129e55e1e6f6 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr @@ -1,10 +1,15 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-2.rs:12:5 +error[E0312]: lifetime of reference outlives lifetime of borrowed content... + --> $DIR/constant-in-expr-trait-item-2.rs:10:5 | -LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { - | -- lifetime `'a` defined here LL | >::C - | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^^^^ + | + = note: ...the reference is valid for the static lifetime... +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 9:8 + --> $DIR/constant-in-expr-trait-item-2.rs:9:8 + | +LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { + | ^^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr new file mode 100644 index 0000000000000..7f160d8e398b9 --- /dev/null +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + | +LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { + | -- lifetime `'a` defined here +LL | T::C + | ^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs index f83ae2438e6d5..567e31ef93632 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - trait Foo<'a> { const C: &'a u32; } diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr index c91370c810c8e..77655fe091b62 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr @@ -1,10 +1,23 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-3.rs:12:5 +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements + --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + | +LL | T::C + | ^^^^ + | +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:8... + --> $DIR/constant-in-expr-trait-item-3.rs:9:8 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { - | -- lifetime `'a` defined here + | ^^ + = note: ...so that the types are compatible: + expected Foo<'_> + found Foo<'a> + = note: but, the lifetime must be valid for the static lifetime... +note: ...so that reference does not outlive borrowed content + --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + | LL | T::C - | ^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/fns.rs b/src/test/ui/nll/user-annotations/fns.rs index 1e5e9340bef51..38db6d1c4c56f 100644 --- a/src/test/ui/nll/user-annotations/fns.rs +++ b/src/test/ui/nll/user-annotations/fns.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - fn some_fn(arg: T) { } fn no_annot() { diff --git a/src/test/ui/nll/user-annotations/fns.stderr b/src/test/ui/nll/user-annotations/fns.stderr index dadce24159e83..e0640da39e2b6 100644 --- a/src/test/ui/nll/user-annotations/fns.stderr +++ b/src/test/ui/nll/user-annotations/fns.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:25:29 + --> $DIR/fns.rs:23:29 | LL | some_fn::<&'static u32>(&c); | ------------------------^^- @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:30:24 + --> $DIR/fns.rs:28:24 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:40:28 + --> $DIR/fns.rs:38:28 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs b/src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs index 0a8a6793dc782..6b9d30f5ab425 100644 --- a/src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs +++ b/src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs @@ -1,5 +1,4 @@ // compile-pass -#![feature(nll)] // This test is reduced from a scenario pnkfelix encountered while // bootstrapping the compiler. diff --git a/src/test/ui/nll/user-annotations/issue-55219.rs b/src/test/ui/nll/user-annotations/issue-55219.rs index 7daa5a59b9977..4d18e96cc1543 100644 --- a/src/test/ui/nll/user-annotations/issue-55219.rs +++ b/src/test/ui/nll/user-annotations/issue-55219.rs @@ -5,8 +5,6 @@ // // run-pass -#![feature(nll)] - pub struct Foo(T); impl Foo { diff --git a/src/test/ui/nll/user-annotations/issue-55241.rs b/src/test/ui/nll/user-annotations/issue-55241.rs index d7686b9dc9411..29969c7b4c6c8 100644 --- a/src/test/ui/nll/user-annotations/issue-55241.rs +++ b/src/test/ui/nll/user-annotations/issue-55241.rs @@ -7,8 +7,6 @@ // // run-pass -#![feature(nll)] - pub trait Hasher { type Out: Eq; } diff --git a/src/test/ui/nll/user-annotations/method-call.rs b/src/test/ui/nll/user-annotations/method-call.rs index 59d1513c4c38e..beafc597ac113 100644 --- a/src/test/ui/nll/user-annotations/method-call.rs +++ b/src/test/ui/nll/user-annotations/method-call.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - trait Bazoom { fn method(&self, arg: T, arg2: U) { } } diff --git a/src/test/ui/nll/user-annotations/method-call.stderr b/src/test/ui/nll/user-annotations/method-call.stderr index 7e5314614f346..10447e45a6d42 100644 --- a/src/test/ui/nll/user-annotations/method-call.stderr +++ b/src/test/ui/nll/user-annotations/method-call.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:38:34 + --> $DIR/method-call.rs:36:34 | LL | a.method::<&'static u32>(b, &c); | -----------------------------^^- @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:45:29 + --> $DIR/method-call.rs:43:29 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:59:33 + --> $DIR/method-call.rs:57:33 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.rs b/src/test/ui/nll/user-annotations/method-ufcs-1.rs index 7968a9f6c4fd5..950771f35e49c 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-1.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - trait Bazoom: Sized { fn method(self, arg: T, arg2: U) { } } diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr index 12b02ba33f725..962ddfd2bd151 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:32:7 + --> $DIR/method-ufcs-1.rs:30:7 | LL | x(&a, b, c); | --^^------- @@ -10,7 +10,7 @@ LL | } | - `a` dropped here while still borrowed error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:39:36 + --> $DIR/method-ufcs-1.rs:37:36 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `a` dropped here while still borrowed error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:53:41 + --> $DIR/method-ufcs-1.rs:51:41 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.rs b/src/test/ui/nll/user-annotations/method-ufcs-2.rs index a1d0e7b4c9208..7dc0f0c12a43e 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-2.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - trait Bazoom: Sized { fn method(self, arg: T, arg2: U) { } } diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr index a55ed1aa272ad..63d59905e1c38 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-2.rs:32:7 + --> $DIR/method-ufcs-2.rs:30:7 | LL | x(&a, b, c); | --^^------- @@ -10,7 +10,7 @@ LL | } | - `a` dropped here while still borrowed error[E0597]: `b` does not live long enough - --> $DIR/method-ufcs-2.rs:39:39 + --> $DIR/method-ufcs-2.rs:37:39 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `b` dropped here while still borrowed error[E0597]: `b` does not live long enough - --> $DIR/method-ufcs-2.rs:53:44 + --> $DIR/method-ufcs-2.rs:51:44 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.rs b/src/test/ui/nll/user-annotations/method-ufcs-3.rs index ea480c03c3503..59d2009d14bdf 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-3.rs @@ -1,8 +1,6 @@ // Unit test for the "user substitutions" that are annotated on each // node. -#![feature(nll)] - trait Bazoom { fn method(&self, arg: T, arg2: U) { } } diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr index 140bda2df4147..e7851833e93b2 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:38:53 + --> $DIR/method-ufcs-3.rs:36:53 | LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); | ------------------------------------------------^^- @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:45:48 + --> $DIR/method-ufcs-3.rs:43:48 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:59:52 + --> $DIR/method-ufcs-3.rs:57:52 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs index a77d6af5323c2..cfbc0bcf6b0fc 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // Check that substitutions given on the self type (here, `A`) can be // used in combination with annotations given for method arguments. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr index 4dc534b2e77ac..06f20d9b23559 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-2.rs:16:37 + --> $DIR/method-ufcs-inherent-2.rs:14:37 | LL | fn foo<'a>() { | -- lifetime `'a` defined here @@ -14,7 +14,7 @@ LL | } | - `v` dropped here while still borrowed error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-2.rs:16:41 + --> $DIR/method-ufcs-inherent-2.rs:14:41 | LL | fn foo<'a>() { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs index 3f88c3df48e00..85e7597390d5c 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - // Check that inherent methods invoked with `::new` style // carry their annotations through to NLL in connection with // method type parameters. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr index a41cf50465e87..0f83e99cdfb92 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr @@ -1,5 +1,5 @@ error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-4.rs:17:37 + --> $DIR/method-ufcs-inherent-4.rs:15:37 | LL | fn foo<'a>() { | -- lifetime `'a` defined here @@ -14,7 +14,7 @@ LL | } | - `v` dropped here while still borrowed error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-4.rs:17:41 + --> $DIR/method-ufcs-inherent-4.rs:15:41 | LL | fn foo<'a>() { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/normalization.rs b/src/test/ui/nll/user-annotations/normalization.rs index e0af2e67e1836..870e3d8110cd5 100644 --- a/src/test/ui/nll/user-annotations/normalization.rs +++ b/src/test/ui/nll/user-annotations/normalization.rs @@ -1,8 +1,6 @@ // Test that we enforce a `&'static` requirement that is only visible // after normalization. -#![feature(nll)] - trait Foo { type Out; } impl Foo for () { type Out = &'static u32; } diff --git a/src/test/ui/nll/user-annotations/normalization.stderr b/src/test/ui/nll/user-annotations/normalization.stderr index fe93c3edba87a..4c7893789a535 100644 --- a/src/test/ui/nll/user-annotations/normalization.stderr +++ b/src/test/ui/nll/user-annotations/normalization.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/normalization.rs:11:31 + --> $DIR/normalization.rs:9:31 | LL | let b: <() as Foo>::Out = &a; | ---------------- ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/normalize-self-ty.rs b/src/test/ui/nll/user-annotations/normalize-self-ty.rs index d97cc88dd9af4..a06229a02032a 100644 --- a/src/test/ui/nll/user-annotations/normalize-self-ty.rs +++ b/src/test/ui/nll/user-annotations/normalize-self-ty.rs @@ -4,8 +4,6 @@ // // run-pass -#![feature(nll)] - trait Mirror { type Me; } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs index 526134b6e4b3c..59cd69c0ca55d 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - enum Foo<'a> { Bar { field: &'a u32 } } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr index b483f219c9007..a97e7a9fd46fc 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_enum_variant.rs:9:33 + --> $DIR/pattern_substs_on_brace_enum_variant.rs:7:33 | LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - `y` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_enum_variant.rs:16:33 + --> $DIR/pattern_substs_on_brace_enum_variant.rs:14:33 | LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs index 1c92858eb3a08..1586c4ea30c62 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Foo<'a> { field: &'a u32 } fn in_let() { diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr index 9c888b0bffe53..408d7c2a5e2a5 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_struct.rs:7:28 + --> $DIR/pattern_substs_on_brace_struct.rs:5:28 | LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - `y` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_struct.rs:14:28 + --> $DIR/pattern_substs_on_brace_struct.rs:12:28 | LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs index d6c364f8e3f0c..6fa59fdd8d899 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - enum Foo<'a> { Bar(&'a u32) } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr index 698cff51126f9..920c906f63a58 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_enum_variant.rs:9:24 + --> $DIR/pattern_substs_on_tuple_enum_variant.rs:7:24 | LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - `y` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_enum_variant.rs:16:24 + --> $DIR/pattern_substs_on_tuple_enum_variant.rs:14:24 | LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs index 626ca90879787..7486aab0e0883 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct Foo<'a>(&'a u32); fn in_let() { diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr index b5f2cb8e321ab..3f01638d84757 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_struct.rs:7:19 + --> $DIR/pattern_substs_on_tuple_struct.rs:5:19 | LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - `y` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_struct.rs:14:19 + --> $DIR/pattern_substs_on_tuple_struct.rs:12:19 | LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.rs b/src/test/ui/nll/user-annotations/promoted-annotation.rs index fa2d2fb81183d..b92f8bfd23b23 100644 --- a/src/test/ui/nll/user-annotations/promoted-annotation.rs +++ b/src/test/ui/nll/user-annotations/promoted-annotation.rs @@ -1,7 +1,5 @@ // Test that type annotations are checked in promoted constants correctly. -#![feature(nll)] - fn foo<'a>() { let x = 0; let f = &drop::<&'a i32>; diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.stderr b/src/test/ui/nll/user-annotations/promoted-annotation.stderr index d8b01f22145db..cb99a6a369d0b 100644 --- a/src/test/ui/nll/user-annotations/promoted-annotation.stderr +++ b/src/test/ui/nll/user-annotations/promoted-annotation.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/promoted-annotation.rs:8:7 + --> $DIR/promoted-annotation.rs:6:7 | LL | fn foo<'a>() { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs index 362fe51c3ea37..101b5cfabb3d0 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs @@ -1,5 +1,4 @@ #![allow(warnings)] -#![feature(nll)] #![feature(type_ascription)] fn main() { diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr index 93dbf7cb1b310..133bbef52311d 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/type_ascription_static_lifetime.rs:7:19 + --> $DIR/type_ascription_static_lifetime.rs:6:19 | LL | let y: &u32 = &x: &'static u32; | ^^-------------- diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr new file mode 100644 index 0000000000000..19cdd66ef759c --- /dev/null +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/object-lifetime-default-elision.rs:71:5 + | +LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | ss + | ^^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr new file mode 100644 index 0000000000000..9e68647214c27 --- /dev/null +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr @@ -0,0 +1,28 @@ +error[E0621]: explicit lifetime required in the type of `ss` + --> $DIR/object-lifetime-default-from-box-error.rs:18:5 + | +LL | fn load(ss: &mut SomeStruct) -> Box { + | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` +... +LL | ss.r + | ^^^^ lifetime `'static` required + +error[E0507]: cannot move out of borrowed content + --> $DIR/object-lifetime-default-from-box-error.rs:18:5 + | +LL | ss.r + | ^^^^ cannot move out of borrowed content + +error[E0621]: explicit lifetime required in the type of `ss` + --> $DIR/object-lifetime-default-from-box-error.rs:31:5 + | +LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { + | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` +... +LL | ss.r = b; + | ^^^^ lifetime `'b` required + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0507, E0621. +For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr new file mode 100644 index 0000000000000..6d183ddf22d19 --- /dev/null +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:5 + | +LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { + | -- lifetime `'a` defined here +LL | ss.t = t; + | ^^^^^^^^ assignment requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr new file mode 100644 index 0000000000000..fe3b21fa39c57 --- /dev/null +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:5 + | +LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + | -- lifetime `'a` defined here +LL | ss.t = t; + | ^^^^^^^^ assignment requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr new file mode 100644 index 0000000000000..448fe9e55109c --- /dev/null +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr @@ -0,0 +1,21 @@ +error: lifetime may not live long enough + --> $DIR/object-lifetime-default-mybox.rs:27:5 + | +LL | fn load1<'a,'b>(a: &'a MyBox, + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | a + | ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/object-lifetime-default-mybox.rs:31:5 + | +LL | fn load2<'a>(ss: &MyBox) -> MyBox { + | -- `ss` is a reference that is only valid in the function body +LL | load0(ss) + | ^^^^^^^^^ `ss` escapes the function body here + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/pattern/pattern-bindings-after-at.nll.stderr b/src/test/ui/pattern/pattern-bindings-after-at.nll.stderr new file mode 100644 index 0000000000000..35ee7877f2f78 --- /dev/null +++ b/src/test/ui/pattern/pattern-bindings-after-at.nll.stderr @@ -0,0 +1,22 @@ +error[E0303]: pattern bindings are not allowed after an `@` + --> $DIR/pattern-bindings-after-at.rs:8:31 + | +LL | ref mut z @ &mut Some(ref a) => { + | ^^^^^ not allowed after `@` + +error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable + --> $DIR/pattern-bindings-after-at.rs:8:31 + | +LL | ref mut z @ &mut Some(ref a) => { + | ----------------------^^^^^- + | | | + | | immutable borrow occurs here + | mutable borrow occurs here +... +LL | **z = None; + | ---------- mutable borrow later used here + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0303, E0502. +For more information about an error, try `rustc --explain E0303`. diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr new file mode 100644 index 0000000000000..eee331d95b9bc --- /dev/null +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.nll.stderr @@ -0,0 +1,16 @@ +error[E0005]: refutable pattern in local binding: `Err(_)` not covered + --> $DIR/recursive-types-are-not-uninhabited.rs:6:9 + | +LL | let Ok(x) = res; + | ^^^^^ pattern `Err(_)` not covered + +error[E0381]: use of possibly uninitialized variable: `x` + --> $DIR/recursive-types-are-not-uninhabited.rs:8:5 + | +LL | x + | ^ use of possibly uninitialized `x` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0005, E0381. +For more information about an error, try `rustc --explain E0005`. diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr new file mode 100644 index 0000000000000..76129b4d188d3 --- /dev/null +++ b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr @@ -0,0 +1,11 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/region-invariant-static-error-reporting.rs:15:9 + | +LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { + | - `x` is a reference that is only valid in the function body +LL | let bad = if x.is_some() { +LL | x.unwrap() + | ^^^^^^^^^^ `x` escapes the function body here + +error: aborting due to previous error + diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr new file mode 100644 index 0000000000000..24c9a315badf6 --- /dev/null +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43 + | +LL | let _: fn(&mut &isize, &mut &isize) = a; + | ^ expected concrete lifetime, found bound lifetime parameter + | + = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` + found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr new file mode 100644 index 0000000000000..6d031e9ac3b98 --- /dev/null +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56 + | +LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; + | ^ expected concrete lifetime, found bound lifetime parameter + | + = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` + found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr new file mode 100644 index 0000000000000..56e8c40c99f71 --- /dev/null +++ b/src/test/ui/regions/region-object-lifetime-2.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/region-object-lifetime-2.rs:10:5 + | +LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x.borrowed() + | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr new file mode 100644 index 0000000000000..aa91c371f41b9 --- /dev/null +++ b/src/test/ui/regions/region-object-lifetime-4.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/region-object-lifetime-4.rs:12:5 + | +LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x.borrowed() + | ^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr new file mode 100644 index 0000000000000..a54f8f5faab54 --- /dev/null +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr @@ -0,0 +1,38 @@ +error[E0621]: explicit lifetime required in the type of `v` + --> $DIR/region-object-lifetime-in-coercion.rs:8:12 + | +LL | fn a(v: &[u8]) -> Box { + | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` +LL | let x: Box = Box::new(v); + | ^^^^^^^^^^^^^^^^^^ lifetime `'static` required + +error[E0621]: explicit lifetime required in the type of `v` + --> $DIR/region-object-lifetime-in-coercion.rs:14:5 + | +LL | fn b(v: &[u8]) -> Box { + | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` +LL | Box::new(v) + | ^^^^^^^^^^^ lifetime `'static` required + +error[E0621]: explicit lifetime required in the type of `v` + --> $DIR/region-object-lifetime-in-coercion.rs:21:5 + | +LL | fn c(v: &[u8]) -> Box { + | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` +... +LL | Box::new(v) + | ^^^^^^^^^^^ lifetime `'static` required + +error: lifetime may not live long enough + --> $DIR/region-object-lifetime-in-coercion.rs:26:5 + | +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | Box::new(v) + | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr new file mode 100644 index 0000000000000..3d7aac74bd4f7 --- /dev/null +++ b/src/test/ui/regions/regions-addr-of-self.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/regions-addr-of-self.rs:7:16 + | +LL | pub fn chase_cat(&mut self) { + | - let's call the lifetime of this reference `'1` +LL | let p: &'static mut usize = &mut self.cats_chased; + | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr new file mode 100644 index 0000000000000..345e617a7a380 --- /dev/null +++ b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr @@ -0,0 +1,35 @@ +error: lifetime may not live long enough + --> $DIR/regions-addr-of-upvar-self.rs:10:20 + | +LL | let _f = || { + | -- lifetime `'1` represents this closure's body +LL | let p: &'static mut usize = &mut self.food; + | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` + | + = note: closure implements `FnMut`, so references to captured variables can't escape the closure + +error: lifetime may not live long enough + --> $DIR/regions-addr-of-upvar-self.rs:10:20 + | +LL | pub fn chase_cat(&mut self) { + | - let's call the lifetime of this reference `'1` +LL | let _f = || { +LL | let p: &'static mut usize = &mut self.food; + | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` + +error[E0597]: `self` does not live long enough + --> $DIR/regions-addr-of-upvar-self.rs:10:46 + | +LL | let _f = || { + | -- value captured here +LL | let p: &'static mut usize = &mut self.food; + | ------------------ ^^^^ borrowed value does not live long enough + | | + | type annotation requires that `self` is borrowed for `'static` +... +LL | } + | - `self` dropped here while still borrowed + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr new file mode 100644 index 0000000000000..867eafe2529d8 --- /dev/null +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:43:12 + | +LL | fn with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr new file mode 100644 index 0000000000000..86bd100538d70 --- /dev/null +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr @@ -0,0 +1,50 @@ +error: lifetime may not live long enough + --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 + | +LL | fn param_not_ok<'a>(x: &'a isize) { + | -- lifetime `'a` defined here +LL | assert_send::<&'a isize>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 + | +LL | fn param_not_ok1<'a>(_: &'a isize) { + | -- lifetime `'a` defined here +LL | assert_send::<&'a str>(); + | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 + | +LL | fn param_not_ok2<'a>(_: &'a isize) { + | -- lifetime `'a` defined here +LL | assert_send::<&'a [isize]>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 + | +LL | fn box_with_region_not_ok<'a>() { + | -- lifetime `'a` defined here +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 + | +LL | fn unsafe_ok2<'a>(_: &'a isize) { + | -- lifetime `'a` defined here +LL | assert_send::<*const &'a isize>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 + | +LL | fn unsafe_ok3<'a>(_: &'a isize) { + | -- lifetime `'a` defined here +LL | assert_send::<*mut &'a isize>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr new file mode 100644 index 0000000000000..a8ab92d75c06d --- /dev/null +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:5 + | +LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { + | -- -- lifetime `'y` defined here + | | + | lifetime `'x` defined here +LL | // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. +LL | a.bigger_region(b) + | ^^^^^^^^^^^^^^^^^^ argument requires that `'y` must outlive `'x` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr new file mode 100644 index 0000000000000..52ad2d9daeb1d --- /dev/null +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr @@ -0,0 +1,13 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:5 + | +LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { + | - - `b` is a reference that is only valid in the function body + | | + | `a` is declared here, outside of the function body +LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. +LL | f.method(b); + | ^^^^^^^^^^^ `b` escapes the function body here + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr new file mode 100644 index 0000000000000..b6d7b8aac5f19 --- /dev/null +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/regions-bounded-method-type-parameters.rs:12:9 + | +LL | fn caller<'a>(x: &isize) { + | -- lifetime `'a` defined here +LL | Foo.some_method::<&'a isize>(); + | ^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr new file mode 100644 index 0000000000000..3345946bfddff --- /dev/null +++ b/src/test/ui/regions/regions-bounds.nll.stderr @@ -0,0 +1,22 @@ +error: lifetime may not live long enough + --> $DIR/regions-bounds.rs:9:12 + | +LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | return e; + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/regions-bounds.rs:13:12 + | +LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | return e; + | ^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr new file mode 100644 index 0000000000000..92c4956da02d2 --- /dev/null +++ b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr @@ -0,0 +1,36 @@ +error[E0310]: the associated type `::Item` may not live long enough + --> $DIR/regions-close-associated-type-into-object.rs:15:5 + | +LL | Box::new(item) + | ^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `::Item: 'static`... + +error[E0310]: the associated type `::Item` may not live long enough + --> $DIR/regions-close-associated-type-into-object.rs:22:5 + | +LL | Box::new(item) + | ^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `::Item: 'static`... + +error[E0309]: the associated type `::Item` may not live long enough + --> $DIR/regions-close-associated-type-into-object.rs:28:5 + | +LL | Box::new(item) + | ^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `::Item: 'a`... + +error[E0309]: the associated type `::Item` may not live long enough + --> $DIR/regions-close-associated-type-into-object.rs:35:5 + | +LL | Box::new(item) + | ^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `::Item: 'a`... + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0309, E0310. +For more information about an error, try `rustc --explain E0309`. diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr new file mode 100644 index 0000000000000..42df9b1c49fba --- /dev/null +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -0,0 +1,20 @@ +error: lifetime may not live long enough + --> $DIR/regions-close-object-into-object-2.rs:10:5 + | +LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { + | -- lifetime `'a` defined here +LL | box B(&*v) as Box + | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error[E0515]: cannot return value referencing local data `*v` + --> $DIR/regions-close-object-into-object-2.rs:10:5 + | +LL | box B(&*v) as Box + | ^^^^^^---^^^^^^^^^^^ + | | | + | | `*v` is borrowed here + | returns a value referencing data owned by the current function + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr new file mode 100644 index 0000000000000..8af94fa7e79b8 --- /dev/null +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -0,0 +1,37 @@ +error[E0310]: the parameter type `U` may not live long enough + --> $DIR/regions-close-object-into-object-4.rs:10:5 + | +LL | box B(&*v) as Box + | ^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `U: 'static`... + +error: lifetime may not live long enough + --> $DIR/regions-close-object-into-object-4.rs:10:5 + | +LL | fn i<'a, T, U>(v: Box+'a>) -> Box { + | -- lifetime `'a` defined here +LL | box B(&*v) as Box + | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error[E0515]: cannot return value referencing local data `*v` + --> $DIR/regions-close-object-into-object-4.rs:10:5 + | +LL | box B(&*v) as Box + | ^^^^^^---^^^^^^^^^^^ + | | | + | | `*v` is borrowed here + | returns a value referencing data owned by the current function + +error[E0310]: the parameter type `U` may not live long enough + --> $DIR/regions-close-object-into-object-4.rs:10:9 + | +LL | box B(&*v) as Box + | ^^^^^^ + | + = help: consider adding an explicit lifetime bound `U: 'static`... + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0310, E0515. +For more information about an error, try `rustc --explain E0310`. diff --git a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr new file mode 100644 index 0000000000000..08ba1b17b5663 --- /dev/null +++ b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr @@ -0,0 +1,29 @@ +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/regions-close-object-into-object-5.rs:17:5 + | +LL | box B(&*v) as Box + | ^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error[E0515]: cannot return value referencing local data `*v` + --> $DIR/regions-close-object-into-object-5.rs:17:5 + | +LL | box B(&*v) as Box + | ^^^^^^---^^^^^^^^^^^ + | | | + | | `*v` is borrowed here + | returns a value referencing data owned by the current function + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/regions-close-object-into-object-5.rs:17:9 + | +LL | box B(&*v) as Box + | ^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0310, E0515. +For more information about an error, try `rustc --explain E0310`. diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr new file mode 100644 index 0000000000000..30fdb820e3630 --- /dev/null +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr @@ -0,0 +1,20 @@ +error[E0310]: the parameter type `A` may not live long enough + --> $DIR/regions-close-over-type-parameter-1.rs:10:5 + | +LL | box v as Box + | ^^^^^ + | + = help: consider adding an explicit lifetime bound `A: 'static`... + +error[E0309]: the parameter type `A` may not live long enough + --> $DIR/regions-close-over-type-parameter-1.rs:20:5 + | +LL | box v as Box + | ^^^^^ + | + = help: consider adding an explicit lifetime bound `A: 'b`... + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0309, E0310. +For more information about an error, try `rustc --explain E0309`. diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr new file mode 100644 index 0000000000000..001ed7fe4c53a --- /dev/null +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + | +LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { + | -- -- lifetime `'c` defined here + | | + | lifetime `'a` defined here +LL | // A outlives 'a AND 'b...but not 'c. +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-close-param-into-object.nll.stderr b/src/test/ui/regions/regions-close-param-into-object.nll.stderr new file mode 100644 index 0000000000000..7bd7824f00a46 --- /dev/null +++ b/src/test/ui/regions/regions-close-param-into-object.nll.stderr @@ -0,0 +1,36 @@ +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/regions-close-param-into-object.rs:6:5 + | +LL | Box::new(v) + | ^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/regions-close-param-into-object.rs:12:5 + | +LL | Box::new(v) + | ^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/regions-close-param-into-object.rs:18:5 + | +LL | Box::new(v) + | ^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'a`... + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/regions-close-param-into-object.rs:24:5 + | +LL | Box::new(v) + | ^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'a`... + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0309, E0310. +For more information about an error, try `rustc --explain E0309`. diff --git a/src/test/ui/regions/regions-creating-enums3.nll.stderr b/src/test/ui/regions/regions-creating-enums3.nll.stderr new file mode 100644 index 0000000000000..e35a878fce177 --- /dev/null +++ b/src/test/ui/regions/regions-creating-enums3.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/regions-creating-enums3.rs:7:5 + | +LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | Ast::Add(x, y) + | ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-creating-enums4.nll.stderr b/src/test/ui/regions/regions-creating-enums4.nll.stderr new file mode 100644 index 0000000000000..4eac457feda2c --- /dev/null +++ b/src/test/ui/regions/regions-creating-enums4.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/regions-creating-enums4.rs:7:5 + | +LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | Ast::Add(x, y) + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr new file mode 100644 index 0000000000000..1540a7bacd7b2 --- /dev/null +++ b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/regions-early-bound-error-method.rs:20:9 + | +LL | impl<'a> Box<'a> { + | -- lifetime `'a` defined here +LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { + | -- lifetime `'b` defined here +LL | g2.get() + | ^^^^^^^^ returning this value requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-early-bound-error.nll.stderr b/src/test/ui/regions/regions-early-bound-error.nll.stderr new file mode 100644 index 0000000000000..7836291a7caab --- /dev/null +++ b/src/test/ui/regions/regions-early-bound-error.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/regions-early-bound-error.rs:19:5 + | +LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | g1.get() + | ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-escape-method.nll.stderr b/src/test/ui/regions/regions-escape-method.nll.stderr new file mode 100644 index 0000000000000..9f425125b9896 --- /dev/null +++ b/src/test/ui/regions/regions-escape-method.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/regions-escape-method.rs:15:13 + | +LL | s.f(|p| p) + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 i32 + | has type `&'1 i32` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr new file mode 100644 index 0000000000000..cae6c33ac6e17 --- /dev/null +++ b/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/regions-escape-via-trait-or-not.rs:18:14 + | +LL | with(|o| o) + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 isize + | has type `&'1 isize` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr new file mode 100644 index 0000000000000..9ae484eaf4558 --- /dev/null +++ b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-callee.rs:13:5 + | +LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // However, it is not safe to assume that 'b <= 'a +LL | &*y + | ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-callee.rs:18:12 + | +LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // Do not infer an ordering from the return value. +LL | let z: &'b usize = &*x; + | ^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr new file mode 100644 index 0000000000000..16eda2844c64c --- /dev/null +++ b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr @@ -0,0 +1,33 @@ +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-caller.rs:11:12 + | +LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let z: Option<&'b &'a usize> = None; + | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-caller.rs:17:12 + | +LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let y: Paramd<'a> = Paramd { x: a }; +LL | let z: Option<&'b Paramd<'a>> = None; + | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-caller.rs:22:12 + | +LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let z: Option<&'a &'b usize> = None; + | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr new file mode 100644 index 0000000000000..480a81d33f64c --- /dev/null +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr @@ -0,0 +1,15 @@ +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-incorrect.rs:15:9 + | +LL | impl<'b, T> Node<'b, T> { + | -- lifetime `'b` defined here +LL | fn get<'a>(&'a self) -> &'b T { + | -- lifetime `'a` defined here +LL | / match self.next { +LL | | Some(ref next) => next.get(), +LL | | None => &self.val +LL | | } + | |_________^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr similarity index 51% rename from src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr rename to src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr index b3c02f7f42919..0f0f86dfcdd69 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr @@ -1,10 +1,10 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn-body-nll-feature.rs:20:5 + --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:5 | -LL | outlives(cell, t) - | ^^^^^^^^^^^^^^^^^ +LL | wf::<&'x T>(); + | ^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `T: 'a`... + = help: consider adding an explicit lifetime bound `T: 'x`... error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr new file mode 100644 index 0000000000000..0651e305cde35 --- /dev/null +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr @@ -0,0 +1,11 @@ +error[E0309]: the parameter type `Self` may not live long enough + --> $DIR/regions-infer-bound-from-trait-self.rs:46:9 + | +LL | check_bound(x, self) + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `Self: 'a`... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr new file mode 100644 index 0000000000000..1f7b34fc69962 --- /dev/null +++ b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr @@ -0,0 +1,19 @@ +error[E0309]: the parameter type `A` may not live long enough + --> $DIR/regions-infer-bound-from-trait.rs:33:5 + | +LL | check_bound(x, a) + | ^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `A: 'a`... + +error[E0309]: the parameter type `A` may not live long enough + --> $DIR/regions-infer-bound-from-trait.rs:37:5 + | +LL | check_bound(x, a) + | ^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `A: 'a`... + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/regions/regions-infer-call-3.nll.stderr b/src/test/ui/regions/regions-infer-call-3.nll.stderr new file mode 100644 index 0000000000000..ca51555a07749 --- /dev/null +++ b/src/test/ui/regions/regions-infer-call-3.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-call-3.rs:8:24 + | +LL | let z = with(|y| { select(x, y) }); + | -- ^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 isize + | has type `&'1 isize` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr new file mode 100644 index 0000000000000..cefeecf16e2d4 --- /dev/null +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:12 + | +LL | fn use_<'short,'long>(c: Contravariant<'short>, + | ------ ----- lifetime `'long` defined here + | | + | lifetime `'short` defined here +... +LL | let _: Contravariant<'long> = c; + | ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr new file mode 100644 index 0000000000000..1bddecba50a72 --- /dev/null +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-covariance-due-to-decl.rs:22:12 + | +LL | fn use_<'short,'long>(c: Covariant<'long>, + | ------ ----- lifetime `'long` defined here + | | + | lifetime `'short` defined here +... +LL | let _: Covariant<'short> = c; + | ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr new file mode 100644 index 0000000000000..0c1e3989b234a --- /dev/null +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 + | +LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { + | -- lifetime `'r` defined here +LL | b_isize + | ^^^^^^^ returning this value requires that `'r` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr new file mode 100644 index 0000000000000..0edeb2723998f --- /dev/null +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 + | +LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { + | -- lifetime `'r` defined here +LL | b_isize + | ^^^^^^^ returning this value requires that `'r` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr new file mode 100644 index 0000000000000..724dd7e3f6d3f --- /dev/null +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 + | +LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { + | -- lifetime `'r` defined here +LL | b_isize + | ^^^^^^^ returning this value requires that `'r` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-infer-not-param.nll.stderr b/src/test/ui/regions/regions-infer-not-param.nll.stderr new file mode 100644 index 0000000000000..2064b060ec419 --- /dev/null +++ b/src/test/ui/regions/regions-infer-not-param.nll.stderr @@ -0,0 +1,26 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-not-param.rs:15:54 + | +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } + | -- -- lifetime `'b` defined here ^ returning this value requires that `'a` must outlive `'b` + | | + | lifetime `'a` defined here + +error: lifetime may not live long enough + --> $DIR/regions-infer-not-param.rs:19:63 + | +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } + | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | | + | lifetime `'a` defined here + +error: lifetime may not live long enough + --> $DIR/regions-infer-not-param.rs:19:63 + | +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } + | -- -- lifetime `'b` defined here ^ returning this value requires that `'a` must outlive `'b` + | | + | lifetime `'a` defined here + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr new file mode 100644 index 0000000000000..a86e6ccdc5edf --- /dev/null +++ b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-infer-paramd-indirect.rs:22:9 + | +LL | impl<'a> SetF<'a> for C<'a> { + | -- lifetime `'a` defined here +... +LL | fn set_f_bad(&mut self, b: Box) { + | - has type `std::boxed::Box>` +LL | self.f = b; + | ^^^^^^ assignment requires that `'1` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr new file mode 100644 index 0000000000000..e1f14fc0cd919 --- /dev/null +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43 + | +LL | let _: fn(&mut &isize, &mut &isize) = a; + | ^ expected concrete lifetime, found bound lifetime parameter + | + = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` + found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr new file mode 100644 index 0000000000000..c11c09b6d0d51 --- /dev/null +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -0,0 +1,51 @@ +error[E0521]: borrowed data escapes outside of closure + --> $DIR/regions-nested-fns.rs:10:9 + | +LL | let mut ay = &y; + | ------ `ay` is declared here, outside of the closure body +LL | +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | - `z` is a reference that is only valid in the closure body +... +LL | ay = z; + | ^^^^^^ `z` escapes the closure body here + +error[E0597]: `y` does not live long enough + --> $DIR/regions-nested-fns.rs:5:18 + | +LL | let mut ay = &y; + | ^^ borrowed value does not live long enough +... +LL | if false { return ay; } + | -- returning this value requires that `y` is borrowed for `'static` +... +LL | } + | - `y` dropped here while still borrowed + +error[E0597]: `y` does not live long enough + --> $DIR/regions-nested-fns.rs:9:15 + | +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | --- value captured here +LL | ay = x; +LL | ay = &y; + | ^ borrowed value does not live long enough +... +LL | if false { return ay; } + | -- returning this value requires that `y` is borrowed for `'static` +... +LL | } + | - `y` dropped here while still borrowed + +error: lifetime may not live long enough + --> $DIR/regions-nested-fns.rs:14:27 + | +LL | fn nested<'x>(x: &'x isize) { + | -- lifetime `'x` defined here +... +LL | if false { return x; } + | ^ returning this value requires that `'x` must outlive `'static` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr new file mode 100644 index 0000000000000..5028663ba6d04 --- /dev/null +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container-hrtb.rs:35:12 + | +LL | fn with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'a WithHrAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container-hrtb.rs:57:12 + | +LL | fn with_assoc_sub<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'a WithHrAssocSub> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr new file mode 100644 index 0000000000000..880fe17b740e4 --- /dev/null +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container-wc.rs:37:12 + | +LL | fn with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr new file mode 100644 index 0000000000000..ef87d02ec0812 --- /dev/null +++ b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr @@ -0,0 +1,46 @@ +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container.rs:40:13 + | +LL | fn with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _x: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container.rs:58:13 + | +LL | fn without_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _x: &'a WithoutAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container.rs:67:5 + | +LL | fn call_with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | call::<&'a WithAssoc>>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container.rs:74:5 + | +LL | fn call_without_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | call::<&'a WithoutAssoc>>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr new file mode 100644 index 0000000000000..c8582f8bfe7f0 --- /dev/null +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5 + | +LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | &mut ***p + | ^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr new file mode 100644 index 0000000000000..5946e7bf84950 --- /dev/null +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5 + | +LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | &mut **p + | ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr new file mode 100644 index 0000000000000..0784e894ea920 --- /dev/null +++ b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/regions-ret-borrowed-1.rs:10:14 + | +LL | with(|o| o) + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 isize + | has type `&'1 isize` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-ret-borrowed.nll.stderr b/src/test/ui/regions/regions-ret-borrowed.nll.stderr new file mode 100644 index 0000000000000..d9be5ef89cceb --- /dev/null +++ b/src/test/ui/regions/regions-ret-borrowed.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/regions-ret-borrowed.rs:13:14 + | +LL | with(|o| o) + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 isize + | has type `&'1 isize` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr new file mode 100644 index 0000000000000..4c275b19492c6 --- /dev/null +++ b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr @@ -0,0 +1,13 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 + | +LL | let mut f = || &mut x; + | - ^^^^^^ returns a reference to a captured variable which escapes the closure body + | | + | inferred to be a `FnMut` closure + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-static-bound.ll.nll.stderr b/src/test/ui/regions/regions-static-bound.ll.nll.stderr new file mode 100644 index 0000000000000..d6cec03e0ff2e --- /dev/null +++ b/src/test/ui/regions/regions-static-bound.ll.nll.stderr @@ -0,0 +1,28 @@ +error: lifetime may not live long enough + --> $DIR/regions-static-bound.rs:9:5 + | +LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { + | -- lifetime `'a` defined here +LL | t //[ll]~ ERROR E0312 + | ^ returning this value requires that `'a` must outlive `'static` + +error[E0621]: explicit lifetime required in the type of `u` + --> $DIR/regions-static-bound.rs:14:5 + | +LL | fn error(u: &(), v: &()) { + | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()` +LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621] + | ^^^^^^^^^^^^^ lifetime `'static` required + +error[E0621]: explicit lifetime required in the type of `v` + --> $DIR/regions-static-bound.rs:16:5 + | +LL | fn error(u: &(), v: &()) { + | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()` +... +LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621] + | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/regions/regions-static-bound.migrate.nll.stderr b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr new file mode 100644 index 0000000000000..b5f3e6cfaba09 --- /dev/null +++ b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr @@ -0,0 +1,28 @@ +error: lifetime may not live long enough + --> $DIR/regions-static-bound.rs:9:5 + | +LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { + | -- lifetime `'a` defined here +LL | t + | ^ returning this value requires that `'a` must outlive `'static` + +error[E0621]: explicit lifetime required in the type of `u` + --> $DIR/regions-static-bound.rs:14:5 + | +LL | fn error(u: &(), v: &()) { + | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()` +LL | static_id(&u); + | ^^^^^^^^^^^^^ lifetime `'static` required + +error[E0621]: explicit lifetime required in the type of `v` + --> $DIR/regions-static-bound.rs:16:5 + | +LL | fn error(u: &(), v: &()) { + | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()` +... +LL | static_id_indirect(&v); + | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr new file mode 100644 index 0000000000000..eccf1b5e8cf76 --- /dev/null +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/regions-trait-object-subtyping.rs:15:5 + | +LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // Without knowing 'a:'b, we can't coerce +LL | x + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/regions-trait-object-subtyping.rs:22:5 + | +LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // We can't coerce because it is packed in `Wrapper` +LL | x + | ^ returning this value requires that `'b` must outlive `'a` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr new file mode 100644 index 0000000000000..f5b96f314c578 --- /dev/null +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:12 + | +LL | fn use_<'short,'long>(c: S<'long, 'short>, + | ------ ----- lifetime `'long` defined here + | | + | lifetime `'short` defined here +... +LL | let _: S<'long, 'long> = c; + | ^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr new file mode 100644 index 0000000000000..372510a2f7e28 --- /dev/null +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-variance-contravariant-use-covariant.rs:23:12 + | +LL | fn use_<'short,'long>(c: Contravariant<'short>, + | ------ ----- lifetime `'long` defined here + | | + | lifetime `'short` defined here +... +LL | let _: Contravariant<'long> = c; + | ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr new file mode 100644 index 0000000000000..e87e914727c5f --- /dev/null +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-variance-covariant-use-contravariant.rs:23:12 + | +LL | fn use_<'short,'long>(c: Covariant<'long>, + | ------ ----- lifetime `'long` defined here + | | + | lifetime `'short` defined here +... +LL | let _: Covariant<'short> = c; + | ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr new file mode 100644 index 0000000000000..adee33bfc7e83 --- /dev/null +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-variance-invariant-use-contravariant.rs:20:12 + | +LL | fn use_<'short,'long>(c: Invariant<'long>, + | ------ ----- lifetime `'long` defined here + | | + | lifetime `'short` defined here +... +LL | let _: Invariant<'short> = c; + | ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr new file mode 100644 index 0000000000000..15853e6ca5d69 --- /dev/null +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/regions-variance-invariant-use-covariant.rs:17:12 + | +LL | fn use_<'b>(c: Invariant<'b>) { + | -- lifetime `'b` defined here +... +LL | let _: Invariant<'static> = c; + | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs index 2f3c094ff3954..7b499af632ece 100644 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs +++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs @@ -4,7 +4,6 @@ // compile-pass -#![feature(nll)] #![feature(bind_by_move_pattern_guards)] use std::sync::mpsc::channel; diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs index 9a9d11ce1b13e..aca6aa5f0f867 100644 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs +++ b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs @@ -1,4 +1,3 @@ -#![feature(nll)] #![feature(bind_by_move_pattern_guards)] // compile-pass diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr new file mode 100644 index 0000000000000..c74b82dbbd828 --- /dev/null +++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr @@ -0,0 +1,14 @@ +error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-issue-49631.rs:20:9 + | +LL | while let Some(Ok(string)) = foo.get() { + | --- immutable borrow occurs here +LL | foo.mutate(); + | ^^^ mutable borrow occurs here +LL | +LL | println!("foo={:?}", *string); + | ------- immutable borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs index 4faede353059a..1c1230346a56c 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - #[derive(Clone)] enum Either { One(X), diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr index b1aaab6a75441..f8e043fbfdfd4 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:41:27 + --> $DIR/duplicate-suggestions.rs:39:27 | LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | --------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -9,13 +9,13 @@ LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | help: consider removing the `&`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:41:13 + --> $DIR/duplicate-suggestions.rs:39:13 | LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:45:50 + --> $DIR/duplicate-suggestions.rs:43:50 | LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -25,13 +25,13 @@ LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:45:26 + --> $DIR/duplicate-suggestions.rs:43:26 | LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:49:53 + --> $DIR/duplicate-suggestions.rs:47:53 | LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -41,13 +41,13 @@ LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:49:29 + --> $DIR/duplicate-suggestions.rs:47:29 | LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:53:11 + --> $DIR/duplicate-suggestions.rs:51:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -61,7 +61,7 @@ LL | &(Either::Two(_t), Either::One(_u)) => (), | -- ...and here -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:55:23 + --> $DIR/duplicate-suggestions.rs:53:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ @@ -78,7 +78,7 @@ LL | (Either::Two(_t), Either::One(_u)) => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:63:11 + --> $DIR/duplicate-suggestions.rs:61:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -91,13 +91,13 @@ LL | &(Either::One(_t), Either::Two(_u)) | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:65:23 + --> $DIR/duplicate-suggestions.rs:63:23 | LL | &(Either::One(_t), Either::Two(_u)) | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:72:11 + --> $DIR/duplicate-suggestions.rs:70:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -110,13 +110,13 @@ LL | &(Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:74:23 + --> $DIR/duplicate-suggestions.rs:72:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:80:11 + --> $DIR/duplicate-suggestions.rs:78:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -129,13 +129,13 @@ LL | &(Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:82:23 + --> $DIR/duplicate-suggestions.rs:80:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:93:31 + --> $DIR/duplicate-suggestions.rs:91:31 | LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -145,13 +145,13 @@ LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | help: consider removing the `&mut`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:93:17 + --> $DIR/duplicate-suggestions.rs:91:17 | LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:97:54 + --> $DIR/duplicate-suggestions.rs:95:54 | LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -161,13 +161,13 @@ LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.c | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:97:30 + --> $DIR/duplicate-suggestions.rs:95:30 | LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:101:57 + --> $DIR/duplicate-suggestions.rs:99:57 | LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -177,13 +177,13 @@ LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), e | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:101:33 + --> $DIR/duplicate-suggestions.rs:99:33 | LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:105:11 + --> $DIR/duplicate-suggestions.rs:103:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -197,7 +197,7 @@ LL | &mut (Either::Two(_t), Either::One(_u)) => (), | -- ...and here -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:107:27 + --> $DIR/duplicate-suggestions.rs:105:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ @@ -214,7 +214,7 @@ LL | (Either::Two(_t), Either::One(_u)) => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:115:11 + --> $DIR/duplicate-suggestions.rs:113:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -227,13 +227,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:117:27 + --> $DIR/duplicate-suggestions.rs:115:27 | LL | &mut (Either::One(_t), Either::Two(_u)) | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:124:11 + --> $DIR/duplicate-suggestions.rs:122:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -246,13 +246,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:126:27 + --> $DIR/duplicate-suggestions.rs:124:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:132:11 + --> $DIR/duplicate-suggestions.rs:130:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -265,13 +265,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:134:27 + --> $DIR/duplicate-suggestions.rs:132:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:140:11 + --> $DIR/duplicate-suggestions.rs:138:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -284,13 +284,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:142:27 + --> $DIR/duplicate-suggestions.rs:140:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:88:11 + --> $DIR/duplicate-suggestions.rs:86:11 | LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^^^--^^^^^--^^ @@ -301,13 +301,13 @@ LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | help: consider removing the `&`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:88:15 + --> $DIR/duplicate-suggestions.rs:86:15 | LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:148:11 + --> $DIR/duplicate-suggestions.rs:146:11 | LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^^^^^^^--^^^^^--^^ @@ -318,7 +318,7 @@ LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | help: consider removing the `&mut`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:148:19 + --> $DIR/duplicate-suggestions.rs:146:19 | LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^ ^^ diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs index 90a9fe4e7d06c..6e3879a4155b9 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - #[derive(Clone)] enum Either { One(X), diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr index f1d515e932c60..74f3a63be57de 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:30:21 + --> $DIR/move-into-closure.rs:28:21 | LL | let x = X(Y); | - captured outer variable @@ -12,13 +12,13 @@ LL | let X(_t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:30:15 + --> $DIR/move-into-closure.rs:28:15 | LL | let X(_t) = x; | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:34:34 + --> $DIR/move-into-closure.rs:32:34 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -31,13 +31,13 @@ LL | if let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:34:28 + --> $DIR/move-into-closure.rs:32:28 | LL | if let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:38:37 + --> $DIR/move-into-closure.rs:36:37 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -50,13 +50,13 @@ LL | while let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:38:31 + --> $DIR/move-into-closure.rs:36:31 | LL | while let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:42:15 + --> $DIR/move-into-closure.rs:40:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -71,13 +71,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:46:25 + --> $DIR/move-into-closure.rs:44:25 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:49:15 + --> $DIR/move-into-closure.rs:47:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -92,13 +92,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:53:25 + --> $DIR/move-into-closure.rs:51:25 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:58:25 + --> $DIR/move-into-closure.rs:56:25 | LL | let x = X(Y); | - captured outer variable @@ -111,13 +111,13 @@ LL | let X(mut _t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:58:15 + --> $DIR/move-into-closure.rs:56:15 | LL | let X(mut _t) = x; | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:62:38 + --> $DIR/move-into-closure.rs:60:38 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -130,13 +130,13 @@ LL | if let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:62:28 + --> $DIR/move-into-closure.rs:60:28 | LL | if let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:66:41 + --> $DIR/move-into-closure.rs:64:41 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -149,13 +149,13 @@ LL | while let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:66:31 + --> $DIR/move-into-closure.rs:64:31 | LL | while let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:70:15 + --> $DIR/move-into-closure.rs:68:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -170,13 +170,13 @@ LL | Either::One(mut _t) | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:74:25 + --> $DIR/move-into-closure.rs:72:25 | LL | Either::One(mut _t) | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:77:15 + --> $DIR/move-into-closure.rs:75:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -191,13 +191,13 @@ LL | Either::One(mut _t) => (), | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:81:25 + --> $DIR/move-into-closure.rs:79:25 | LL | Either::One(mut _t) => (), | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:97:21 + --> $DIR/move-into-closure.rs:95:21 | LL | let x = X(Y); | - captured outer variable @@ -210,13 +210,13 @@ LL | let X(_t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:97:15 + --> $DIR/move-into-closure.rs:95:15 | LL | let X(_t) = x; | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:101:34 + --> $DIR/move-into-closure.rs:99:34 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -229,13 +229,13 @@ LL | if let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:101:28 + --> $DIR/move-into-closure.rs:99:28 | LL | if let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:105:37 + --> $DIR/move-into-closure.rs:103:37 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -248,13 +248,13 @@ LL | while let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:105:31 + --> $DIR/move-into-closure.rs:103:31 | LL | while let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:109:15 + --> $DIR/move-into-closure.rs:107:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -269,13 +269,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:113:25 + --> $DIR/move-into-closure.rs:111:25 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:116:15 + --> $DIR/move-into-closure.rs:114:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -290,13 +290,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:120:25 + --> $DIR/move-into-closure.rs:118:25 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:125:25 + --> $DIR/move-into-closure.rs:123:25 | LL | let x = X(Y); | - captured outer variable @@ -309,13 +309,13 @@ LL | let X(mut _t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:125:15 + --> $DIR/move-into-closure.rs:123:15 | LL | let X(mut _t) = x; | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:129:38 + --> $DIR/move-into-closure.rs:127:38 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -328,13 +328,13 @@ LL | if let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:129:28 + --> $DIR/move-into-closure.rs:127:28 | LL | if let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:133:41 + --> $DIR/move-into-closure.rs:131:41 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -347,13 +347,13 @@ LL | while let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:133:31 + --> $DIR/move-into-closure.rs:131:31 | LL | while let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:137:15 + --> $DIR/move-into-closure.rs:135:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -368,13 +368,13 @@ LL | Either::One(mut _t) | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:141:25 + --> $DIR/move-into-closure.rs:139:25 | LL | Either::One(mut _t) | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:144:15 + --> $DIR/move-into-closure.rs:142:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -389,13 +389,13 @@ LL | Either::One(mut _t) => (), | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:148:25 + --> $DIR/move-into-closure.rs:146:25 | LL | Either::One(mut _t) => (), | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:152:15 + --> $DIR/move-into-closure.rs:150:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -410,7 +410,7 @@ LL | Either::One(mut _t) => (), | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:156:25 + --> $DIR/move-into-closure.rs:154:25 | LL | Either::One(mut _t) => (), | ^^^^^^ diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.rs b/src/test/ui/suggestions/dont-suggest-ref/simple.rs index 58aab85ac2673..31ab1a6639acc 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - #[derive(Clone)] enum Either { One(X), diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr index 6a8b17ca87047..7f2ba4da714d8 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:40:17 + --> $DIR/simple.rs:38:17 | LL | let X(_t) = *s; | -- ^^ @@ -9,13 +9,13 @@ LL | let X(_t) = *s; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:40:11 + --> $DIR/simple.rs:38:11 | LL | let X(_t) = *s; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:44:30 + --> $DIR/simple.rs:42:30 | LL | if let Either::One(_t) = *r { } | -- ^^ @@ -25,13 +25,13 @@ LL | if let Either::One(_t) = *r { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:44:24 + --> $DIR/simple.rs:42:24 | LL | if let Either::One(_t) = *r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:48:33 + --> $DIR/simple.rs:46:33 | LL | while let Either::One(_t) = *r { } | -- ^^ @@ -41,13 +41,13 @@ LL | while let Either::One(_t) = *r { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:48:27 + --> $DIR/simple.rs:46:27 | LL | while let Either::One(_t) = *r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:52:11 + --> $DIR/simple.rs:50:11 | LL | match *r { | ^^ @@ -59,13 +59,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:56:21 + --> $DIR/simple.rs:54:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:59:11 + --> $DIR/simple.rs:57:11 | LL | match *r { | ^^ @@ -77,13 +77,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:63:21 + --> $DIR/simple.rs:61:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:68:17 + --> $DIR/simple.rs:66:17 | LL | let X(_t) = *sm; | -- ^^^ @@ -93,13 +93,13 @@ LL | let X(_t) = *sm; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:68:11 + --> $DIR/simple.rs:66:11 | LL | let X(_t) = *sm; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:72:30 + --> $DIR/simple.rs:70:30 | LL | if let Either::One(_t) = *rm { } | -- ^^^ @@ -109,13 +109,13 @@ LL | if let Either::One(_t) = *rm { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:72:24 + --> $DIR/simple.rs:70:24 | LL | if let Either::One(_t) = *rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:76:33 + --> $DIR/simple.rs:74:33 | LL | while let Either::One(_t) = *rm { } | -- ^^^ @@ -125,13 +125,13 @@ LL | while let Either::One(_t) = *rm { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:76:27 + --> $DIR/simple.rs:74:27 | LL | while let Either::One(_t) = *rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:80:11 + --> $DIR/simple.rs:78:11 | LL | match *rm { | ^^^ @@ -143,13 +143,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:84:21 + --> $DIR/simple.rs:82:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:87:11 + --> $DIR/simple.rs:85:11 | LL | match *rm { | ^^^ @@ -161,13 +161,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:91:21 + --> $DIR/simple.rs:89:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:95:11 + --> $DIR/simple.rs:93:11 | LL | match *rm { | ^^^ @@ -179,13 +179,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:99:21 + --> $DIR/simple.rs:97:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:104:17 + --> $DIR/simple.rs:102:17 | LL | let X(_t) = vs[0]; | -- ^^^^^ @@ -195,13 +195,13 @@ LL | let X(_t) = vs[0]; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:104:11 + --> $DIR/simple.rs:102:11 | LL | let X(_t) = vs[0]; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:108:30 + --> $DIR/simple.rs:106:30 | LL | if let Either::One(_t) = vr[0] { } | -- ^^^^^ @@ -211,13 +211,13 @@ LL | if let Either::One(_t) = vr[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:108:24 + --> $DIR/simple.rs:106:24 | LL | if let Either::One(_t) = vr[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:112:33 + --> $DIR/simple.rs:110:33 | LL | while let Either::One(_t) = vr[0] { } | -- ^^^^^ @@ -227,13 +227,13 @@ LL | while let Either::One(_t) = vr[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:112:27 + --> $DIR/simple.rs:110:27 | LL | while let Either::One(_t) = vr[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:116:11 + --> $DIR/simple.rs:114:11 | LL | match vr[0] { | ^^^^^ @@ -245,13 +245,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:120:21 + --> $DIR/simple.rs:118:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:123:11 + --> $DIR/simple.rs:121:11 | LL | match vr[0] { | ^^^^^ @@ -263,13 +263,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:127:21 + --> $DIR/simple.rs:125:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:132:17 + --> $DIR/simple.rs:130:17 | LL | let X(_t) = vsm[0]; | -- ^^^^^^ @@ -279,13 +279,13 @@ LL | let X(_t) = vsm[0]; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:132:11 + --> $DIR/simple.rs:130:11 | LL | let X(_t) = vsm[0]; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:136:30 + --> $DIR/simple.rs:134:30 | LL | if let Either::One(_t) = vrm[0] { } | -- ^^^^^^ @@ -295,13 +295,13 @@ LL | if let Either::One(_t) = vrm[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:136:24 + --> $DIR/simple.rs:134:24 | LL | if let Either::One(_t) = vrm[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:140:33 + --> $DIR/simple.rs:138:33 | LL | while let Either::One(_t) = vrm[0] { } | -- ^^^^^^ @@ -311,13 +311,13 @@ LL | while let Either::One(_t) = vrm[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:140:27 + --> $DIR/simple.rs:138:27 | LL | while let Either::One(_t) = vrm[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:144:11 + --> $DIR/simple.rs:142:11 | LL | match vrm[0] { | ^^^^^^ @@ -329,13 +329,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:148:21 + --> $DIR/simple.rs:146:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:151:11 + --> $DIR/simple.rs:149:11 | LL | match vrm[0] { | ^^^^^^ @@ -347,13 +347,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:155:21 + --> $DIR/simple.rs:153:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:159:11 + --> $DIR/simple.rs:157:11 | LL | match vrm[0] { | ^^^^^^ @@ -365,13 +365,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:163:21 + --> $DIR/simple.rs:161:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:170:18 + --> $DIR/simple.rs:168:18 | LL | let &X(_t) = s; | ------ ^ cannot move out of borrowed content @@ -380,13 +380,13 @@ LL | let &X(_t) = s; | help: consider removing the `&`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:170:12 + --> $DIR/simple.rs:168:12 | LL | let &X(_t) = s; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:174:31 + --> $DIR/simple.rs:172:31 | LL | if let &Either::One(_t) = r { } | ---------------- ^ cannot move out of borrowed content @@ -395,13 +395,13 @@ LL | if let &Either::One(_t) = r { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:174:25 + --> $DIR/simple.rs:172:25 | LL | if let &Either::One(_t) = r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:178:34 + --> $DIR/simple.rs:176:34 | LL | while let &Either::One(_t) = r { } | ---------------- ^ cannot move out of borrowed content @@ -410,13 +410,13 @@ LL | while let &Either::One(_t) = r { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:178:28 + --> $DIR/simple.rs:176:28 | LL | while let &Either::One(_t) = r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:182:11 + --> $DIR/simple.rs:180:11 | LL | match r { | ^ cannot move out of borrowed content @@ -428,13 +428,13 @@ LL | &Either::One(_t) | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:184:22 + --> $DIR/simple.rs:182:22 | LL | &Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:190:11 + --> $DIR/simple.rs:188:11 | LL | match r { | ^ cannot move out of borrowed content @@ -446,13 +446,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:192:22 + --> $DIR/simple.rs:190:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:197:11 + --> $DIR/simple.rs:195:11 | LL | match r { | ^ cannot move out of borrowed content @@ -464,13 +464,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:199:22 + --> $DIR/simple.rs:197:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:209:22 + --> $DIR/simple.rs:207:22 | LL | let &mut X(_t) = sm; | ---------- ^^ cannot move out of borrowed content @@ -479,13 +479,13 @@ LL | let &mut X(_t) = sm; | help: consider removing the `&mut`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:209:16 + --> $DIR/simple.rs:207:16 | LL | let &mut X(_t) = sm; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:213:35 + --> $DIR/simple.rs:211:35 | LL | if let &mut Either::One(_t) = rm { } | -------------------- ^^ cannot move out of borrowed content @@ -494,13 +494,13 @@ LL | if let &mut Either::One(_t) = rm { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:213:29 + --> $DIR/simple.rs:211:29 | LL | if let &mut Either::One(_t) = rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:217:38 + --> $DIR/simple.rs:215:38 | LL | while let &mut Either::One(_t) = rm { } | -------------------- ^^ cannot move out of borrowed content @@ -509,13 +509,13 @@ LL | while let &mut Either::One(_t) = rm { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:217:32 + --> $DIR/simple.rs:215:32 | LL | while let &mut Either::One(_t) = rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:221:11 + --> $DIR/simple.rs:219:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -527,7 +527,7 @@ LL | &mut Either::Two(_t) => (), | -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/simple.rs:223:26 + --> $DIR/simple.rs:221:26 | LL | &mut Either::One(_t) => (), | ^^ @@ -544,7 +544,7 @@ LL | Either::Two(_t) => (), | ^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:230:11 + --> $DIR/simple.rs:228:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -556,13 +556,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:232:26 + --> $DIR/simple.rs:230:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:237:11 + --> $DIR/simple.rs:235:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -574,13 +574,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:239:26 + --> $DIR/simple.rs:237:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:244:11 + --> $DIR/simple.rs:242:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -592,13 +592,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:246:26 + --> $DIR/simple.rs:244:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:260:21 + --> $DIR/simple.rs:258:21 | LL | let (&X(_t),) = (&x.clone(),); | -- ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -606,13 +606,13 @@ LL | let (&X(_t),) = (&x.clone(),); | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:260:13 + --> $DIR/simple.rs:258:13 | LL | let (&X(_t),) = (&x.clone(),); | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:262:34 + --> $DIR/simple.rs:260:34 | LL | if let (&Either::One(_t),) = (&e.clone(),) { } | -- ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -620,13 +620,13 @@ LL | if let (&Either::One(_t),) = (&e.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:262:26 + --> $DIR/simple.rs:260:26 | LL | if let (&Either::One(_t),) = (&e.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:264:37 + --> $DIR/simple.rs:262:37 | LL | while let (&Either::One(_t),) = (&e.clone(),) { } | -- ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -634,13 +634,13 @@ LL | while let (&Either::One(_t),) = (&e.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:264:29 + --> $DIR/simple.rs:262:29 | LL | while let (&Either::One(_t),) = (&e.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:266:11 + --> $DIR/simple.rs:264:11 | LL | match (&e.clone(),) { | ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -649,13 +649,13 @@ LL | (&Either::One(_t),) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:268:23 + --> $DIR/simple.rs:266:23 | LL | (&Either::One(_t),) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:274:25 + --> $DIR/simple.rs:272:25 | LL | let (&mut X(_t),) = (&mut xm.clone(),); | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -663,13 +663,13 @@ LL | let (&mut X(_t),) = (&mut xm.clone(),); | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:274:17 + --> $DIR/simple.rs:272:17 | LL | let (&mut X(_t),) = (&mut xm.clone(),); | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:276:38 + --> $DIR/simple.rs:274:38 | LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -677,13 +677,13 @@ LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:276:30 + --> $DIR/simple.rs:274:30 | LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:278:41 + --> $DIR/simple.rs:276:41 | LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -691,13 +691,13 @@ LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:278:33 + --> $DIR/simple.rs:276:33 | LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:280:11 + --> $DIR/simple.rs:278:11 | LL | match (&mut em.clone(),) { | ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -708,7 +708,7 @@ LL | (&mut Either::Two(_t),) => (), | -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/simple.rs:282:27 + --> $DIR/simple.rs:280:27 | LL | (&mut Either::One(_t),) => (), | ^^ @@ -716,7 +716,7 @@ LL | (&mut Either::Two(_t),) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:290:18 + --> $DIR/simple.rs:288:18 | LL | let &X(_t) = &x; | ------ ^^ cannot move out of borrowed content @@ -725,13 +725,13 @@ LL | let &X(_t) = &x; | help: consider removing the `&`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:290:12 + --> $DIR/simple.rs:288:12 | LL | let &X(_t) = &x; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:294:31 + --> $DIR/simple.rs:292:31 | LL | if let &Either::One(_t) = &e { } | ---------------- ^^ cannot move out of borrowed content @@ -740,13 +740,13 @@ LL | if let &Either::One(_t) = &e { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:294:25 + --> $DIR/simple.rs:292:25 | LL | if let &Either::One(_t) = &e { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:298:34 + --> $DIR/simple.rs:296:34 | LL | while let &Either::One(_t) = &e { } | ---------------- ^^ cannot move out of borrowed content @@ -755,13 +755,13 @@ LL | while let &Either::One(_t) = &e { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:298:28 + --> $DIR/simple.rs:296:28 | LL | while let &Either::One(_t) = &e { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:302:11 + --> $DIR/simple.rs:300:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -773,13 +773,13 @@ LL | &Either::One(_t) | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:304:22 + --> $DIR/simple.rs:302:22 | LL | &Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:310:11 + --> $DIR/simple.rs:308:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -791,13 +791,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:312:22 + --> $DIR/simple.rs:310:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:317:11 + --> $DIR/simple.rs:315:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -809,13 +809,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:319:22 + --> $DIR/simple.rs:317:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:325:22 + --> $DIR/simple.rs:323:22 | LL | let &mut X(_t) = &mut xm; | ---------- ^^^^^^^ cannot move out of borrowed content @@ -824,13 +824,13 @@ LL | let &mut X(_t) = &mut xm; | help: consider removing the `&mut`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:325:16 + --> $DIR/simple.rs:323:16 | LL | let &mut X(_t) = &mut xm; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:329:35 + --> $DIR/simple.rs:327:35 | LL | if let &mut Either::One(_t) = &mut em { } | -------------------- ^^^^^^^ cannot move out of borrowed content @@ -839,13 +839,13 @@ LL | if let &mut Either::One(_t) = &mut em { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:329:29 + --> $DIR/simple.rs:327:29 | LL | if let &mut Either::One(_t) = &mut em { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:333:38 + --> $DIR/simple.rs:331:38 | LL | while let &mut Either::One(_t) = &mut em { } | -------------------- ^^^^^^^ cannot move out of borrowed content @@ -854,13 +854,13 @@ LL | while let &mut Either::One(_t) = &mut em { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:333:32 + --> $DIR/simple.rs:331:32 | LL | while let &mut Either::One(_t) = &mut em { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:337:11 + --> $DIR/simple.rs:335:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -872,13 +872,13 @@ LL | &mut Either::One(_t) | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:339:26 + --> $DIR/simple.rs:337:26 | LL | &mut Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:345:11 + --> $DIR/simple.rs:343:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -890,13 +890,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:347:26 + --> $DIR/simple.rs:345:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:352:11 + --> $DIR/simple.rs:350:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -908,13 +908,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:354:26 + --> $DIR/simple.rs:352:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:359:11 + --> $DIR/simple.rs:357:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -926,13 +926,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:361:26 + --> $DIR/simple.rs:359:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:204:11 + --> $DIR/simple.rs:202:11 | LL | fn f1(&X(_t): &X) { } | ^^^--^ @@ -942,13 +942,13 @@ LL | fn f1(&X(_t): &X) { } | help: consider removing the `&`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:204:14 + --> $DIR/simple.rs:202:14 | LL | fn f1(&X(_t): &X) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:251:11 + --> $DIR/simple.rs:249:11 | LL | fn f2(&mut X(_t): &mut X) { } | ^^^^^^^--^ @@ -958,13 +958,13 @@ LL | fn f2(&mut X(_t): &mut X) { } | help: consider removing the `&mut`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:251:18 + --> $DIR/simple.rs:249:18 | LL | fn f2(&mut X(_t): &mut X) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:271:11 + --> $DIR/simple.rs:269:11 | LL | fn f3((&X(_t),): (&X,)) { } | ^^^^--^^^ @@ -973,13 +973,13 @@ LL | fn f3((&X(_t),): (&X,)) { } | cannot move out of borrowed content | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:271:15 + --> $DIR/simple.rs:269:15 | LL | fn f3((&X(_t),): (&X,)) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:285:11 + --> $DIR/simple.rs:283:11 | LL | fn f4((&mut X(_t),): (&mut X,)) { } | ^^^^^^^^--^^^ @@ -988,7 +988,7 @@ LL | fn f4((&mut X(_t),): (&mut X,)) { } | cannot move out of borrowed content | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:285:19 + --> $DIR/simple.rs:283:19 | LL | fn f4((&mut X(_t),): (&mut X,)) { } | ^^ diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr new file mode 100644 index 0000000000000..f4eb9813c1ac7 --- /dev/null +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr @@ -0,0 +1,11 @@ +error[E0310]: the parameter type `impl Debug` may not live long enough + --> $DIR/suggest-impl-trait-lifetime.rs:7:5 + | +LL | bar(d); + | ^^^^^^ + | + = help: consider adding an explicit lifetime bound `impl Debug: 'static`... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/suggestions/suggest-ref-mut.rs b/src/test/ui/suggestions/suggest-ref-mut.rs index b4a6fa39f9052..d04113ffccc3a 100644 --- a/src/test/ui/suggestions/suggest-ref-mut.rs +++ b/src/test/ui/suggestions/suggest-ref-mut.rs @@ -1,5 +1,3 @@ -#![feature(nll)] - struct X(usize); impl X { diff --git a/src/test/ui/suggestions/suggest-ref-mut.stderr b/src/test/ui/suggestions/suggest-ref-mut.stderr index 3dd9fbc6f1480..2414367875718 100644 --- a/src/test/ui/suggestions/suggest-ref-mut.stderr +++ b/src/test/ui/suggestions/suggest-ref-mut.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `self.0` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:9:9 + --> $DIR/suggest-ref-mut.rs:7:9 | LL | fn zap(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` @@ -8,7 +8,7 @@ LL | self.0 = 32; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*foo` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:18:5 + --> $DIR/suggest-ref-mut.rs:16:5 | LL | let ref foo = 16; | ------- help: consider changing this to be a mutable reference: `ref mut foo` @@ -17,7 +17,7 @@ LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*bar` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:23:9 + --> $DIR/suggest-ref-mut.rs:21:9 | LL | if let Some(ref bar) = Some(16) { | ------- help: consider changing this to be a mutable reference: `ref mut bar` @@ -26,7 +26,7 @@ LL | *bar = 32; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*quo` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:27:22 + --> $DIR/suggest-ref-mut.rs:25:22 | LL | ref quo => { *quo = 32; }, | ------- ^^^^^^^^^ `quo` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr new file mode 100644 index 0000000000000..18d01b1879018 --- /dev/null +++ b/src/test/ui/thread-local-in-ctfe.nll.stderr @@ -0,0 +1,49 @@ +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-in-ctfe.rs:6:17 + | +LL | static B: u32 = A; + | ^ + +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-in-ctfe.rs:9:18 + | +LL | static C: &u32 = &A; + | ^^ + +error[E0712]: thread-local variable borrowed past end of function + --> $DIR/thread-local-in-ctfe.rs:9:18 + | +LL | static C: &u32 = &A; + | ^^- end of enclosing function is here + | | + | thread-local variables cannot be borrowed beyond the end of the function + +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-in-ctfe.rs:15:16 + | +LL | const D: u32 = A; + | ^ + +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-in-ctfe.rs:18:17 + | +LL | const E: &u32 = &A; + | ^^ + +error[E0712]: thread-local variable borrowed past end of function + --> $DIR/thread-local-in-ctfe.rs:18:17 + | +LL | const E: &u32 = &A; + | ^^- end of enclosing function is here + | | + | thread-local variables cannot be borrowed beyond the end of the function + +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-in-ctfe.rs:25:5 + | +LL | A + | ^ + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0712`. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr new file mode 100644 index 0000000000000..ead42c1488966 --- /dev/null +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr @@ -0,0 +1,12 @@ +error: lifetime may not live long enough + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:9 + | +LL | doit(0, &|x, y| { + | - - has type `&'1 i32` + | | + | has type `&std::cell::Cell<&'2 i32>` +LL | x.set(y); + | ^^^^^^^^ argument requires that `'1` must outlive `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr new file mode 100644 index 0000000000000..8ed48bda26e85 --- /dev/null +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/dyn-trait-underscore.rs:8:5 + | +LL | fn a(items: &[T]) -> Box> { + | - let's call the lifetime of this reference `'1` +LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` +LL | Box::new(items.iter()) + | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr new file mode 100644 index 0000000000000..e1d57b8ba1eda --- /dev/null +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/underscore-lifetime-elison-mismatch.rs:1:42 + | +LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } + | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` + | | | + | | let's call the lifetime of this reference `'1` + | let's call the lifetime of this reference `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr new file mode 100644 index 0000000000000..344437f74e495 --- /dev/null +++ b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr @@ -0,0 +1,106 @@ +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:4:5 + | +LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:7:5 + | +LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:10:5 + | +LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:13:5 + | +LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:18:5 + | +LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) + | ---- lifetime `'new` defined here +LL | -> OccupiedEntry<'a, &'new (), ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:22:5 + | +LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) + | ---- lifetime `'new` defined here +LL | -> OccupiedEntry<'a, (), &'new ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:26:5 + | +LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) + | ---- lifetime `'new` defined here +LL | -> OccupiedEntry<'a, &'static (), ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:30:5 + | +LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) + | ---- lifetime `'new` defined here +LL | -> OccupiedEntry<'a, (), &'static ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:35:5 + | +LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) + | ---- lifetime `'new` defined here +LL | -> VacantEntry<'a, &'new (), ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:39:5 + | +LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) + | ---- lifetime `'new` defined here +LL | -> VacantEntry<'a, (), &'new ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:43:5 + | +LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) + | ---- lifetime `'new` defined here +LL | -> VacantEntry<'a, &'static (), ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:47:5 + | +LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) + | ---- lifetime `'new` defined here +LL | -> VacantEntry<'a, (), &'static ()> { +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + +error: aborting due to 12 previous errors + diff --git a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr new file mode 100644 index 0000000000000..a3ae5320c90d4 --- /dev/null +++ b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/variance-cell-is-invariant.rs:14:12 + | +LL | fn use_<'short,'long>(c: Foo<'short>, + | ------ ----- lifetime `'long` defined here + | | + | lifetime `'short` defined here +... +LL | let _: Foo<'long> = c; + | ^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + +error: aborting due to previous error + diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr new file mode 100644 index 0000000000000..8b5ecbe56ff2d --- /dev/null +++ b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-contravariant-arg-object.rs:14:5 + | +LL | fn get_min_from_max<'min, 'max>(v: Box>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-contravariant-arg-object.rs:22:5 + | +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr new file mode 100644 index 0000000000000..dbd75cb52fa83 --- /dev/null +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-contravariant-arg-trait-match.rs:13:5 + | +LL | fn get_min_from_max<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::() + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-contravariant-arg-trait-match.rs:21:5 + | +LL | fn get_max_from_min<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::() + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr new file mode 100644 index 0000000000000..9212cf24be3bf --- /dev/null +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-contravariant-self-trait-match.rs:13:5 + | +LL | fn get_min_from_max<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::<&'min G>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-contravariant-self-trait-match.rs:22:5 + | +LL | fn get_max_from_min<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::<&'max G>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr new file mode 100644 index 0000000000000..acf9f2e060ce9 --- /dev/null +++ b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-covariant-arg-object.rs:15:5 + | +LL | fn get_min_from_max<'min, 'max>(v: Box>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-covariant-arg-object.rs:22:5 + | +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr new file mode 100644 index 0000000000000..33589121c4b83 --- /dev/null +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-covariant-arg-trait-match.rs:14:5 + | +LL | fn get_min_from_max<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::() + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-covariant-arg-trait-match.rs:20:5 + | +LL | fn get_max_from_min<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::() + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr new file mode 100644 index 0000000000000..6b2413d68be29 --- /dev/null +++ b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-covariant-self-trait-match.rs:14:5 + | +LL | fn get_min_from_max<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::<&'min G>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-covariant-self-trait-match.rs:20:5 + | +LL | fn get_max_from_min<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::<&'max G>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr new file mode 100644 index 0000000000000..3c1ee7fc707f8 --- /dev/null +++ b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-invariant-arg-object.rs:11:5 + | +LL | fn get_min_from_max<'min, 'max>(v: Box>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-invariant-arg-object.rs:18:5 + | +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr new file mode 100644 index 0000000000000..2ab44c54c7216 --- /dev/null +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-invariant-arg-trait-match.rs:10:5 + | +LL | fn get_min_from_max<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::() + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-invariant-arg-trait-match.rs:16:5 + | +LL | fn get_max_from_min<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::() + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr new file mode 100644 index 0000000000000..7b7c42fea8da8 --- /dev/null +++ b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-invariant-self-trait-match.rs:10:5 + | +LL | fn get_min_from_max<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::<&'min G>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-invariant-self-trait-match.rs:16:5 + | +LL | fn get_max_from_min<'min, 'max, G>() + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | impls_get::<&'max G>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variance/variance-trait-matching.nll.stderr b/src/test/ui/variance/variance-trait-matching.nll.stderr new file mode 100644 index 0000000000000..3308cc6d25016 --- /dev/null +++ b/src/test/ui/variance/variance-trait-matching.nll.stderr @@ -0,0 +1,12 @@ +error[E0621]: explicit lifetime required in the type of `get` + --> $DIR/variance-trait-matching.rs:24:5 + | +LL | fn get<'a, G>(get: &G) -> i32 + | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G` +... +LL | pick(get, &22) + | ^^^^^^^^^^^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr new file mode 100644 index 0000000000000..8468448b27bd2 --- /dev/null +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/variance-use-contravariant-struct-1.rs:12:5 + | +LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: aborting due to previous error + diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr new file mode 100644 index 0000000000000..19a22f064beb0 --- /dev/null +++ b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/variance-use-covariant-struct-1.rs:10:5 + | +LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: aborting due to previous error + diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr new file mode 100644 index 0000000000000..61f80fe77e63d --- /dev/null +++ b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/variance-use-invariant-struct-1.rs:12:5 + | +LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: lifetime may not live long enough + --> $DIR/variance-use-invariant-struct-1.rs:19:5 + | +LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) + | ---- ---- lifetime `'max` defined here + | | + | lifetime `'min` defined here +... +LL | v + | ^ returning this value requires that `'min` must outlive `'max` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/wf/wf-static-method.nll.stderr b/src/test/ui/wf/wf-static-method.nll.stderr new file mode 100644 index 0000000000000..338de6db18006 --- /dev/null +++ b/src/test/ui/wf/wf-static-method.nll.stderr @@ -0,0 +1,65 @@ +error: lifetime may not live long enough + --> $DIR/wf-static-method.rs:17:9 + | +LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | u + | ^ returning this value requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/wf-static-method.rs:26:18 + | +LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let me = Self::make_me(); + | ^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/wf-static-method.rs:33:9 + | +LL | impl<'a, 'b> Evil<'a, 'b> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | fn inherent_evil(u: &'b u32) -> &'a u32 { +LL | u + | ^ returning this value requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/wf-static-method.rs:41:5 + | +LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | <()>::static_evil(b) + | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/wf-static-method.rs:45:5 + | +LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | ::static_evil(b) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/wf-static-method.rs:50:5 + | +LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | ::inherent_evil(b) // bug? shouldn't this be an error + | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` + +error: aborting due to 6 previous errors + diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 10b8133326bba..2579f1f51bd2d 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1912,8 +1912,7 @@ impl<'test> TestCx<'test> { match self.config.compare_mode { Some(CompareMode::Nll) => { - // FIXME(#56993) use -Zborrowck=mir - rustc.args(&["-Zborrowck=migrate"]); + rustc.args(&["-Zborrowck=mir"]); } Some(CompareMode::Polonius) => { rustc.args(&["-Zpolonius", "-Zborrowck=mir"]);