diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-04-22 08:40:08 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-04-22 08:40:08 +0100 |
| commit | 8eef102270647af94f38274efb9a2fd5ef8a92ec (patch) | |
| tree | 95d7674ad687c45b730906915e79a0993138306b /src/test/ui/error-codes | |
| parent | aa6fb6caf9d8456c70144ccba1e969c85926e229 (diff) | |
| download | rust-8eef102270647af94f38274efb9a2fd5ef8a92ec.tar.gz rust-8eef102270647af94f38274efb9a2fd5ef8a92ec.zip | |
update tests for migrate mode by default
Diffstat (limited to 'src/test/ui/error-codes')
29 files changed, 58 insertions, 241 deletions
diff --git a/src/test/ui/error-codes/E0008.nll.stderr b/src/test/ui/error-codes/E0008.nll.stderr deleted file mode 100644 index 2505c03a148..00000000000 --- a/src/test/ui/error-codes/E0008.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0008]: cannot bind by-move into a pattern guard - --> $DIR/E0008.rs:3:14 - | -LL | Some(s) if s.len() == 0 => {}, - | ^ moves value into pattern guard - | - = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0008`. diff --git a/src/test/ui/error-codes/E0008.stderr b/src/test/ui/error-codes/E0008.stderr index d5c44efd667..2505c03a148 100644 --- a/src/test/ui/error-codes/E0008.stderr +++ b/src/test/ui/error-codes/E0008.stderr @@ -3,6 +3,8 @@ error[E0008]: cannot bind by-move into a pattern guard | LL | Some(s) if s.len() == 0 => {}, | ^ moves value into pattern guard + | + = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0017.nll.stderr b/src/test/ui/error-codes/E0017.nll.stderr deleted file mode 100644 index 67ff7da611b..00000000000 --- a/src/test/ui/error-codes/E0017.nll.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error[E0017]: references in constants may only refer to immutable values - --> $DIR/E0017.rs:4:30 - | -LL | const CR: &'static mut i32 = &mut C; - | ^^^^^^ constants require immutable values - -error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0017.rs:5:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ statics require immutable values - -error: cannot mutate statics in the initializer of another static - --> $DIR/E0017.rs:5:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ - -error[E0596]: cannot borrow immutable static item `X` as mutable - --> $DIR/E0017.rs:5:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ cannot borrow as mutable - -error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0017.rs:8:38 - | -LL | static CONST_REF: &'static mut i32 = &mut C; - | ^^^^^^ statics require immutable values - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0017, E0596. -For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index 07fe9076715..67ff7da611b 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -16,11 +16,11 @@ error: cannot mutate statics in the initializer of another static LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ -error[E0596]: cannot borrow immutable static item as mutable - --> $DIR/E0017.rs:5:44 +error[E0596]: cannot borrow immutable static item `X` as mutable + --> $DIR/E0017.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^ + | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:8:38 diff --git a/src/test/ui/error-codes/E0161.ast.stderr b/src/test/ui/error-codes/E0161.migrate.stderr index 536a81a4bc6..536a81a4bc6 100644 --- a/src/test/ui/error-codes/E0161.ast.stderr +++ b/src/test/ui/error-codes/E0161.migrate.stderr diff --git a/src/test/ui/error-codes/E0161.astul.stderr b/src/test/ui/error-codes/E0161.migrateul.stderr index 2baba998f12..2baba998f12 100644 --- a/src/test/ui/error-codes/E0161.astul.stderr +++ b/src/test/ui/error-codes/E0161.migrateul.stderr diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs index a6d2b245eb1..2ca17050ae2 100644 --- a/src/test/ui/error-codes/E0161.rs +++ b/src/test/ui/error-codes/E0161.rs @@ -3,15 +3,15 @@ // Check that E0161 is a hard error in all possible configurations that might // affect it. -// revisions: ast nll zflags edition astul nllul zflagsul editionul -//[zflags]compile-flags: -Z borrowck=migrate -Z two-phase-borrows +// revisions: migrate nll zflags edition migrateul nllul zflagsul editionul +//[zflags]compile-flags: -Z borrowck=migrate //[edition]edition:2018 -//[zflagsul]compile-flags: -Z borrowck=migrate -Z two-phase-borrows +//[zflagsul]compile-flags: -Z borrowck=migrate //[editionul]edition:2018 #![cfg_attr(nll, feature(nll))] #![cfg_attr(nllul, feature(nll))] -#![cfg_attr(astul, feature(unsized_locals))] +#![cfg_attr(migrateul, feature(unsized_locals))] #![cfg_attr(zflagsul, feature(unsized_locals))] #![cfg_attr(nllul, feature(unsized_locals))] #![cfg_attr(editionul, feature(unsized_locals))] @@ -20,11 +20,11 @@ fn foo(x: Box<[i32]>) { box *x; - //[ast]~^ ERROR E0161 + //[migrate]~^ ERROR E0161 //[nll]~^^ ERROR E0161 //[zflags]~^^^ ERROR E0161 //[edition]~^^^^ ERROR E0161 - //[astul]~^^^^^ ERROR E0161 + //[migrateul]~^^^^^ ERROR E0161 //[nllul]~^^^^^^ ERROR E0161 //[zflagsul]~^^^^^^^ ERROR E0161 //[editionul]~^^^^^^^^ ERROR E0161 diff --git a/src/test/ui/error-codes/E0301.nll.stderr b/src/test/ui/error-codes/E0301.nll.stderr deleted file mode 100644 index 24234c9929e..00000000000 --- a/src/test/ui/error-codes/E0301.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0301]: cannot mutably borrow in a pattern guard - --> $DIR/E0301.rs:4:19 - | -LL | option if option.take().is_none() => {}, - | ^^^^^^ borrowed mutably in pattern guard - | - = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0301`. diff --git a/src/test/ui/error-codes/E0301.stderr b/src/test/ui/error-codes/E0301.stderr index 80ee681a517..24234c9929e 100644 --- a/src/test/ui/error-codes/E0301.stderr +++ b/src/test/ui/error-codes/E0301.stderr @@ -3,6 +3,8 @@ error[E0301]: cannot mutably borrow in a pattern guard | LL | option if option.take().is_none() => {}, | ^^^^^^ borrowed mutably in pattern guard + | + = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0388.nll.stderr b/src/test/ui/error-codes/E0388.nll.stderr deleted file mode 100644 index e0ca4316732..00000000000 --- a/src/test/ui/error-codes/E0388.nll.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error[E0017]: references in constants may only refer to immutable values - --> $DIR/E0388.rs:4:30 - | -LL | const CR: &'static mut i32 = &mut C; - | ^^^^^^ constants require immutable values - -error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0388.rs:5:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ statics require immutable values - -error: cannot mutate statics in the initializer of another static - --> $DIR/E0388.rs:5:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ - -error[E0596]: cannot borrow immutable static item `X` as mutable - --> $DIR/E0388.rs:5:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ cannot borrow as mutable - -error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0388.rs:8:38 - | -LL | static CONST_REF: &'static mut i32 = &mut C; - | ^^^^^^ statics require immutable values - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0017, E0596. -For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr index fae43ff4647..e0ca4316732 100644 --- a/src/test/ui/error-codes/E0388.stderr +++ b/src/test/ui/error-codes/E0388.stderr @@ -16,11 +16,11 @@ error: cannot mutate statics in the initializer of another static LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ -error[E0596]: cannot borrow immutable static item as mutable - --> $DIR/E0388.rs:5:44 +error[E0596]: cannot borrow immutable static item `X` as mutable + --> $DIR/E0388.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^ + | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:8:38 diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr deleted file mode 100644 index 5310367d51a..00000000000 --- a/src/test/ui/error-codes/E0389.nll.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference - --> $DIR/E0389.rs:8:5 - | -LL | let fancy_ref = &(&mut fancy); - | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` -LL | fancy_ref.num = 6; - | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written - -error: aborting due to previous error - diff --git a/src/test/ui/error-codes/E0389.rs b/src/test/ui/error-codes/E0389.rs index 8b821330ebe..9dab2c30924 100644 --- a/src/test/ui/error-codes/E0389.rs +++ b/src/test/ui/error-codes/E0389.rs @@ -5,6 +5,6 @@ struct FancyNum { fn main() { let mut fancy = FancyNum{ num: 5 }; let fancy_ref = &(&mut fancy); - fancy_ref.num = 6; //~ ERROR E0389 + fancy_ref.num = 6; //~ ERROR cannot assign to `fancy_ref.num` which is behind a `&` reference println!("{}", fancy_ref.num); } diff --git a/src/test/ui/error-codes/E0389.stderr b/src/test/ui/error-codes/E0389.stderr index 927eace727e..5310367d51a 100644 --- a/src/test/ui/error-codes/E0389.stderr +++ b/src/test/ui/error-codes/E0389.stderr @@ -1,9 +1,10 @@ -error[E0389]: cannot assign to data in a `&` reference +error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference --> $DIR/E0389.rs:8:5 | +LL | let fancy_ref = &(&mut fancy); + | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` LL | fancy_ref.num = 6; - | ^^^^^^^^^^^^^^^^^ assignment into an immutable reference + | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error -For more information about this error, try `rustc --explain E0389`. diff --git a/src/test/ui/error-codes/E0499.nll.stderr b/src/test/ui/error-codes/E0499.nll.stderr deleted file mode 100644 index d56baf72272..00000000000 --- a/src/test/ui/error-codes/E0499.nll.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0499]: cannot borrow `i` as mutable more than once at a time - --> $DIR/E0499.rs:4:17 - | -LL | let mut x = &mut i; - | ------ first mutable borrow occurs here -LL | let mut a = &mut i; - | ^^^^^^ second mutable borrow occurs here -LL | a.use_mut(); -LL | x.use_mut(); - | - first borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/error-codes/E0499.stderr b/src/test/ui/error-codes/E0499.stderr index 82270162b38..d56baf72272 100644 --- a/src/test/ui/error-codes/E0499.stderr +++ b/src/test/ui/error-codes/E0499.stderr @@ -1,13 +1,13 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time - --> $DIR/E0499.rs:4:22 + --> $DIR/E0499.rs:4:17 | LL | let mut x = &mut i; - | - first mutable borrow occurs here + | ------ first mutable borrow occurs here LL | let mut a = &mut i; - | ^ second mutable borrow occurs here -... -LL | } - | - first borrow ends here + | ^^^^^^ second mutable borrow occurs here +LL | a.use_mut(); +LL | x.use_mut(); + | - first borrow later used here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr deleted file mode 100644 index cade6d71852..00000000000 --- a/src/test/ui/error-codes/E0502.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable - --> $DIR/E0502.rs:4:5 - | -LL | let ref y = a; - | ----- immutable borrow occurs here -LL | bar(a); - | ^^^^^^ mutable borrow occurs here -LL | y.use_ref(); - | - immutable borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/error-codes/E0502.stderr b/src/test/ui/error-codes/E0502.stderr index 26a2c3bf353..cade6d71852 100644 --- a/src/test/ui/error-codes/E0502.stderr +++ b/src/test/ui/error-codes/E0502.stderr @@ -1,13 +1,12 @@ -error[E0502]: cannot borrow `*a` as mutable because `a` is also borrowed as immutable - --> $DIR/E0502.rs:4:9 +error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable + --> $DIR/E0502.rs:4:5 | LL | let ref y = a; | ----- immutable borrow occurs here LL | bar(a); - | ^ mutable borrow occurs here + | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); -LL | } - | - immutable borrow ends here + | - immutable borrow later used here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0503.nll.stderr b/src/test/ui/error-codes/E0503.nll.stderr deleted file mode 100644 index 106dda2bc22..00000000000 --- a/src/test/ui/error-codes/E0503.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0503]: cannot use `value` because it was mutably borrowed - --> $DIR/E0503.rs:4:16 - | -LL | let _borrow = &mut value; - | ---------- borrow of `value` occurs here -LL | let _sum = value + 1; - | ^^^^^ use of borrowed `value` -LL | _borrow.use_mut(); - | ------- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0503`. diff --git a/src/test/ui/error-codes/E0503.stderr b/src/test/ui/error-codes/E0503.stderr index 62cb3afca78..106dda2bc22 100644 --- a/src/test/ui/error-codes/E0503.stderr +++ b/src/test/ui/error-codes/E0503.stderr @@ -2,9 +2,11 @@ error[E0503]: cannot use `value` because it was mutably borrowed --> $DIR/E0503.rs:4:16 | LL | let _borrow = &mut value; - | ----- borrow of `value` occurs here + | ---------- borrow of `value` occurs here LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` +LL | _borrow.use_mut(); + | ------- borrow later used here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0504.nll.stderr b/src/test/ui/error-codes/E0504.nll.stderr deleted file mode 100644 index 1f2a0407a39..00000000000 --- a/src/test/ui/error-codes/E0504.nll.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0505]: cannot move out of `fancy_num` because it is borrowed - --> $DIR/E0504.rs:9:13 - | -LL | let fancy_ref = &fancy_num; - | ---------- borrow of `fancy_num` occurs here -LL | -LL | let x = move || { - | ^^^^^^^ move out of `fancy_num` occurs here -LL | println!("child function: {}", fancy_num.num); - | --------- move occurs due to use in closure -... -LL | println!("main function: {}", fancy_ref.num); - | ------------- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0505`. diff --git a/src/test/ui/error-codes/E0504.rs b/src/test/ui/error-codes/E0504.rs index 06ae0848b7c..c2658bef619 100644 --- a/src/test/ui/error-codes/E0504.rs +++ b/src/test/ui/error-codes/E0504.rs @@ -6,8 +6,8 @@ fn main() { let fancy_num = FancyNum { num: 5 }; let fancy_ref = &fancy_num; - let x = move || { - println!("child function: {}", fancy_num.num); //~ ERROR E0504 + let x = move || { //~ ERROR E0505 + println!("child function: {}", fancy_num.num); }; x(); diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr index a987713a11d..1f2a0407a39 100644 --- a/src/test/ui/error-codes/E0504.stderr +++ b/src/test/ui/error-codes/E0504.stderr @@ -1,12 +1,17 @@ -error[E0504]: cannot move `fancy_num` into closure because it is borrowed - --> $DIR/E0504.rs:10:40 +error[E0505]: cannot move out of `fancy_num` because it is borrowed + --> $DIR/E0504.rs:9:13 | LL | let fancy_ref = &fancy_num; - | --------- borrow of `fancy_num` occurs here -... + | ---------- borrow of `fancy_num` occurs here +LL | +LL | let x = move || { + | ^^^^^^^ move out of `fancy_num` occurs here LL | println!("child function: {}", fancy_num.num); - | ^^^^^^^^^ move into closure occurs here + | --------- move occurs due to use in closure +... +LL | println!("main function: {}", fancy_ref.num); + | ------------- borrow later used here error: aborting due to previous error -For more information about this error, try `rustc --explain E0504`. +For more information about this error, try `rustc --explain E0505`. diff --git a/src/test/ui/error-codes/E0505.nll.stderr b/src/test/ui/error-codes/E0505.nll.stderr deleted file mode 100644 index 4d9d1ef121c..00000000000 --- a/src/test/ui/error-codes/E0505.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/E0505.rs:9:13 - | -LL | let _ref_to_val: &Value = &x; - | -- borrow of `x` occurs here -LL | eat(x); - | ^ move out of `x` occurs here -LL | _ref_to_val.use_ref(); - | ----------- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0505`. diff --git a/src/test/ui/error-codes/E0505.stderr b/src/test/ui/error-codes/E0505.stderr index 28dfb25986f..4d9d1ef121c 100644 --- a/src/test/ui/error-codes/E0505.stderr +++ b/src/test/ui/error-codes/E0505.stderr @@ -2,9 +2,11 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/E0505.rs:9:13 | LL | let _ref_to_val: &Value = &x; - | - borrow of `x` occurs here + | -- borrow of `x` occurs here LL | eat(x); | ^ move out of `x` occurs here +LL | _ref_to_val.use_ref(); + | ----------- borrow later used here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr deleted file mode 100644 index e5c0cf6e24e..00000000000 --- a/src/test/ui/error-codes/E0509.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait - --> $DIR/E0509.rs:16:23 - | -LL | let fancy_field = drop_struct.fancy; - | ^^^^^^^^^^^^^^^^^ - | | - | cannot move out of here - | help: consider borrowing here: `&drop_struct.fancy` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0509`. diff --git a/src/test/ui/error-codes/E0509.stderr b/src/test/ui/error-codes/E0509.stderr index 25b6d8a47d2..e5c0cf6e24e 100644 --- a/src/test/ui/error-codes/E0509.stderr +++ b/src/test/ui/error-codes/E0509.stderr @@ -5,7 +5,7 @@ LL | let fancy_field = drop_struct.fancy; | ^^^^^^^^^^^^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&drop_struct.fancy` + | help: consider borrowing here: `&drop_struct.fancy` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0597.nll.stderr b/src/test/ui/error-codes/E0597.nll.stderr deleted file mode 100644 index b4a1180ad54..00000000000 --- a/src/test/ui/error-codes/E0597.nll.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0597]: `y` does not live long enough - --> $DIR/E0597.rs:8:16 - | -LL | x.x = Some(&y); - | ^^ borrowed value does not live long enough -LL | -LL | } - | - - | | - | `y` dropped here while still borrowed - | borrow might be used here, when `x` is dropped and runs the `Drop` code for type `Foo` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/error-codes/E0597.stderr b/src/test/ui/error-codes/E0597.stderr index cab97858531..b4a1180ad54 100644 --- a/src/test/ui/error-codes/E0597.stderr +++ b/src/test/ui/error-codes/E0597.stderr @@ -1,13 +1,16 @@ error[E0597]: `y` does not live long enough - --> $DIR/E0597.rs:8:17 + --> $DIR/E0597.rs:8:16 | LL | x.x = Some(&y); - | ^ borrowed value does not live long enough + | ^^ borrowed value does not live long enough LL | LL | } - | - `y` dropped here while still borrowed + | - + | | + | `y` dropped here while still borrowed + | borrow might be used here, when `x` is dropped and runs the `Drop` code for type `Foo` | - = note: values in a scope are dropped in the opposite order they are created + = note: values in a scope are dropped in the opposite order they are defined error: aborting due to previous error |
