// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}}
#![feature(never_type)]
-#![feature(nll)]
#[derive(Copy, Clone)]
pub struct Entity {
// ignore-wasm32-bare
-#![feature(nll)]
-
fn match_guard(x: Option<&&i32>, c: bool) -> i32 {
match x {
Some(0) if c => 0,
// error-pattern: thread 'main' panicked at 'explicit panic'
-#![feature(nll)]
-
fn main() {
let mut vec = vec![];
vec.push((vec.len(), panic!()));
#![allow(unused_variables)]
// Test case from #39963.
-#![feature(nll)]
-
#[derive(Clone)]
struct Foo(Option<Box<Foo>>, Option<Box<Foo>>);
// run-pass
-#![feature(nll)]
#![deny(unused_mut)]
#[derive(Debug)]
// 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};
// 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() {
// 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;
// run-pass
#![allow(unreachable_code)]
-#![feature(nll)]
fn main() {
let mut v = Vec::new();
// Regression test for #47153: constants in a generic context (such as
// a trait) used to ICE.
-#![feature(nll)]
#![allow(warnings)]
trait Foo {
// run-pass
-#![feature(nll)]
-
pub struct DescriptorSet<'a> {
pub slots: Vec<AttachInfo<'a, Resources>>
}
#![allow(path_statements)]
#![allow(dead_code)]
-#![feature(nll)]
-
struct WithDrop;
impl Drop for WithDrop {
#![allow(path_statements)]
#![allow(dead_code)]
-#![feature(nll)]
#![feature(generators, generator_trait)]
struct WithDrop;
// run-pass
-#![feature(nll)]
#![deny(unused_mut)]
fn main() {
// run-pass
-#![feature(nll)]
#![deny(unused_mut)]
struct Foo {
// run-pass
-#![feature(nll)]
#![allow(unused_variables)]
pub trait TryTransform {
// run-pass
-#![feature(nll)]
-
struct List<T> {
value: T,
next: Option<Box<List<T>>>,
// run-pass
-#![feature(nll)]
-
use std::collections::HashMap;
fn process_or_insert_default(map: &mut HashMap<usize, String>, key: usize) {
// `x`. The lexical checker makes this very painful. The NLL checker
// does not.
-#![feature(nll)]
-
use std::rc::Rc;
#[derive(Debug, PartialEq, Eq)]
-#![feature(nll)]
-
struct Node {
elem: i32,
next: Option<Box<Node>>,
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
| ^^^^^^^^ 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
// run-pass
-#![feature(nll)]
-
enum Nat {
S(Box<Nat>),
Z
// 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 }
// 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;
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
-#![feature(nll)]
-
#![allow(dead_code)]
#[derive(Debug)]
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
| ^^^^^^
+++ /dev/null
-error[E0506]: cannot assign to `greeting` because it is borrowed
- --> $DIR/issue-58776-borrowck-scans-children.rs:11:5
- |
-LL | let res = (|| (|| &greeting)())();
- | -- -------- borrow occurs due to use in closure
- | |
- | borrow of `greeting` occurs here
-LL |
-LL | greeting = "DEALLOCATED".to_string();
- | ^^^^^^^^ assignment to borrowed `greeting` occurs here
-...
-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
- |
-LL | let res = (|| (|| &greeting)())();
- | -- -------- borrow occurs due to use in closure
- | |
- | borrow of `greeting` occurs here
-...
-LL | drop(greeting);
- | ^^^^^^^^ move out of `greeting` occurs here
-...
-LL | println!("thread result: {:?}", res);
- | --- borrow later used here
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0505, E0506.
-For more information about an error, try `rustc --explain E0505`.
-// 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);
}
--- /dev/null
+error[E0506]: cannot assign to `greeting` because it is borrowed
+ --> $DIR/issue-58776-borrowck-scans-children.rs:5:5
+ |
+LL | let res = (|| (|| &greeting)())();
+ | -- -------- borrow occurs due to use in closure
+ | |
+ | borrow of `greeting` occurs here
+LL |
+LL | greeting = "DEALLOCATED".to_string();
+ | ^^^^^^^^ assignment to borrowed `greeting` occurs here
+...
+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:7:10
+ |
+LL | let res = (|| (|| &greeting)())();
+ | -- -------- borrow occurs due to use in closure
+ | |
+ | borrow of `greeting` occurs here
+...
+LL | drop(greeting);
+ | ^^^^^^^^ move out of `greeting` occurs here
+...
+LL | println!("thread result: {:?}", res);
+ | --- borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0505, E0506.
+For more information about an error, try `rustc --explain E0505`.
// 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 {
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
-#![feature(nll)]
-
struct Foo {
}
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);
| ^^^^------^--------^
| 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
+++ /dev/null
-#![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
-}
+++ /dev/null
-error[E0621]: explicit lifetime required in the type of `ap`
- --> $DIR/variadic-ffi-5.rs:11: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>`
-LL | ap
- | ^^ lifetime `'a` required
-
-error[E0621]: explicit lifetime required in the type of `ap`
- --> $DIR/variadic-ffi-5.rs:15: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>`
-LL | ap
- | ^^ lifetime `'static` required
-
-error: lifetime may not live long enough
- --> $DIR/variadic-ffi-5.rs:19:33
- |
-LL | let _ = ap.with_copy(|ap| { ap });
- | --- ^^ returning this value requires that `'1` must outlive `'2`
- | | |
- | | return type of closure is core::ffi::VaList<'2>
- | has type `core::ffi::VaList<'1>`
-
-error: lifetime may not live long enough
- --> $DIR/variadic-ffi-5.rs:23:5
- |
-LL | pub unsafe extern "C" fn no_escape3(_: usize, 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
- |
-LL | pub unsafe extern "C" fn no_escape4(_: usize, mut 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
- |
-LL | pub unsafe extern "C" fn no_escape4(_: usize, mut 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[E0597]: `ap1` does not live long enough
- --> $DIR/variadic-ffi-5.rs:27: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 | ap0 = &mut ap1;
- | ------^^^^^^^^
- | | |
- | | borrowed value does not live long enough
- | assignment requires that `ap1` is borrowed for `'1`
-...
-LL | }
- | - `ap1` dropped here while still borrowed
-
-error: aborting due to 7 previous errors
-
-Some errors have detailed explanations: E0597, E0621.
-For more information about an error, try `rustc --explain E0597`.
// compile-pass
-#![feature(nll)]
-
pub fn main() {
let y: &'static mut [u8; 0] = &mut [];
}
-#![feature(nll)]
-
const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); //~ ERROR temporary value dropped while borrowed
use std::borrow::Cow;
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"]);
| ------^^^^^^^^^-
| 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"]);
| ---------------^^^^^^^^^-
//compile-pass
-#![feature(nll)]
-
fn main() {
let _: &'static usize = &(loop {}, 1).1;
// compile-pass
// aux-build:promotable_const_fn_lib.rs
-#![feature(nll)]
-
extern crate promotable_const_fn_lib;
use promotable_const_fn_lib::{foo, Foo};
// compile-pass
-#![feature(nll)]
-
fn main() {
let x: &'static u8 = &u8::max_value();
let x: &'static u16 = &u16::max_value();
+++ /dev/null
-error[E0621]: explicit lifetime required in the type of `x`
- --> $DIR/generator-region-requirements.rs:16:51
- |
-LL | fn dangle(x: &mut i32) -> &'static mut i32 {
- | -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32`
-...
-LL | GeneratorState::Complete(c) => return c,
- | ^ lifetime `'static` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
-// 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;
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(_) => (),
}
}
--- /dev/null
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $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`
+...
+LL | GeneratorState::Complete(c) => return c,
+ | ^ lifetime `'static` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
#![feature(generators)]
-#![feature(nll)]
fn main() {
|| {
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;
| ^^^^^^^^^
-#![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
#![allow(dead_code)]
#![feature(in_band_lifetimes)]
-#![feature(nll)]
fn foo(x: &'x u32) -> impl Fn() -> &'y u32
where 'x: 'y
#![allow(dead_code)]
#![feature(in_band_lifetimes)]
-#![feature(nll)]
trait Trait<'a> { }
#![allow(dead_code)]
#![feature(in_band_lifetimes)]
-#![feature(nll)]
use std::cell::Cell;
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
| ^^
-#![feature(nll)]
-
pub trait Foo {
fn zero(self) -> Self;
}
error[E0382]: use of moved value: `x`
- --> $DIR/issue-34721.rs:27:9
+ --> $DIR/issue-34721.rs:25:9
|
LL | pub fn baz<T: Foo>(x: T) -> T {
| - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
// 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
// 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 }
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 };
| ^^
-#![feature(nll)]
-
fn foo(x: &u32) -> &'static u32 {
&*x
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
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`
-#![feature(nll)]
-
fn main() {
let _vec: Vec<&'static String> = vec![&String::new()];
//~^ ERROR temporary value dropped while borrowed [E0716]
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
-#![allow(warnings)]
-#![feature(nll)]
-
use std::collections::BinaryHeap;
fn main() {
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
// compile-pass
-#![allow(dead_code)]
-#![feature(nll)]
struct AtomicRefMut<'a> {
value: &'a mut i32,
// compile-pass
-#![allow(dead_code)]
-#![feature(nll)]
struct WithDrop;
// compile-pass
-#![allow(dead_code)]
-#![feature(nll)]
struct MyStruct<'a> {
field: &'a mut (),
// 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,
// compile-pass
-#![allow(dead_code)]
#![allow(non_upper_case_globals)]
-#![feature(nll)]
-
static mut x: &'static u32 = &0;
fn foo() {
// run-pass
-#![feature(nll)]
-#![allow(warnings)]
-
struct Inner<I, V> {
iterator: I,
item: V,
// run-pass
-#![feature(nll)]
-#![allow(warnings)]
-
pub struct Container<T: Iterator> {
value: Option<T::Item>,
}
-#![feature(nll)]
-
fn flatten<'a, 'b, T>(x: &'a &'b T) -> &'a T {
x
}
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
// compile-pass
// ignore-emscripten no i128 support
-#![feature(nll)]
-
fn fibs(n: u32) -> impl Iterator<Item=u128> {
(0 .. n)
.scan((0, 1), |st, _| {
-#![feature(nll)]
-
fn main() {
let foo = &16;
//~^ HELP consider changing this to be a mutable reference
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`
| ^^^^^^^^^ `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`
//
// run-pass
-#![feature(nll)]
-
pub trait Parser {
type Input;
//
// compile-pass
-#![feature(nll)]
-
fn main() {}
fn fail<'a>() -> Struct<'a, Generic<()>> {
//
// compile-pass
-#![feature(nll)]
-#![allow(dead_code)]
-
trait Future {
type Item;
}
-#![feature(nll)]
-
// This test is a minimal version of an ICE in the dropck-eyepatch tests
// found in the fix for #54943.
-#![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.
--- /dev/null
+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
+
-#![feature(nll)]
-#![allow(warnings)]
-
fn foo<T: 'static>() { }
fn boo<'a>() {
return;
let x = foo::<&'a u32>();
- //~^ ERROR lifetime may not live long enough
+ //~^ ERROR
}
fn main() {}
-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
// General test of maybe_uninits state computed by MIR dataflow.
-#![feature(nll)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
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); }
| ^^^^^^^^^^^^^^
// General test of maybe_inits state computed by MIR dataflow.
-#![feature(nll)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
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); }
| ^^^^^^^^^^^^^^
// General test of maybe_uninits state computed by MIR dataflow.
-#![feature(nll)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
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); }
| ^^^^^^^^^^^^^^^^
// General test of maybe_uninits state computed by MIR dataflow.
-#![feature(nll)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
error: rustc_peek: bit not set
- --> $DIR/uninits-2.rs:15:14
+ --> $DIR/uninits-2.rs:14:14
|
LL | unsafe { rustc_peek(&x) };
| ^^^^^^^^^^^^^^
-#![feature(nll)]
-
// run-pass
fn vec() {
//
// FIXME(#54366) - We probably shouldn't allow #[thread_local] static mut to get a 'static lifetime.
-#![feature(nll)]
#![feature(thread_local)]
#[thread_local]
-#![feature(nll)]
-
fn gimme(x: &(u32,)) -> &u32 {
&x.0
}
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
// Regression test for issue #38899
#![feature(nll)]
-#![allow(dead_code)]
pub struct Block<'a> {
current: &'a u8,
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
-#![feature(nll)]
-
fn gimme(x: &(u32,)) -> &u32 {
&x.0
}
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
-#![feature(nll)]
-#![allow(warnings)]
-
fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
let v = 22;
&v
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
-#![feature(nll)]
-#![allow(warnings)]
-
fn gimme(x: &(u32,)) -> &u32 {
&x.0
}
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,))
| ^^^^^^^----^
// 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() {
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;
| ----^
| 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)]
| ^^^^^^^^^^
// 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,
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
// 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
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
| - 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
| - 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
| - 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
| - 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
| - 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
| 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
| 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
| 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
// 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
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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
| - 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
// Some cases with closures that might be problems
-#![allow(unused)]
-#![feature(nll)]
-
// Should have one error per assignment
fn one_closure(x: i32) {
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`
| ^^^^^ 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`
| ^^^^^ 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`
| ^^^^^ 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`
| ^^^^^ 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
| - 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(|| {
| ____________^
| |________________^
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
| - 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 || {
| ____________^
| |___________^
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`
| ^^^^^ 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
| - 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(|| {
| ____________^
| |________________^
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`
| ^^^^^ 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
| - 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 || {
| ____________^
| |___________^
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
| - 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(|| {
| ____________^
| |________________^
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
| - 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 || {
| ____________^
// 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
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
| ^ 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
| ^^ 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
-// 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
// Test that we propagate *all* requirements to the caller, not just the first
// one.
-#![feature(nll)]
-
fn once<S, T, U, F: FnOnce(S, T) -> U>(f: F, s: S, t: T) -> U {
f(s, t)
}
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`
// 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
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
| - 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
| - 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
// 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
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
| 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
| 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
// Regression test for issue #47053
-#![feature(nll)]
#![feature(thread_local)]
#[thread_local]
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
// Regression test for #46314
-#![feature(nll)]
#![feature(decl_macro)]
struct NonCopy(String);
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
// compile-pass
-#![feature(nll)]
#![feature(box_patterns)]
struct Root {
-// (this works, but only in NLL)
// compile-pass
-#![feature(nll)]
use std::collections::HashMap;
use std::sync::Mutex;
-// (this works, but only in NLL)
// compile-pass
-#![feature(nll)]
fn from_stdin(min: u64) -> Vec<u64> {
use std::io::BufRead;
// meant to compile and run successfully once rust-lang/rust#54987 is
// implemented.
-#![feature(nll)]
-
struct D {
x: u32,
s: S,
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
| ^^^^^^^^ 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
// compile-pass
-#![feature(nll)]
-
fn main() {
let _s = construct().borrow().consume_borrowed();
}
// compile-pass
-#![feature(nll)]
-
use std::ops::{Deref, DerefMut};
fn box_two_field(v: &mut Box<(i32, i32)>) {
-#![feature(nll)]
// compile-pass
// rust-lang/rust#32382: Borrow checker used to complain about
// compile-pass
-#![feature(nll)]
-
use std::borrow::Cow;
#[derive(Clone, Debug)]
-#![feature(nll)]
-
struct Foo;
impl Foo {
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
// compile-pass
-#![allow(warnings)]
-#![feature(nll)]
-
struct LoadedObject {
bodies: Vec<Body>,
color: Color,
-#![feature(nll)]
struct FancyNum {
num: u8,
}
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)`
// 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;
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
// run-pass
// revisions: lxl nll
-#![cfg_attr(nll, feature(nll))]
-
struct Foo {
x: u32
}
// Regression test for #48697
-#![feature(nll)]
-
fn foo(x: &i32) -> &i32 {
let z = 4;
let f = &|y| y;
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
// 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: ?Sized>(Q);
fn main() {}
--- /dev/null
+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
+
// Regression test for the issue #50716: NLL ignores lifetimes bounds
// derived from `Sized` requirements
-#![feature(nll)]
-
trait A {
type X: ?Sized;
}
-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`.
-#![feature(nll)]
-
struct Struct;
impl Struct {
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
= 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();
| ^^^^^^^^^^^
| 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`
| ^^^^^^^^^^^ 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();
| ^^^^^^^^^^^
-#![feature(nll)]
-
fn main() {
let ref my_ref @ _ = 0;
*my_ref = 0;
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 @ _`
// ignore-tidy-linelength
-#![feature(nll)]
-
struct Bar;
impl Bar {
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
//
// compile-pass
-#![feature(nll)]
-
fn creash<'a>() {
let x: &'a () = &();
}
-#![allow(warnings)]
-#![feature(nll)]
-
fn main() {
let range = 0..1;
let r = range;
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<i32>`, which does not implement the `Copy` trait
// of the fact that the type implements Drop.
#![feature(nll)]
-#![allow(dead_code)]
pub struct S<'a> { url: &'a mut String }
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>`
| - 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>`
| - 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>`
| - 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
| ^^^^^
-#![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.
-#![feature(nll)]
-
use std::rc::Rc;
use std::sync::Arc;
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`
-//
-
-#![allow(warnings)]
#![feature(nll)]
trait Bazinga {}
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
-#![feature(nll)]
-#![allow(warnings)]
-
struct Test;
impl Test {
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
| ^--
| 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
| ^--
| 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
-#![feature(nll)]
-#![allow(warnings)]
-
fn foo(x: &u32) -> &u32 {
let y;
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
-#![feature(nll)]
-#![allow(warnings)]
-
fn foo(_: impl FnOnce(&u32) -> &u32) {
}
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`...
= note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references>
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`...
-#![feature(nll)]
-
fn expect_fn<F>(f: F) where F : Fn() {
f();
}
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
#![feature(box_syntax)]
-#![feature(nll)]
trait Foo { fn get(&self); }
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
-#![feature(nll)]
-
struct A {
b: B,
}
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
--- /dev/null
+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
+
-#![feature(nll)]
#![feature(in_band_lifetimes)]
struct Foo<'a, 'b> {
impl Foo<'_, '_> {
fn take_bar(&mut self, b: Bar<'_>) {
self.y = b.z
- //~^ ERROR lifetime may not live long enough
+ //~^ ERROR
}
}
-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
// compile-pass
-#![feature(nll)]
-
use std::ops::Deref;
pub struct TypeFieldIterator<'a, T: 'a> {
//
// compile-pass
-#![feature(nll)]
-#![feature(rustc_attrs)]
-#![allow(dead_code)]
-
use std::cell::{RefCell, Ref};
trait AnyVec<'a> {
-#![feature(nll)]
-
// run-pass
struct Slice(&'static [&'static [u8]]);
// compile-pass
-#![feature(nll)]
-#![allow(unreachable_code)]
#![deny(unused_mut)]
pub fn foo() {
--- /dev/null
+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
+
-#![feature(nll)]
-
struct Bar;
struct Foo<'s> {
impl Foo<'_> {
fn new(bar: &mut Bar) -> Self {
- Foo { bar } //~ERROR lifetime may not live long enough
+ Foo { bar } //~ERROR
}
}
-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
--- /dev/null
+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
+
-#![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
-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
-#![feature(nll)]
-
use std::any::Any;
#[derive(Debug, Clone)]
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
-#![feature(nll)]
-
// compile-pass
trait Foo<'a> {
-#![feature(nll)]
-
// compile-pass
trait Foo {
// 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
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`
| ^^^^^^ `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
-#![allow(warnings)]
#![feature(nll)]
fn main() {
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`
| 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`
-#![allow(dead_code)]
#![feature(nll)]
struct A<'a>(&'a ());
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
| ^^^^^^^^^^ 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
-#![allow(warnings)]
-#![feature(nll)]
-
struct Wrap<'p> { p: &'p mut i32 }
impl<'p> Drop for Wrap<'p> {
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
-#![allow(unused)]
-#![feature(nll)]
-
struct A(String);
struct C(D);
error[E0507]: cannot move out of borrowed content
- --> $DIR/move-errors.rs:9:13
+ --> $DIR/move-errors.rs:6:13
|
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];
| ^^^^
| 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;
| ^^^
| 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;
| ^^
| 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];
| ^^^^^^^^^^^^^^^^^^^^^^
| 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;
| - ^^
| 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
| 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] {
| ^^^^
| - ...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) => (),
| ^
| ^
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
| - 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
| - 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
| - 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
| 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 {
| ^^
| - 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) => (),
| ^
-#![feature(nll)]
-
fn main() {
let x = (vec![1, 2, 3], );
drop(x.0);
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
// 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;
}
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 {}
| ^^
//run-pass
-#![feature(nll)]
trait Visitor<'d> {
type Value;
}
// run-pass
-#![feature(nll)]
-
pub fn main() {
let mut x: Vec<&[i32; 0]> = Vec::new();
for i in 0..10 {
-#![feature(nll)]
-
fn shorten_lifetime<'a, 'b, 'min>(a: &'a i32, b: &'b i32) -> &'min i32
where
'a: 'min,
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
// 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);
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)
| ^^^^--^
//
// compile-pass
-#![allow(warnings)]
-#![feature(dyn_trait)]
-#![feature(nll)]
-
trait Foo {
fn foo(&self) { }
}
// 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<A> = Cell<(A, A)>;
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
// 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]
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
//
// compile-pass
-#![feature(nll)]
-#![allow(unused_variables)]
-
use std::collections::BTreeMap;
trait ValueTree {
//
// compile-pass
-#![feature(nll)]
-#![allow(unused_variables)]
-
use std::collections::BTreeMap;
use std::ops::Range;
use std::cmp::Ord;
--- /dev/null
+error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
+ --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
+ |
+LL | bar::<T::Output>()
+ | ^^^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
-#![feature(nll)]
-
// Test that we are able to establish that `<T as
// MyTrait<'a>>::Output` outlives `'b` here. We need to prove however
// that `<T as MyTrait<'a>>::Output` outlives `'a`, so we also have to
-error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
- --> $DIR/projection-where-clause-env-wrong-bound.rs:17:5
+error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough
+ --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
|
LL | bar::<T::Output>()
| ^^^^^^^^^^^^^^^^
|
- = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
+ = help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`...
+note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds
+ --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
+ |
+LL | bar::<T::Output>()
+ | ^^^^^^^^^^^^^^^^
error: aborting due to previous error
-#![feature(nll)]
-
// Test that when we have a `<T as MyTrait<'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`.
+++ /dev/null
-// 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: 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() {}
+++ /dev/null
-error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/ty-param-fn-body-nll-feature.rs:20:5
- |
-LL | outlives(cell, t)
- | ^^^^^^^^^^^^^^^^^
- |
- = help: consider adding an explicit lifetime bound `T: 'a`...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0309`.
--- /dev/null
+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<B>) -> Self {
+ | - has type `std::boxed::Box<std::boxed::Box<&'1 isize>>`
+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
+
// 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<A<'a>>;
-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<B>) -> Self {
- | - has type `std::boxed::Box<std::boxed::Box<&'1 isize>>`
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<B>) -> Self {
+LL | | C { f: b }
+LL | | }
+ | |_____^
+ = note: ...so that the expression is assignable:
+ expected std::boxed::Box<std::boxed::Box<&isize>>
+ found std::boxed::Box<std::boxed::Box<&isize>>
+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
-#![feature(nll)]
#![deny(unused_mut)]
fn main() {
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();
| ----^
| 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)]
| ^^^^^^^^^^
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
enum SomeEnum<T> {
SomeVariant { t: T }
}
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 };
| ^^
| - `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
| - `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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
struct SomeStruct<T> { t: T }
fn no_annot() {
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 };
| ^^
| - `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
| - `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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
#![allow(warnings)]
use std::cell::Cell;
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)),
| ----------^^-
| - `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
| - `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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
#![allow(warnings)]
enum SomeEnum<T> {
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);
| ^^
| - `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
| - `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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
struct SomeStruct<T>(T);
fn no_annot() {
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);
| ^^
| - `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
| - `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
#![allow(warnings)]
-#![feature(nll)]
fn main() {
let x = 22_u32;
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;
| ^^^^----------------
--- /dev/null
+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 | <Foo<'a>>::C
+ | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
-#![feature(nll)]
-
struct Foo<'a> { x: &'a u32 }
impl<'a> Foo<'a> {
-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 | <Foo<'a>>::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 | <Foo<'a>>::C
- | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+ | ^^^^^^^^^^^^
error: aborting due to previous error
// 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 {
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);
| ----^^-
| - `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);
| ------------------^^-
| - `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);
| -----------------------^^-
| - `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);
| --------------------------^^-
--- /dev/null
+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
+
-#![feature(nll)]
-
trait Mirror {
type Me;
}
-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
--- /dev/null
+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
+
-#![feature(nll)]
-
trait Foo<'a> {
const C: &'a u32;
}
-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
--- /dev/null
+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 | <T as Foo<'a>>::C
+ | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
-#![feature(nll)]
-
trait Foo<'a> {
const C: &'a u32;
}
-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 | <T 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-2.rs:9:8
+ |
+LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
+ | ^^
error: aborting due to previous error
--- /dev/null
+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
+
-#![feature(nll)]
-
trait Foo<'a> {
const C: &'a u32;
}
-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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
fn some_fn<T>(arg: T) { }
fn no_annot() {
error[E0597]: `c` does not live long enough
- --> $DIR/fns.rs:25:29
+ --> $DIR/fns.rs:23:29
|
LL | some_fn::<&'static u32>(&c);
| ------------------------^^-
| - `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
| - `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
// compile-pass
-#![feature(nll)]
// This test is reduced from a scenario pnkfelix encountered while
// bootstrapping the compiler.
//
// run-pass
-#![feature(nll)]
-
pub struct Foo<T>(T);
impl<T> Foo<T> {
//
// run-pass
-#![feature(nll)]
-
pub trait Hasher {
type Out: Eq;
}
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
trait Bazoom<T> {
fn method<U>(&self, arg: T, arg2: U) { }
}
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);
| -----------------------------^^-
| - `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
| - `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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
trait Bazoom<T>: Sized {
fn method<U>(self, arg: T, arg2: U) { }
}
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);
| --^^-------
| - `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
| - `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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
trait Bazoom<T>: Sized {
fn method<U>(self, arg: T, arg2: U) { }
}
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);
| --^^-------
| - `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
| - `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
// Unit test for the "user substitutions" that are annotated on each
// node.
-#![feature(nll)]
-
trait Bazoom<T> {
fn method<U>(&self, arg: T, arg2: U) { }
}
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);
| ------------------------------------------------^^-
| - `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
| - `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
-#![feature(nll)]
-
// Check that substitutions given on the self type (here, `A`) can be
// used in combination with annotations given for method arguments.
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
| - `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
-#![feature(nll)]
-
// Check that inherent methods invoked with `<T>::new` style
// carry their annotations through to NLL in connection with
// method type parameters.
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
| - `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
// 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; }
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
//
// run-pass
-#![feature(nll)]
-
trait Mirror {
type Me;
}
-#![feature(nll)]
-
enum Foo<'a> {
Bar { field: &'a u32 }
}
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
| - `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
-#![feature(nll)]
-
struct Foo<'a> { field: &'a u32 }
fn in_let() {
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
| - `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
-#![feature(nll)]
-
enum Foo<'a> {
Bar(&'a u32)
}
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
| - `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
-#![feature(nll)]
-
struct Foo<'a>(&'a u32);
fn in_let() {
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
| - `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
// Test that type annotations are checked in promoted constants correctly.
-#![feature(nll)]
-
fn foo<'a>() {
let x = 0;
let f = &drop::<&'a i32>;
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
#![allow(warnings)]
-#![feature(nll)]
#![feature(type_ascription)]
fn main() {
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;
| ^^--------------
// compile-pass
-#![feature(nll)]
#![feature(bind_by_move_pattern_guards)]
use std::sync::mpsc::channel;
-#![feature(nll)]
#![feature(bind_by_move_pattern_guards)]
// compile-pass
-#![feature(nll)]
-
#[derive(Clone)]
enum Either {
One(X),
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
| 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
| 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
| 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
| -- ...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)) => (),
| ^^ ^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
| 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
| 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
| 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
| 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
| 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
| 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
| -- ...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)) => (),
| ^^ ^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
| 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
| 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
| 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
| 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)) { }
| ^^^^--^^^^^--^^
| 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)) { }
| ^^^^^^^^--^^^^^--^^
| 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)) { }
| ^^ ^^
-#![feature(nll)]
-
#[derive(Clone)]
enum Either {
One(X),
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
| 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
| 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
| 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
| -- 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
| -- 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
| 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
| 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
| 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
| ------ 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
| ------ 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
| 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
| 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
| 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
| -- 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
| -- 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
| 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
| 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
| 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
| ------ 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
| ------ 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
| ------ 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) => (),
| ^^^^^^
-#![feature(nll)]
-
#[derive(Clone)]
enum Either {
One(X),
error[E0507]: cannot move out of borrowed content
- --> $DIR/simple.rs:40:17
+ --> $DIR/simple.rs:38:17
|
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 { }
| -- ^^
| 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 { }
| -- ^^
| 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 {
| ^^
| -- 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 {
| ^^
| -- 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;
| -- ^^^
| 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 { }
| -- ^^^
| 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 { }
| -- ^^^
| 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 {
| ^^^
| -- 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 {
| ^^^
| -- 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 {
| ^^^
| -- 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];
| -- ^^^^^
| 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] { }
| -- ^^^^^
| 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] { }
| -- ^^^^^
| 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] {
| ^^^^^
| -- 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] {
| ^^^^^
| -- 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];
| -- ^^^^^^
| 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] { }
| -- ^^^^^^
| 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] { }
| -- ^^^^^^
| 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] {
| ^^^^^^
| -- 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] {
| ^^^^^^
| -- 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] {
| ^^^^^^
| -- 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| -- ...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) => (),
| ^^
| ^^^^^^^^^^^^^^^
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
| 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
| 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
| 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
| 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
| 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
| 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
| -- 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
| 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
| 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
| 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
| -- ...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),) => (),
| ^^
| ^^
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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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) { }
| ^^^--^
| 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) { }
| ^^^^^^^--^
| 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,)) { }
| ^^^^--^^^
| 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,)) { }
| ^^^^^^^^--^^^
| 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,)) { }
| ^^
-#![feature(nll)]
-
struct X(usize);
impl X {
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`
| ^^^^^^^^^^^ `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`
| ^^^^^^^^^ `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`
| ^^^^^^^^^ `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