Auto merge of #55134 - davidtwco:issue-55118, r=pnkfelix

NLL: change compare-mode=nll to use borrowck=migrate

Fixes #55118.

This PR is split into two parts:

The first commit is a minor change that fixes a flaw in the existing `borrowck=migrate` implementation whereby a lint that was promoted to an error in the AST borrow checker would result in the same lint from the NLL borrow checker being downgraded to a warning in migrate mode. This PR fixes this by ensuring lints are exempt from buffering in the NLL borrow checker.

The second commit updates `compiletest` to make the NLL compare mode use `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The third commit shows all the test output changes that result from this.

r? @pnkfelix
This commit is contained in:
bors 2018-10-17 23:16:10 +00:00
commit f7eb7fbbf6
206 changed files with 928 additions and 2966 deletions

View File

@ -320,20 +320,20 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
continue;
}
let mut err = tcx.struct_span_lint_node(
let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
tcx.struct_span_lint_node(
UNUSED_MUT,
vsi[local_decl.source_info.scope].lint_root,
span,
"variable does not need to be mutable",
);
let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
err.span_suggestion_short_with_applicability(
)
.span_suggestion_short_with_applicability(
mut_span,
"remove this `mut`",
String::new(),
Applicability::MachineApplicable);
err.buffer(&mut mbcx.errors_buffer);
Applicability::MachineApplicable,
)
.emit();
}
}

View File

@ -13,6 +13,18 @@ note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not im
LL | match *s { sty(v) => v } //~ ERROR cannot move out
| ^
error: aborting due to previous error
error[E0507]: cannot move out of `s.0` which is behind a `&` reference
--> $DIR/access-mode-in-closures.rs:19:24
|
LL | let _foo = unpack(|s| {
| - help: consider changing this to be a mutable reference: `&mut sty`
LL | // Test that `s` is moved here.
LL | match *s { sty(v) => v } //~ ERROR cannot move out
| ^
| |
| cannot move out of `s.0` which is behind a `&` reference
| `s` is a `&` reference, so the data it refers to cannot be moved
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,24 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32:29
|
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'a` must outlive `'b`
error: unsatisfied lifetime constraints
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32:40
|
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'b` must outlive `'a`
error: aborting due to 2 previous errors

View File

@ -1,24 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/associated-types-subtyping-1.rs:36:13
|
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let _c: <T as Trait<'b>>::Type = a; //~ ERROR E0623
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
error: unsatisfied lifetime constraints
--> $DIR/associated-types-subtyping-1.rs:44:12
|
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let b: <T as Trait<'b>>::Type = make_any();
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
error: aborting due to 2 previous errors

View File

@ -1,24 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-contravariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-contravariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
error: aborting due to 2 previous errors

View File

@ -1,20 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-contravariant.rs:48:4
|
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | bar(foo, x) //[transmute]~ ERROR E0495
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-contravariant.rs:48:4
|
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | bar(foo, x) //[transmute]~ ERROR E0495
| ^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: aborting due to 2 previous errors

View File

@ -1,24 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:65:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b) //[krisskross]~ ERROR E0623
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:65:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b) //[krisskross]~ ERROR E0623
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
error: aborting due to 2 previous errors

View File

@ -1,24 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:48:12
|
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
LL | let a = bar(f, x);
| ^^^^^^^^^ argument requires that `'a` must outlive `'b`
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:49:12
|
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let b = bar(f, y); //[oneuse]~ ERROR 49:19: 49:20: lifetime mismatch [E0623]
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to 2 previous errors

View File

@ -1,22 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:58:4
|
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
| -- lifetime `'a` defined here
...
LL | bar(foo, x) //[transmute]~ ERROR E0495
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:58:4
|
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | bar(foo, x) //[transmute]~ ERROR E0495
| ^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: aborting due to 2 previous errors

View File

@ -32,6 +32,18 @@ error[E0507]: cannot move out of borrowed content
LL | *n; //~ ERROR: cannot move out of borrowed content
| ^^ cannot move out of borrowed content
error[E0507]: cannot move out of `*n` which is behind a `&` reference
--> $DIR/binop-move-semantics.rs:42:5
|
LL | let n = &y;
| -- help: consider changing this to be a mutable reference: `&mut y`
...
LL | *n; //~ ERROR: cannot move out of borrowed content
| ^^
| |
| cannot move out of `*n` which is behind a `&` reference
| `n` is a `&` reference, so the data it refers to cannot be moved
error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
--> $DIR/binop-move-semantics.rs:64:5
|
@ -62,7 +74,7 @@ LL | | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also b
| | immutable borrow later used here
| mutable borrow occurs here
error: aborting due to 6 previous errors
error: aborting due to 7 previous errors
Some errors occurred: E0382, E0502, E0507.
For more information about an error, try `rustc --explain E0382`.

View File

@ -40,15 +40,19 @@ LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x`
LL | c1;
| -- first borrow later used here
error[E0594]: cannot assign to `x`, as it is not declared as mutable
warning[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/borrowck-closures-unique.rs:57:38
|
LL | fn e(x: &'static mut isize) {
| - help: consider changing this to be mutable: `mut x`
LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument
| ^^^^^ cannot assign
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error: aborting due to 4 previous errors
error: aborting due to 3 previous errors
Some errors occurred: E0500, E0524, E0594.
For more information about an error, try `rustc --explain E0500`.

View File

@ -20,7 +20,7 @@ LL | //[mir]~^ ERROR cannot borrow `x` as mutable more than o
LL | *y = 1;
| ------ first borrow later used here
error: captured variable cannot escape `FnMut` closure body
warning: captured variable cannot escape `FnMut` closure body
--> $DIR/borrowck-describe-lvalue.rs:305:16
|
LL | || {
@ -36,6 +36,9 @@ LL | | }
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:53:9
@ -339,7 +342,7 @@ LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
LL | drop(x);
| - mutable borrow later used here
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:245:29
|
LL | let x = &mut block;
@ -349,8 +352,12 @@ LL | let p: &'a u8 = &*block.current;
...
LL | drop(x);
| - mutable borrow later used here
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-describe-lvalue.rs:260:33
|
LL | let x = &mut block;
@ -360,6 +367,10 @@ LL | let p : *const u8 = &*(*block).current;
...
LL | drop(x);
| - mutable borrow later used here
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-describe-lvalue.rs:318:22
@ -371,7 +382,7 @@ LL | drop(x); //[ast]~ ERROR use of moved value: `x`
|
= note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error: aborting due to 32 previous errors
error: aborting due to 29 previous errors
Some errors occurred: E0382, E0499, E0502, E0503.
For more information about an error, try `rustc --explain E0382`.

View File

@ -0,0 +1,20 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-fn-in-const-a.rs:19:16
|
LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
| ^^ cannot move out of borrowed content
error[E0507]: cannot move out of `*x` which is behind a `&` reference
--> $DIR/borrowck-fn-in-const-a.rs:19:16
|
LL | fn broken(x: &String) -> String {
| ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
| ^^
| |
| cannot move out of `*x` which is behind a `&` reference
| `x` is a `&` reference, so the data it refers to cannot be moved
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,3 +1,13 @@
error[E0507]: cannot move out of `*__next` which is behind a `&` reference
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
|
LL | for &a in x.iter() { //~ ERROR cannot move out
| -^
| ||
| |cannot move out of `*__next` which is behind a `&` reference
| |`__next` is a `&` reference, so the data it refers to cannot be moved
| help: consider changing this to be a mutable reference: `&mut a`
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
|
@ -13,6 +23,16 @@ note: move occurs because `a` has type `&mut i32`, which does not implement the
LL | for &a in x.iter() { //~ ERROR cannot move out
| ^
error[E0507]: cannot move out of `*__next` which is behind a `&` reference
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10
|
LL | for &a in &f.a { //~ ERROR cannot move out
| -^
| ||
| |cannot move out of `*__next` which is behind a `&` reference
| |`__next` is a `&` reference, so the data it refers to cannot be moved
| help: consider changing this to be a mutable reference: `&mut a`
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15
|
@ -28,6 +48,16 @@ note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not
LL | for &a in &f.a { //~ ERROR cannot move out
| ^
error[E0507]: cannot move out of `*__next` which is behind a `&` reference
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10
|
LL | for &a in x.iter() { //~ ERROR cannot move out
| -^
| ||
| |cannot move out of `*__next` which is behind a `&` reference
| |`__next` is a `&` reference, so the data it refers to cannot be moved
| help: consider changing this to be a mutable reference: `&mut a`
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15
|
@ -43,6 +73,6 @@ note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not im
LL | for &a in x.iter() { //~ ERROR cannot move out
| ^
error: aborting due to 3 previous errors
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -6,6 +6,21 @@ LL | let x = Box::new(0);
LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^ cannot move out of captured variable in an `Fn` closure
error: aborting due to previous error
error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
--> $DIR/borrowck-in-static.rs:15:17
|
LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^
| |
| cannot move out of `x`, as it is a captured variable in a `Fn` closure
| cannot move
|
help: consider changing this to accept closures that implement `FnMut`
--> $DIR/borrowck-in-static.rs:15:14
|
LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -7,6 +7,17 @@ LL | let _b = *y; //~ ERROR cannot move out
| cannot move out of borrowed content
| help: consider removing the `*`: `y`
error: aborting due to previous error
error[E0507]: cannot move out of `*y` which is behind a `&` reference
--> $DIR/borrowck-issue-2657-2.rs:17:18
|
LL | Some(ref y) => {
| ----- help: consider changing this to be a mutable reference: `ref mut y`
LL | let _b = *y; //~ ERROR cannot move out
| ^^
| |
| cannot move out of `*y` which is behind a `&` reference
| `y` is a `&` reference, so the data it refers to cannot be moved
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -24,6 +24,42 @@ LL | num2) => (),
LL | Foo::Foo2(num) => (),
| ^^^
error[E0507]: cannot move out of `f.0` which is behind a `&` reference
--> $DIR/borrowck-move-error-with-note.rs:23:19
|
LL | let f = &Foo::Foo1(box 1, box 2);
| ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
...
LL | Foo::Foo1(num1,
| ^^^^
| |
| cannot move out of `f.0` which is behind a `&` reference
| `f` is a `&` reference, so the data it refers to cannot be moved
error[E0507]: cannot move out of `f.1` which is behind a `&` reference
--> $DIR/borrowck-move-error-with-note.rs:24:19
|
LL | let f = &Foo::Foo1(box 1, box 2);
| ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
...
LL | num2) => (),
| ^^^^
| |
| cannot move out of `f.1` which is behind a `&` reference
| `f` is a `&` reference, so the data it refers to cannot be moved
error[E0507]: cannot move out of `f.0` which is behind a `&` reference
--> $DIR/borrowck-move-error-with-note.rs:25:19
|
LL | let f = &Foo::Foo1(box 1, box 2);
| ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
...
LL | Foo::Foo2(num) => (),
| ^^^
| |
| cannot move out of `f.0` which is behind a `&` reference
| `f` is a `&` reference, so the data it refers to cannot be moved
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-error-with-note.rs:39:11
|
@ -61,7 +97,19 @@ note: move occurs because `n` has type `std::boxed::Box<isize>`, which does not
LL | n => {
| ^
error: aborting due to 3 previous errors
error[E0507]: cannot move out of `a.a` which is behind a `&` reference
--> $DIR/borrowck-move-error-with-note.rs:59:9
|
LL | let a = &A { a: box 1 };
| --------------- help: consider changing this to be a mutable reference: `&mut A { a: box 1 }`
...
LL | n => {
| ^
| |
| cannot move out of `a.a` which is behind a `&` reference
| `a` is a `&` reference, so the data it refers to cannot be moved
error: aborting due to 7 previous errors
Some errors occurred: E0507, E0509.
For more information about an error, try `rustc --explain E0507`.

View File

@ -7,6 +7,17 @@ LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer
| cannot move out of dereference of raw pointer
| help: consider removing the `*`: `x`
error: aborting due to previous error
error[E0507]: cannot move out of `*x` which is behind a `*const` pointer
--> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13
|
LL | unsafe fn foo(x: *const Box<isize>) -> Box<isize> {
| ----------------- help: consider changing this to be a mutable pointer: `*mut std::boxed::Box<isize>`
LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer
| ^^
| |
| cannot move out of `*x` which is behind a `*const` pointer
| `x` is a `*const` pointer, so the data it refers to cannot be moved
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -14,6 +14,15 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
LL | fn arg_item(&_x: &String) {}
| ^^
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/borrowck-move-in-irrefut-pat.rs:16:14
|
LL | fn arg_item(&_x: &String) {}
| ^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
|
@ -30,6 +39,24 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
LL | with(|&_x| ())
| ^^
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/borrowck-move-in-irrefut-pat.rs:21:12
|
LL | with(|&_x| ())
| ^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/borrowck-move-in-irrefut-pat.rs:27:10
|
LL | let &_x = &"hi".to_string();
| ^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-move-in-irrefut-pat.rs:27:15
|
@ -45,6 +72,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
LL | let &_x = &"hi".to_string();
| ^^
error: aborting due to 3 previous errors
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -4,6 +4,15 @@ error[E0507]: cannot move out of an `Rc`
LL | let _x = Rc::new(vec![1, 2]).into_iter();
| ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc`
error: aborting due to previous error
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14
|
LL | let _x = Rc::new(vec![1, 2]).into_iter();
| ^^^^^^^^^^^^^^^^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -7,6 +7,15 @@ LL | let _x = *Rc::new("hi".to_string());
| cannot move out of an `Rc`
| help: consider removing the `*`: `Rc::new("hi".to_string())`
error: aborting due to previous error
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14
|
LL | let _x = *Rc::new("hi".to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -0,0 +1,18 @@
error[E0507]: cannot move out of static item
--> $DIR/borrowck-move-out-of-static-item.rs:28:10
|
LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
| ^^^ cannot move out of static item
error[E0507]: cannot move out of immutable static item `BAR`
--> $DIR/borrowck-move-out-of-static-item.rs:28:10
|
LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
| ^^^
| |
| cannot move out of immutable static item `BAR`
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -26,6 +26,31 @@ LL | //~| to prevent move
LL | Foo { string: b }] => {
|
error: aborting due to previous error
error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference
--> $DIR/borrowck-move-out-of-vec-tail.rs:30:33
|
LL | [_, ref tail..] => {
| -------- help: consider changing this to be a mutable reference: `ref mut tail`
LL | match tail {
LL | &[Foo { string: a },
| ^
| |
| cannot move out of `tail[..].string` which is behind a `&` reference
| `tail` is a `&` reference, so the data it refers to cannot be moved
For more information about this error, try `rustc --explain E0508`.
error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference
--> $DIR/borrowck-move-out-of-vec-tail.rs:34:33
|
LL | [_, ref tail..] => {
| -------- help: consider changing this to be a mutable reference: `ref mut tail`
...
LL | Foo { string: b }] => {
| ^
| |
| cannot move out of `tail[..].string` which is behind a `&` reference
| `tail` is a `&` reference, so the data it refers to cannot be moved
error: aborting due to 3 previous errors
Some errors occurred: E0507, E0508.
For more information about an error, try `rustc --explain E0507`.

View File

@ -7,6 +7,15 @@ LL | let bad = v[0];
| cannot move out of borrowed content
| help: consider borrowing here: `&v[0]`
error: aborting due to previous error
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15
|
LL | let bad = v[0];
| ^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:19:5
|
LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | S { pointer: &mut *p.pointer }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: aborting due to previous error

View File

@ -13,6 +13,15 @@ note: move occurs because `s` has type `std::string::String`, which does not imp
LL | let opt = a.iter().enumerate().find(|(_, &s)| {
| ^
error: aborting due to previous error
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-51415.rs:16:47
|
LL | let opt = a.iter().enumerate().find(|(_, &s)| {
| ^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,14 +0,0 @@
error: borrowed data escapes outside of closure
--> $DIR/issue-7573.rs:32:9
|
LL | let mut lines_to_use: Vec<&CrateId> = Vec::new();
| ---------------- `lines_to_use` is declared here, outside of the closure body
LL | //~^ NOTE cannot infer an appropriate lifetime
LL | let push_id = |installed_id: &CrateId| {
| ------------ `installed_id` is a reference that is only valid in the closure body
...
LL | lines_to_use.push(installed_id);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here
error: aborting due to previous error

View File

@ -0,0 +1,33 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/move-in-static-initializer-issue-38520.rs:25:23
|
LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
| ^^^ cannot move out of borrowed content
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/move-in-static-initializer-issue-38520.rs:25:23
|
LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
| ^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of borrowed content
--> $DIR/move-in-static-initializer-issue-38520.rs:27:22
|
LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
| ^^^ cannot move out of borrowed content
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/move-in-static-initializer-issue-38520.rs:27:22
|
LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
| ^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -277,7 +277,7 @@ LL | &mut x; //~ ERROR
LL | &mut x.0; //~ ERROR
| ^^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to `x`, as it is not declared as mutable
warning[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/mutability-errors.rs:70:9
|
LL | fn imm_capture(x: (i32,)) {
@ -285,8 +285,12 @@ LL | fn imm_capture(x: (i32,)) {
LL | || { //~ ERROR
LL | x = (1,);
| ^^^^^^^^ cannot assign
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
warning[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
--> $DIR/mutability-errors.rs:71:9
|
LL | fn imm_capture(x: (i32,)) {
@ -294,8 +298,12 @@ LL | fn imm_capture(x: (i32,)) {
...
LL | x.0 = 1;
| ^^^^^^^ cannot assign
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
warning[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/mutability-errors.rs:72:9
|
LL | fn imm_capture(x: (i32,)) {
@ -303,8 +311,12 @@ LL | fn imm_capture(x: (i32,)) {
...
LL | &mut x;
| ^^^^^^ cannot borrow as mutable
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
warning[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
--> $DIR/mutability-errors.rs:73:9
|
LL | fn imm_capture(x: (i32,)) {
@ -312,6 +324,10 @@ LL | fn imm_capture(x: (i32,)) {
...
LL | &mut x.0;
| ^^^^^^^^ cannot borrow as mutable
|
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/mutability-errors.rs:76:9
@ -373,7 +389,7 @@ error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
LL | &mut X.0; //~ ERROR
| ^^^^^^^^ cannot borrow as mutable
error: aborting due to 38 previous errors
error: aborting due to 34 previous errors
Some errors occurred: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.

View File

@ -1,12 +0,0 @@
error: borrowed data escapes outside of closure
--> $DIR/regions-escape-bound-fn-2.rs:18:18
|
LL | let mut x = None;
| ----- `x` is declared here, outside of the closure body
LL | with_int(|y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: borrowed data escapes outside of closure
--> $DIR/regions-escape-bound-fn.rs:18:18
|
LL | let mut x: Option<&isize> = None;
| ----- `x` is declared here, outside of the closure body
LL | with_int(|y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: borrowed data escapes outside of closure
--> $DIR/regions-escape-unboxed-closure.rs:16:23
|
LL | let mut x: Option<&isize> = None;
| ----- `x` is declared here, outside of the closure body
LL | with_int(&mut |y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error: aborting due to previous error

View File

@ -7,6 +7,25 @@ LL | call(|| {
LL | y.into_iter();
| ^ cannot move out of captured variable in an `Fn` closure
error: aborting due to previous error
error[E0507]: cannot move out of `y`, as it is a captured variable in a `Fn` closure
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9
|
LL | y.into_iter();
| ^
| |
| cannot move out of `y`, as it is a captured variable in a `Fn` closure
| cannot move
|
help: consider changing this to accept closures that implement `FnMut`
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:20:10
|
LL | call(|| {
| __________^
LL | | y.into_iter();
LL | | //~^ ERROR cannot move out of captured outer variable in an `Fn` closure
LL | | });
| |_____^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -16,6 +16,15 @@ note: move occurs because `identifier` has type `std::string::String`, which doe
LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
| ^^^^^^^^^^
error: aborting due to previous error
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/by-move-pattern-binding.rs:26:17
|
LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
| ^^^^^^^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -58,13 +58,22 @@ LL | let y = { static x: Box<isize> = box 3; x };
| cannot move out of static item
| help: consider borrowing here: `&x`
error[E0507]: cannot move out of immutable static item `x`
--> $DIR/check-static-values-constraints.rs:120:45
|
LL | let y = { static x: Box<isize> = box 3; x };
| ^
| |
| cannot move out of immutable static item `x`
| cannot move
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:120:38
|
LL | let y = { static x: Box<isize> = box 3; x };
| ^^^^^ allocation not allowed in statics
error: aborting due to 10 previous errors
error: aborting due to 11 previous errors
Some errors occurred: E0010, E0015, E0493, E0507.
For more information about an error, try `rustc --explain E0010`.

View File

@ -1,54 +0,0 @@
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:40:5
|
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _`
| |
| expected signature of `for<'a, 'r> fn(fn(&'a u32), &'r i32) -> _`
|
note: required by `with_closure_expecting_fn_with_free_region`
--> $DIR/expect-fn-supply-fn.rs:11:1
|
LL | / fn with_closure_expecting_fn_with_free_region<F>(_: F)
LL | | where F: for<'a> FnOnce(fn(&'a u32), &i32)
LL | | {
LL | | }
| |_^
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:47:5
|
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _`
| |
| expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
|
note: required by `with_closure_expecting_fn_with_bound_region`
--> $DIR/expect-fn-supply-fn.rs:16:1
|
LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
LL | | where F: FnOnce(fn(&u32), &i32)
LL | | {
LL | | }
| |_^
error[E0631]: type mismatch in closure arguments
--> $DIR/expect-fn-supply-fn.rs:56:5
|
LL | with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _`
| |
| expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
|
note: required by `with_closure_expecting_fn_with_bound_region`
--> $DIR/expect-fn-supply-fn.rs:16:1
|
LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
LL | | where F: FnOnce(fn(&u32), &i32)
LL | | {
LL | | }
| |_^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0631`.

View File

@ -1,29 +0,0 @@
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:15:5
|
LL | fn foo(x: &()) {
| --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
LL | / bar(|| {
LL | | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
LL | | let _ = x;
LL | | })
| |______^ lifetime `'static` required
error[E0597]: `x` does not live long enough
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:17:17
|
LL | bar(|| {
| -- value captured here
LL | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
LL | let _ = x;
| ^ borrowed value does not live long enough
LL | })
LL | }
| - `x` dropped here while still borrowed
|
= note: borrowed value must be valid for the static lifetime...
error: aborting due to 2 previous errors
Some errors occurred: E0597, E0621.
For more information about an error, try `rustc --explain E0597`.

View File

@ -1,34 +0,0 @@
error: borrowed data escapes outside of closure
--> $DIR/expect-region-supply-region.rs:28:9
|
LL | let mut f: Option<&u32> = None;
| ----- `f` is declared here, outside of the closure body
LL | closure_expecting_bound(|x| {
| - `x` is a reference that is only valid in the closure body
LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
| ^^^^^^^^^^^ `x` escapes the closure body here
error: borrowed data escapes outside of closure
--> $DIR/expect-region-supply-region.rs:38:9
|
LL | let mut f: Option<&u32> = None;
| ----- `f` is declared here, outside of the closure body
LL | closure_expecting_bound(|x: &u32| {
| - `x` is a reference that is only valid in the closure body
LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
| ^^^^^^^^^^^ `x` escapes the closure body here
error: borrowed data escapes outside of closure
--> $DIR/expect-region-supply-region.rs:52:9
|
LL | let mut f: Option<&u32> = None;
| ----- `f` is declared here, outside of the closure body
...
LL | closure_expecting_bound(|x: &'x u32| {
| - `x` is a reference that is only valid in the closure body
...
LL | f = Some(x);
| ^^^^^^^^^^^ `x` escapes the closure body here
error: aborting due to 3 previous errors

View File

@ -190,7 +190,7 @@ error: trait bounds other than `Sized` on const fn parameters are unstable
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0716]: temporary value dropped while borrowed
warning[E0716]: temporary value dropped while borrowed
--> $DIR/min_const_fn.rs:142:64
|
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
@ -199,6 +199,9 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
| creates a temporary which is freed while still in use
|
= note: borrowed value must be valid for the static lifetime...
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:147:41
@ -218,7 +221,7 @@ error: function pointers in const fn are unstable
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
| ^^^^
error: aborting due to 36 previous errors
error: aborting due to 35 previous errors
Some errors occurred: E0493, E0716.
For more information about an error, try `rustc --explain E0493`.

View File

@ -10,7 +10,7 @@ error: trait bounds other than `Sized` on const fn parameters are unstable
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
| ^^
error[E0716]: temporary value dropped while borrowed
warning[E0716]: temporary value dropped while borrowed
--> $DIR/min_const_fn_dyn.rs:22:67
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
@ -19,7 +19,10 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
| creates a temporary which is freed while still in use
|
= note: borrowed value must be valid for the static lifetime...
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0716`.

View File

@ -16,13 +16,31 @@ error[E0507]: cannot move out of borrowed content
LL | S[0];
| ^^^^ cannot move out of borrowed content
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/dst-index.rs:41:5
|
LL | S[0];
| ^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of borrowed content
--> $DIR/dst-index.rs:44:5
|
LL | T[0];
| ^^^^ cannot move out of borrowed content
error: aborting due to 4 previous errors
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/dst-index.rs:44:5
|
LL | T[0];
| ^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 6 previous errors
Some errors occurred: E0161, E0507.
For more information about an error, try `rustc --explain E0161`.

View File

@ -16,13 +16,33 @@ error[E0507]: cannot move out of borrowed content
LL | let _x: Box<str> = box *"hello world";
| ^^^^^^^^^^^^^^ cannot move out of borrowed content
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/dst-rvalue.rs:16:28
|
LL | let _x: Box<str> = box *"hello world";
| ^^^^^^^^^^^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0508]: cannot move out of type `[isize]`, a non-copy slice
--> $DIR/dst-rvalue.rs:21:32
|
LL | let _x: Box<[isize]> = box *array;
| ^^^^^^ cannot move out of here
error: aborting due to 4 previous errors
error[E0507]: cannot move out of `*array` which is behind a `&` reference
--> $DIR/dst-rvalue.rs:21:32
|
LL | let array: &[isize] = &[1, 2, 3];
| ---------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3]`
LL | let _x: Box<[isize]> = box *array;
| ^^^^^^
| |
| cannot move out of `*array` which is behind a `&` reference
| `array` is a `&` reference, so the data it refers to cannot be moved
error: aborting due to 6 previous errors
Some errors occurred: E0161, E0507, E0508.
For more information about an error, try `rustc --explain E0161`.

View File

@ -0,0 +1,18 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/E0507.rs:22:5
|
LL | x.borrow().nothing_is_true(); //~ ERROR E0507
| ^^^^^^^^^^ cannot move out of borrowed content
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/E0507.rs:22:5
|
LL | x.borrow().nothing_is_true(); //~ ERROR E0507
| ^^^^^^^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,11 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/E0621-does-not-trigger-for-closures.rs:25:45
|
LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
| -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is &'2 i32
| has type `&'1 i32`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error[E0308]: mismatched types
--> $DIR/generic_type_does_not_live_long_enough.rs:16:18
|
LL | let z: i32 = x; //~ ERROR mismatched types
| ^ expected i32, found opaque type
|
= note: expected type `i32`
found type `WrongGeneric::<&{integer}>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,30 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/hr-subtype.rs:43:13
|
LL | fn subtype<'x,'y:'x,'z:'y>() {
| -- -- lifetime `'y` defined here
| |
| lifetime `'x` defined here
LL | gimme::<$t2>(None::<$t1>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
...
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |__________________________________________________- in this macro invocation
error: unsatisfied lifetime constraints
--> $DIR/hr-subtype.rs:49:13
|
LL | fn supertype<'x,'y:'x,'z:'y>() {
| -- -- lifetime `'y` defined here
| |
| lifetime `'x` defined here
LL | gimme::<$t1>(None::<$t2>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
...
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |__________________________________________________- in this macro invocation
error: aborting due to 2 previous errors

View File

@ -1,16 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/hr-subtype.rs:49:13
|
LL | fn supertype<'x,'y:'x,'z:'y>() {
| -- -- lifetime `'y` defined here
| |
| lifetime `'x` defined here
LL | gimme::<$t1>(None::<$t2>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
...
LL | / check! { free_x_vs_free_y: (fn(&'x u32),
LL | | fn(&'y u32)) }
| |__________________________________________- in this macro invocation
error: aborting due to previous error

View File

@ -1,10 +0,0 @@
error: borrowed data escapes outside of function
--> $DIR/dyn-trait.rs:32:5
|
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| - `x` is a reference that is only valid in the function body
LL | static_val(x); //~ ERROR cannot infer
| ^^^^^^^^^^^^^ `x` escapes the function body here
error: aborting due to previous error

View File

@ -1,49 +0,0 @@
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/must_outlive_least_region_or_bound.rs:13:35
|
LL | fn elided(x: &i32) -> impl Copy { x }
| ---- ^ lifetime `'static` required
| |
| help: add explicit lifetime `'static` to the type of `x`: `&'static i32`
error: unsatisfied lifetime constraints
--> $DIR/must_outlive_least_region_or_bound.rs:16:44
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
| -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
| ^^^^^^^^^^^^^^
error: unsatisfied lifetime constraints
--> $DIR/must_outlive_least_region_or_bound.rs:22:69
|
LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
| -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
error: unsatisfied lifetime constraints
--> $DIR/must_outlive_least_region_or_bound.rs:29:5
|
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | //~^ ERROR lifetime mismatch
LL | move |_| println!("{}", y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:32:51
|
LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
| ^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...
error: aborting due to 5 previous errors
Some errors occurred: E0310, E0621.
For more information about an error, try `rustc --explain E0310`.

View File

@ -1,26 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/static-return-lifetime-infered.rs:17:9
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| - let's call the lifetime of this reference `'1`
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unsatisfied lifetime constraints
--> $DIR/static-return-lifetime-infered.rs:21:9
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| -- lifetime `'a` defined here
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -1,11 +0,0 @@
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/type_parameters_captured.rs:17:20
|
LL | fn foo<T>(x: T) -> impl Any + 'static {
| ^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...
error: aborting due to previous error
For more information about this error, try `rustc --explain E0310`.

View File

@ -1,20 +0,0 @@
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/mismatched.rs:14:42
|
LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required
| ---- ^ lifetime `'a` required
| |
| help: add explicit lifetime `'a` to the type of `y`: `&'a u32`
error: unsatisfied lifetime constraints
--> $DIR/mismatched.rs:16:46
|
LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch
| -- -- ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
| | |
| | lifetime `'b` defined here
| lifetime `'a` defined here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0621`.

View File

@ -1,11 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/issue-10291.rs:13:9
|
LL | fn test<'x>(x: &'x isize) {
| -- lifetime `'x` defined here
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
LL | x //~ ERROR E0312
| ^ returning this value requires that `'x` must outlive `'static`
error: aborting due to previous error

View File

@ -40,6 +40,43 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
LL | (&[hd1, ..], &[hd2, ..])
| ^^^
error: aborting due to 2 previous errors
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-12567.rs:16:17
|
LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
| ^^
| |
| cannot move out of data in a `&` reference
| cannot move
For more information about this error, try `rustc --explain E0508`.
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-12567.rs:16:31
|
LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
| ^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-12567.rs:20:12
|
LL | (&[hd1, ..], &[hd2, ..])
| ^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-12567.rs:20:24
|
LL | (&[hd1, ..], &[hd2, ..])
| ^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 6 previous errors
Some errors occurred: E0507, E0508.
For more information about an error, try `rustc --explain E0507`.

View File

@ -1,12 +0,0 @@
error[E0621]: explicit lifetime required in the type of `cont`
--> $DIR/issue-13058.rs:24:21
|
LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
| -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T`
LL | {
LL | let cont_iter = cont.iter();
| ^^^^^^^^^^^ lifetime `'r` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View File

@ -1,11 +0,0 @@
error[E0621]: explicit lifetime required in the type of `lexer`
--> $DIR/issue-15034.rs:27:9
|
LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
| ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
LL | Parser { lexer: lexer }
| ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View File

@ -1,10 +0,0 @@
error: borrowed data escapes outside of function
--> $DIR/issue-16683.rs:14:9
|
LL | fn b(&self) {
| ----- `self` is a reference that is only valid in the function body
LL | self.a(); //~ ERROR cannot infer
| ^^^^^^^^ `self` escapes the function body here
error: aborting due to previous error

View File

@ -7,6 +7,15 @@ LL | let _a = FOO; //~ ERROR: cannot move out of static item
| cannot move out of static item
| help: consider borrowing here: `&FOO`
error: aborting due to previous error
error[E0507]: cannot move out of immutable static item `FOO`
--> $DIR/issue-17718-static-move.rs:16:14
|
LL | let _a = FOO; //~ ERROR: cannot move out of static item
| ^^^
| |
| cannot move out of immutable static item `FOO`
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,19 +0,0 @@
error[E0308]: match arms have incompatible types
--> $DIR/issue-17728.rs:110:5
|
LL | / match to_parse { //~ ERROR match arms have incompatible types
LL | | "w" | "west" => RoomDirection::West,
LL | | "e" | "east" => RoomDirection::East,
LL | | "n" | "north" => RoomDirection::North,
... |
LL | | _ => None
| | ---- match arm with an incompatible type
LL | | }
| |_____^ expected enum `RoomDirection`, found enum `std::option::Option`
|
= note: expected type `RoomDirection`
found type `std::option::Option<_>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,10 +0,0 @@
error: borrowed data escapes outside of function
--> $DIR/issue-17758.rs:17:9
|
LL | fn bar(&self) {
| ----- `self` is a reference that is only valid in the function body
LL | self.foo();
| ^^^^^^^^^^ `self` escapes the function body here
error: aborting due to previous error

View File

@ -16,6 +16,15 @@ LL | let b = unsafe { *imm_ref() };
| cannot move out of borrowed content
| help: consider removing the `*`: `imm_ref()`
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-20801.rs:39:22
|
LL | let b = unsafe { *imm_ref() };
| ^^^^^^^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of dereference of raw pointer
--> $DIR/issue-20801.rs:42:22
|
@ -34,6 +43,15 @@ LL | let d = unsafe { *const_ptr() };
| cannot move out of dereference of raw pointer
| help: consider removing the `*`: `const_ptr()`
error: aborting due to 4 previous errors
error[E0507]: cannot move out of data in a `*const` pointer
--> $DIR/issue-20801.rs:45:22
|
LL | let d = unsafe { *const_ptr() };
| ^^^^^^^^^^^^
| |
| cannot move out of data in a `*const` pointer
| cannot move
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -4,6 +4,17 @@ error[E0507]: cannot move out of borrowed content
LL | self.tokens //~ ERROR cannot move out of borrowed content
| ^^^^^^^^^^^ cannot move out of borrowed content
error: aborting due to previous error
error[E0507]: cannot move out of `self.tokens` which is behind a `&` reference
--> $DIR/issue-2590.rs:22:9
|
LL | fn parse(&self) -> Vec<isize> {
| ----- help: consider changing this to be a mutable reference: `&mut self`
LL | self.tokens //~ ERROR cannot move out of borrowed content
| ^^^^^^^^^^^
| |
| cannot move out of `self.tokens` which is behind a `&` reference
| `self` is a `&` reference, so the data it refers to cannot be moved
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,9 +0,0 @@
error[E0131]: `main` function is not allowed to have generic parameters
--> $DIR/issue-26217.rs:13:8
|
LL | fn main<'a>() {
| ^^^^ `main` cannot have generic parameters
error: aborting due to previous error
For more information about this error, try `rustc --explain E0131`.

View File

@ -16,7 +16,16 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice
LL | &X(*Y)
| ^^ cannot move out of here
error: aborting due to 3 previous errors
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-30355.rs:15:8
|
LL | &X(*Y)
| ^^
| |
| cannot move out of data in a `&` reference
| cannot move
Some errors occurred: E0161, E0508.
error: aborting due to 4 previous errors
Some errors occurred: E0161, E0507, E0508.
For more information about an error, try `rustc --explain E0161`.

View File

@ -1,21 +0,0 @@
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/issue-40288-2.rs:17:9
|
LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
| -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
...
LL | slice[0] = y;
| ^^^^^^^^^^^^ lifetime `'a` required
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/issue-40288-2.rs:32:9
|
LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
| -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
...
LL | dst.head = y;
| ^^^^^^^^^^^^ lifetime `'a` required
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0621`.

View File

@ -7,6 +7,15 @@ LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content
| cannot move out of borrowed content
| help: consider borrowing here: `&f.v[0]`
error: aborting due to previous error
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-40402-1.rs:19:13
|
LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content
| ^^^^^^
| |
| cannot move out of data in a `&` reference
| cannot move
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,3 +1,21 @@
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-40402-2.rs:15:10
|
LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
| ^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of data in a `&` reference
--> $DIR/issue-40402-2.rs:15:13
|
LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
| ^
| |
| cannot move out of data in a `&` reference
| cannot move
error[E0507]: cannot move out of borrowed content
--> $DIR/issue-40402-2.rs:15:18
|
@ -15,6 +33,6 @@ note: move occurs because these variables have types that don't implement the `C
LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
| ^ ^
error: aborting due to previous error
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0507`.

View File

@ -1,4 +1,4 @@
error: captured variable cannot escape `FnMut` closure body
warning: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-1.rs:18:9
|
LL | || {
@ -8,6 +8,15 @@ LL | &mut x
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error: compilation successful
--> $DIR/issue-40510-1.rs:23:1
|
LL | fn main() {} //~ ERROR compilation successful
| ^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,4 +1,4 @@
error: captured variable cannot escape `FnMut` closure body
warning: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-3.rs:18:9
|
LL | || {
@ -10,6 +10,15 @@ LL | | }
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error: compilation successful
--> $DIR/issue-40510-3.rs:25:1
|
LL | fn main() {} //~ ERROR compilation successful
| ^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -6,6 +6,15 @@ LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
LL | id(Box::new(|| *v))
| ^^ cannot move out of captured variable in an `FnMut` closure
error[E0507]: cannot move out of `*v` which is behind a `&` reference
--> $DIR/issue-4335.rs:16:20
|
LL | id(Box::new(|| *v))
| ^^
| |
| cannot move out of `*v` which is behind a `&` reference
| cannot move
error[E0597]: `v` does not live long enough
--> $DIR/issue-4335.rs:16:21
|
@ -23,7 +32,7 @@ note: borrowed value must be valid for the lifetime 'r as defined on the functio
LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
| ^^
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
Some errors occurred: E0507, E0597.
For more information about an error, try `rustc --explain E0507`.

View File

@ -1,4 +1,4 @@
error: captured variable cannot escape `FnMut` closure body
warning: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-49824.rs:22:9
|
LL | || {
@ -10,6 +10,21 @@ LL | | }
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
It represents potential unsoundness in your code.
This warning will become a hard error in the future.
error: compilation successful
--> $DIR/issue-49824.rs:18:1
|
LL | / fn main() {
LL | | //~^ compilation successful
LL | | let mut x = 0;
LL | | || {
... |
LL | | };
LL | | }
| |_^
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/issue-52213.rs:13:20
|
LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
LL | ((u,),) => u,
| ^ returning this value requires that `'a` must outlive `'b`
error: aborting due to previous error

View File

@ -1,11 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/issue-52533-1.rs:19:18
|
LL | gimme(|x, y| y)
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&Foo<'_, '1, u32>`
| has type `&Foo<'_, '2, u32>`
error: aborting due to previous error

View File

@ -1,11 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/issue-52533.rs:15:16
|
LL | foo(|a, b| b)
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&'1 u32`
| has type `&'2 u32`
error: aborting due to previous error

View File

@ -1,63 +0,0 @@
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:28:13
|
LL | let a = &t as &Gettable<T>;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= help: consider adding a `where T: std::marker::Send` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:28:13
|
LL | let a = &t as &Gettable<T>;
| ^^ the trait `std::marker::Copy` is not implemented for `T`
|
= help: consider adding a `where T: std::marker::Copy` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: `T` cannot be sent between threads safely
--> $DIR/kindck-impl-type-params.rs:35:27
|
LL | let a: &Gettable<T> = &t;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= help: consider adding a `where T: std::marker::Send` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:35:27
|
LL | let a: &Gettable<T> = &t;
| ^^ the trait `std::marker::Copy` is not implemented for `T`
|
= help: consider adding a `where T: std::marker::Copy` bound
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:48:13
|
LL | let a = t as Box<Gettable<String>>;
| ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
|
= note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
= note: required for the cast to the object type `dyn Gettable<std::string::String>`
error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
--> $DIR/kindck-impl-type-params.rs:56:33
|
LL | let a: Box<Gettable<Foo>> = t;
| ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
|
= note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
= note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,32 +0,0 @@
error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
--> $DIR/kindck-send-object1.rs:20:5
|
LL | assert_send::<&'a Dummy>();
| ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)`
= note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)`
note: required by `assert_send`
--> $DIR/kindck-send-object1.rs:15:1
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
--> $DIR/kindck-send-object1.rs:39:5
|
LL | assert_send::<Box<Dummy+'a>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>`
= note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>`
note: required by `assert_send`
--> $DIR/kindck-send-object1.rs:15:1
|
LL | fn assert_send<T:Send+'static>() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,20 +0,0 @@
error: borrowed data escapes outside of function
--> $DIR/lifetime-bound-will-change-warning.rs:44:5
|
LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
| - `x` is a reference that is only valid in the function body
LL | // but ref_obj will not, so warn.
LL | ref_obj(x) //~ ERROR mismatched types
| ^^^^^^^^^^ `x` escapes the function body here
error: borrowed data escapes outside of function
--> $DIR/lifetime-bound-will-change-warning.rs:49:5
|
LL | fn test2cc<'a>(x: &'a Box<Fn()+'a>) {
| - `x` is a reference that is only valid in the function body
LL | // same as test2, but cross crate
LL | lib::ref_obj(x) //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^ `x` escapes the function body here
error: aborting due to 2 previous errors

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:20
|
LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| -- - let's call the lifetime of this reference `'1`
| |
| lifetime `'a` defined here
LL |
LL | if x > y { x } else { y } //~ ERROR lifetime mismatch
| ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5
|
LL | fn foo<'a>(&self, x: &'a i32) -> &i32 {
| -- - let's call the lifetime of this reference `'1`
| |
| lifetime `'a` defined here
LL |
LL | x //~ ERROR lifetime mismatch
| ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30
|
LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
| -- - let's call the lifetime of this reference `'1`
| |
| lifetime `'a` defined here
LL |
LL | if true { x } else { self } //~ ERROR lifetime mismatch
| ^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
error: aborting due to previous error

View File

@ -1,11 +0,0 @@
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/ex2a-push-one-existing-name-2.rs:16:5
|
LL | fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) {
| -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>`
LL | y.push(x); //~ ERROR explicit lifetime
| ^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View File

@ -1,12 +0,0 @@
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/ex2a-push-one-existing-name-early-bound.rs:17:5
|
LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T)
| -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
...
LL | x.push(y); //~ ERROR explicit lifetime required
| ^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View File

@ -1,11 +0,0 @@
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/ex2a-push-one-existing-name.rs:16:5
|
LL | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
| -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>`
LL | x.push(y); //~ ERROR explicit lifetime
| ^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex2b-push-no-existing-names.rs:16:5
|
LL | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
| - - has type `Ref<'1, i32>`
| |
| has type `&mut std::vec::Vec<Ref<'2, i32>>`
LL | x.push(y); //~ ERROR lifetime mismatch
| ^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex2c-push-inference-variable.rs:17:5
|
LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| -- -- lifetime `'c` defined here
| |
| lifetime `'b` defined here
LL | let z = Ref { data: y.data };
LL | x.push(z); //~ ERROR lifetime mismatch
| ^^^^^^^^^ argument requires that `'c` must outlive `'b`
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex2d-push-inference-variable-2.rs:18:5
|
LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| -- -- lifetime `'c` defined here
| |
| lifetime `'b` defined here
...
LL | a.push(b);
| ^^^^^^^^^ argument requires that `'c` must outlive `'b`
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex2e-push-inference-variable-3.rs:18:5
|
LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| -- -- lifetime `'c` defined here
| |
| lifetime `'b` defined here
...
LL | Vec::push(a, b);
| ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-2.rs:12:5
|
LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | *v = x; //~ ERROR lifetime mismatch
| ^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,22 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-3.rs:12:5
|
LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | z.push((x,y)); //~ ERROR lifetime mismatch
| ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-3.rs:12:5
|
LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | z.push((x,y)); //~ ERROR lifetime mismatch
| ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to 2 previous errors

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:5
|
LL | fn foo(mut x: Ref, y: Ref) {
| ----- - has type `Ref<'_, '1>`
| |
| has type `Ref<'_, '2>`
LL | x.b = y.b; //~ ERROR lifetime mismatch
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:5
|
LL | fn foo(mut x: Ref) {
| -----
| |
| has type `Ref<'_, '1>`
| has type `Ref<'2, '_>`
LL | x.a = x.b; //~ ERROR lifetime mismatch
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,13 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:18:5
|
LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | x.push(y); //~ ERROR lifetime mismatch
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:15:5
|
LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | x.push(y); //~ ERROR lifetime mismatch
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:5
|
LL | fn foo(mut x: Vec<Ref>, y: Ref) {
| ----- - has type `Ref<'1>`
| |
| has type `std::vec::Vec<Ref<'2>>`
LL | x.push(y); //~ ERROR lifetime mismatch
| ^^^^^^^^^ argument requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:5
|
LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | x.push(y); //~ ERROR lifetime mismatch
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
error: aborting due to previous error

View File

@ -1,21 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
|
LL | fn foo(mut x: Ref, y: &u32) {
| ----- - let's call the lifetime of this reference `'2`
| |
| has type `Ref<'_, '1>`
LL | y = x.b; //~ ERROR lifetime mismatch
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error[E0384]: cannot assign to immutable argument `y`
--> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
|
LL | fn foo(mut x: Ref, y: &u32) {
| - help: make this binding mutable: `mut y`
LL | y = x.b; //~ ERROR lifetime mismatch
| ^^^^^^^ cannot assign to immutable argument
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0384`.

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:5
|
LL | fn foo(mut y: Ref, x: &u32) {
| ----- - let's call the lifetime of this reference `'1`
| |
| has type `Ref<'_, '2>`
LL | y.b = x; //~ ERROR lifetime mismatch
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:5
|
LL | fn foo(mut y: Ref, x: &u32) {
| ----- - let's call the lifetime of this reference `'1`
| |
| has type `Ref<'_, '2>`
LL | y.b = x; //~ ERROR lifetime mismatch
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:5
|
LL | fn foo(mut x: Ref, y: &u32) {
| ----- - let's call the lifetime of this reference `'1`
| |
| has type `Ref<'_, '2>`
LL | x.b = y; //~ ERROR lifetime mismatch
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
error: aborting due to previous error

View File

@ -1,12 +0,0 @@
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5
|
LL | fn foo<'a>(&self, x: &i32) -> &i32 {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | x //~ ERROR lifetime mismatch
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: aborting due to previous error

Some files were not shown because too many files have changed in this diff Show More