Update the previously checkpointed (but unused by bors) tests to reflect current reality.

This commit is contained in:
Felix S. Klock II 2018-04-12 12:25:29 +02:00
parent 02a7809f1c
commit ea454746b3
19 changed files with 174 additions and 50 deletions

View File

@ -16,7 +16,7 @@ error[E0594]: cannot assign to immutable item `x`
LL | give_any(|y| x = Some(y));
| ^^^^^^^^^^^ cannot mutate
|
= note: Value not mutable causing this error: `x`
= note: the value which is causing this path not to be mutable is...: `x`
error[E0596]: cannot borrow immutable item `x` as mutable
--> $DIR/issue-45983.rs:17:14

View File

@ -1,3 +1,9 @@
error[E0596]: cannot borrow immutable item `self` as mutable
--> $DIR/issue-34126.rs:16:18
|
LL | self.run(&mut self); //~ ERROR cannot borrow
| ^^^^^^^^^ cannot borrow as mutable
error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable
--> $DIR/issue-34126.rs:16:18
|
@ -8,6 +14,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow
| immutable borrow occurs here
| borrow later used here
error: aborting due to previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0502`.
Some errors occurred: E0502, E0596.
For more information about an error, try `rustc --explain E0502`.

View File

@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `f.v` as mutable
LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow
| ^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `f`
= note: the value which is causing this path not to be mutable is...: `f`
error[E0384]: cannot assign twice to immutable variable `s.x`
--> $DIR/issue-35937.rs:26:5

View File

@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*self.s` as mutable
LL | self.s.push('x'); //~ ERROR cannot borrow data mutably
| ^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`
error: aborting due to previous error

View File

@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*f.s` as mutable
LL | f.s.push('x'); //~ ERROR cannot borrow data mutably
| ^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*f`
= note: the value which is causing this path not to be mutable is...: `*f`
error: aborting due to previous error

View File

@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `z.x` as mutable
LL | let _ = &mut z.x; //~ ERROR cannot borrow
| ^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `z`
= note: the value which is causing this path not to be mutable is...: `z`
error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:26:17
@ -12,7 +12,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`
error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:30:17
@ -20,7 +20,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`
error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:31:17
@ -28,7 +28,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`
error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:35:17
@ -36,7 +36,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`
error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:36:17
@ -44,7 +44,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`
error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:40:17
@ -52,7 +52,7 @@ error[E0596]: cannot borrow immutable item `self.x` as mutable
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`
error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:41:17
@ -60,7 +60,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`
error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:45:17
@ -68,7 +68,7 @@ error[E0596]: cannot borrow immutable item `other.x` as mutable
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`
error[E0596]: cannot borrow immutable item `z.x` as mutable
--> $DIR/issue-39544.rs:51:13
@ -76,7 +76,7 @@ error[E0596]: cannot borrow immutable item `z.x` as mutable
LL | let _ = &mut z.x; //~ ERROR cannot borrow
| ^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `z`
= note: the value which is causing this path not to be mutable is...: `z`
error[E0596]: cannot borrow immutable item `w.x` as mutable
--> $DIR/issue-39544.rs:52:13
@ -84,7 +84,7 @@ error[E0596]: cannot borrow immutable item `w.x` as mutable
LL | let _ = &mut w.x; //~ ERROR cannot borrow
| ^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*w`
= note: the value which is causing this path not to be mutable is...: `*w`
error[E0594]: cannot assign to immutable item `*x.0`
--> $DIR/issue-39544.rs:58:5

View File

@ -1,10 +1,10 @@
error[E0594]: cannot assign to immutable item `fancy_ref.num`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/E0389.rs:18:5
|
LL | let fancy_ref = &(&mut fancy);
| ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
LL | fancy_ref.num = 6; //~ ERROR E0389
| ^^^^^^^^^^^^^^^^^ cannot mutate
|
= note: Value not mutable causing this error: `*fancy_ref`
| ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written
error: aborting due to previous error

View File

@ -0,0 +1,46 @@
error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:38:42
|
LL | $foo.x
| ------ value moved here
...
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ^^^^^ value used here after move
|
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:28:9
|
LL | $foo.x
| ------ value moved here
...
LL | $foo.x //~ ERROR use of moved value: `foo.x`
| ^^^^^^ value used here after move
...
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ----- value moved here
LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ----------------- in this macro invocation
|
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:39:42
|
LL | $foo.x
| ------ value moved here
...
LL | $foo.x //~ ERROR use of moved value: `foo.x`
| ------ value moved here
...
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ----- value moved here
LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ^^^^^ value used here after move
|
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0382`.

View File

@ -0,0 +1,13 @@
error: compilation successful
--> $DIR/fields-numeric-borrowck.rs:13:1
|
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
LL | | let mut s = S(0);
LL | | let borrow1 = &mut s.0;
LL | | let S { 0: ref mut borrow2 } = s;
LL | | //~^ ERROR cannot borrow `s.0` as mutable more than once at a time
LL | | }
| |_^
error: aborting due to previous error

View File

@ -7,10 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
struct S(u8);
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut s = S(0);
let borrow1 = &mut s.0;
let S { 0: ref mut borrow2 } = s;

View File

@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable
LL | f(&mut *x); //~ ERROR cannot borrow immutable
| ^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `x`
= note: the value which is causing this path not to be mutable is...: `x`
error: aborting due to previous error

View File

@ -1,20 +1,26 @@
error[E0594]: cannot assign to immutable item `*x`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/enum.rs:19:5
|
LL | let Wrap(x) = &Wrap(3);
| - help: consider changing this to be a mutable reference: `&mut`
LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^
error[E0594]: cannot assign to immutable item `*x`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/enum.rs:23:9
|
LL | if let Some(x) = &Some(3) {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^
error[E0594]: cannot assign to immutable item `*x`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/enum.rs:29:9
|
LL | while let Some(x) = &Some(3) {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^
error: aborting due to 3 previous errors

View File

@ -1,20 +1,26 @@
error[E0594]: cannot assign to immutable item `*n`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/explicit-mut.rs:17:13
|
LL | Some(n) => {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^
error[E0594]: cannot assign to immutable item `*n`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/explicit-mut.rs:25:13
|
LL | Some(n) => {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^
error[E0594]: cannot assign to immutable item `*n`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/explicit-mut.rs:33:13
|
LL | Some(n) => {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^
error: aborting due to 3 previous errors

View File

@ -24,7 +24,7 @@ error[E0596]: cannot borrow immutable item `*f.f` as mutable
LL | f.f.call_mut(())
| ^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*f`
= note: the value which is causing this path not to be mutable is...: `*f`
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13

View File

@ -10,7 +10,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable
LL | x.borrowed_mut(); //~ ERROR cannot borrow
| ^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `x`
= note: the value which is causing this path not to be mutable is...: `x`
error: aborting due to 2 previous errors

View File

@ -0,0 +1,16 @@
error[E0597]: `*a` does not live long enough
--> $DIR/destructor-restrictions.rs:18:10
|
LL | *a.borrow() + 1
| ^---------
| |
| borrowed value does not live long enough
| borrow may end up in a temporary, created here
LL | }; //~^ ERROR `*a` does not live long enough
| -- temporary later dropped here, potentially using the reference
| |
| borrowed value only lives until here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.

View File

@ -0,0 +1,30 @@
error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5
|
LL | y.borrow().clone()
| ^---------
| |
| borrowed value does not live long enough
| borrow may end up in a temporary, created here
LL | }
| -
| |
| borrowed value only lives until here
| temporary later dropped here, potentially using the reference
error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9
|
LL | y.borrow().clone()
| ^---------
| |
| borrowed value does not live long enough
| borrow may end up in a temporary, created here
LL | };
| -- temporary later dropped here, potentially using the reference
| |
| borrowed value only lives until here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0597`.

View File

@ -1,14 +1,14 @@
error: compilation successful
--> $DIR/wf-method-late-bound-regions.rs:25:1
error[E0597]: `pointer` does not live long enough
--> $DIR/wf-method-late-bound-regions.rs:30:18
|
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
LL | | let f = Foo(None);
LL | | let f2 = f;
LL | | let dangling = {
... |
LL | | println!("{}", dangling);
LL | | }
| |_^
LL | f2.xmute(&pointer)
| ^^^^^^^^ borrowed value does not live long enough
LL | };
| - borrowed value only lives until here
LL | //~^^ ERROR `pointer` does not live long enough
LL | println!("{}", dangling);
| -------- borrow later used here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0597`.

View File

@ -11,7 +11,7 @@
// A method's receiver must be well-formed, even if it has late-bound regions.
// Because of this, a method's substs being well-formed does not imply that
// the method's implied bounds are met.
#![feature(rustc_attrs)]
struct Foo<'b>(Option<&'b ()>);
trait Bar<'b> {
@ -22,7 +22,7 @@ impl<'b> Bar<'b> for Foo<'b> {
fn xmute<'a>(&'a self, u: &'b u32) -> &'a u32 { u }
}
fn main() { #![rustc_error] // rust-lang/rust#49855
fn main() {
let f = Foo(None);
let f2 = f;
let dangling = {