Update errors to use new error format
This commit is contained in:
parent
104fe1c4db
commit
1b6afd1e42
28 changed files with 219 additions and 163 deletions
|
|
@ -27,7 +27,9 @@ fn main() {
|
|||
x; //~ value moved here
|
||||
|
||||
let y = Int(2);
|
||||
//~^use `mut y` here to make mutable
|
||||
y //~ error: cannot borrow immutable local variable `y` as mutable
|
||||
//~| cannot borrow
|
||||
+=
|
||||
Int(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ mod foo { pub struct bar; }
|
|||
|
||||
fn main() {
|
||||
let bar = 5;
|
||||
//~^ ERROR declaration of `bar` shadows an enum variant or unit-like struct in scope
|
||||
//~^ ERROR cannot be named the same
|
||||
use foo::bar;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
mod foo { pub mod foo { } } //~ NOTE previous definition of `foo` here
|
||||
|
||||
use foo::foo; //~ ERROR a module named `foo` has already been defined in this module
|
||||
use foo::foo;
|
||||
//~^ ERROR a module named `foo` has already been defined in this module
|
||||
//~| was already imported
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,9 @@ fn move_after_borrow() {
|
|||
let a: Box<_> = box B { x: box 0, y: box 1 };
|
||||
let _x = &a.x;
|
||||
//~^ NOTE borrow of `a.x` occurs here
|
||||
let _y = a.y; //~ ERROR cannot move
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
}
|
||||
|
||||
fn copy_after_mut_borrow() {
|
||||
|
|
@ -75,7 +77,9 @@ fn move_after_mut_borrow() {
|
|||
let mut a: Box<_> = box B { x: box 0, y: box 1 };
|
||||
let _x = &mut a.x;
|
||||
//~^ NOTE borrow of `a.x` occurs here
|
||||
let _y = a.y; //~ ERROR cannot move
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
}
|
||||
|
||||
fn borrow_after_mut_borrow() {
|
||||
|
|
@ -127,7 +131,9 @@ fn move_after_borrow_nested() {
|
|||
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
|
||||
let _x = &a.x.x;
|
||||
//~^ borrow of `a.x.x` occurs here
|
||||
let _y = a.y; //~ ERROR cannot move
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
}
|
||||
|
||||
fn copy_after_mut_borrow_nested() {
|
||||
|
|
@ -141,7 +147,9 @@ fn move_after_mut_borrow_nested() {
|
|||
let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
|
||||
let _x = &mut a.x.x;
|
||||
//~^ NOTE borrow of `a.x.x` occurs here
|
||||
let _y = a.y; //~ ERROR cannot move
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
}
|
||||
|
||||
fn borrow_after_mut_borrow_nested() {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ fn f() {
|
|||
|
||||
v3.push(&'x'); // statement 6
|
||||
//~^ ERROR borrowed value does not live long enough
|
||||
//~| does not live long enough
|
||||
//~| NOTE ...but borrowed value is only valid for the statement
|
||||
//~| HELP consider using a `let` binding to increase its lifetime
|
||||
|
||||
|
|
@ -36,6 +37,7 @@ fn f() {
|
|||
|
||||
v4.push(&'y');
|
||||
//~^ ERROR borrowed value does not live long enough
|
||||
//~| does not live long enough
|
||||
//~| NOTE ...but borrowed value is only valid for the statement
|
||||
//~| HELP consider using a `let` binding to increase its lifetime
|
||||
|
||||
|
|
@ -46,6 +48,7 @@ fn f() {
|
|||
|
||||
v5.push(&'z');
|
||||
//~^ ERROR borrowed value does not live long enough
|
||||
//~| does not live long enough
|
||||
//~| NOTE ...but borrowed value is only valid for the statement
|
||||
//~| HELP consider using a `let` binding to increase its lifetime
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn f() {
|
||||
let x = [1].iter(); //~ ERROR borrowed value does not live long enough
|
||||
//~^ NOTE reference must be valid for the block suffix following statement
|
||||
//~^^ HELP consider using a `let` binding to increase its lifetime
|
||||
//~^^^ NOTE ...but borrowed value is only valid for the statement at 12:4
|
||||
let x = [1].iter();
|
||||
//~^ ERROR borrowed value does not live long enough
|
||||
//~|does not live long enough
|
||||
//~| NOTE reference must be valid for the block suffix following statement
|
||||
//~| HELP consider using a `let` binding to increase its lifetime
|
||||
//~| NOTE ...but borrowed value is only valid for the statement at 12:4
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ enum Foo {
|
|||
fn blah() {
|
||||
let f = &Foo::Foo1(box 1, box 2);
|
||||
match *f { //~ ERROR cannot move out of
|
||||
//~| move occurs here
|
||||
Foo::Foo1(num1, //~ NOTE attempting to move value to here
|
||||
num2) => (), //~ NOTE and here
|
||||
Foo::Foo2(num) => (), //~ NOTE and here
|
||||
|
|
@ -37,6 +38,7 @@ impl Drop for S {
|
|||
fn move_in_match() {
|
||||
match (S {f: "foo".to_string(), g: "bar".to_string()}) {
|
||||
S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait
|
||||
//~| can not move out of here
|
||||
f: _s, //~ NOTE attempting to move value to here
|
||||
g: _t //~ NOTE and here
|
||||
} => {}
|
||||
|
|
@ -53,6 +55,7 @@ fn free<T>(_: T) {}
|
|||
fn blah2() {
|
||||
let a = &A { a: box 1 };
|
||||
match a.a { //~ ERROR cannot move out of
|
||||
//~| move occurs here
|
||||
n => { //~ NOTE attempting to move value to here
|
||||
free(n)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,12 @@ pub fn main() {
|
|||
match x {
|
||||
[_, tail..] => {
|
||||
match tail {
|
||||
[Foo { string: a }, //~ ERROR cannot move out of borrowed content
|
||||
[Foo { string: a },
|
||||
//~^ ERROR cannot move out of borrowed content
|
||||
//~| move occurs here
|
||||
//~| attempting to move value to here
|
||||
Foo { string: b }] => {
|
||||
//~^^ NOTE attempting to move value to here
|
||||
//~^^ NOTE and here
|
||||
//~^ NOTE and here
|
||||
}
|
||||
_ => {
|
||||
unreachable!();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ fn a() {
|
|||
[box ref _a, _, _] => {
|
||||
//~^ borrow of `vec[..]` occurs here
|
||||
vec[0] = box 4; //~ ERROR cannot assign
|
||||
//~^ assignment to `vec[..]` occurs here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +31,7 @@ fn b() {
|
|||
[_b..] => {
|
||||
//~^ borrow of `vec[..]` occurs here
|
||||
vec[0] = box 4; //~ ERROR cannot assign
|
||||
//~^ assignment to `vec[..]` occurs here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -39,8 +41,9 @@ fn c() {
|
|||
let vec: &mut [Box<isize>] = &mut vec;
|
||||
match vec {
|
||||
[_a, //~ ERROR cannot move out
|
||||
_b..] => { //~^ NOTE attempting to move value to here
|
||||
|
||||
//~| move occurs here
|
||||
//~| attempting to move value to here
|
||||
_b..] => {
|
||||
// Note: `_a` is *moved* here, but `b` is borrowing,
|
||||
// hence illegal.
|
||||
//
|
||||
|
|
@ -51,6 +54,7 @@ fn c() {
|
|||
}
|
||||
let a = vec[0]; //~ ERROR cannot move out
|
||||
//~^ NOTE attempting to move value to here
|
||||
//~| can not move out of here
|
||||
}
|
||||
|
||||
fn d() {
|
||||
|
|
@ -58,11 +62,13 @@ fn d() {
|
|||
let vec: &mut [Box<isize>] = &mut vec;
|
||||
match vec {
|
||||
[_a.., //~ ERROR cannot move out
|
||||
//~^ move occurs here
|
||||
_b] => {} //~ NOTE attempting to move value to here
|
||||
_ => {}
|
||||
}
|
||||
let a = vec[0]; //~ ERROR cannot move out
|
||||
//~^ NOTE attempting to move value to here
|
||||
//~| can not move out of here
|
||||
}
|
||||
|
||||
fn e() {
|
||||
|
|
@ -70,13 +76,15 @@ fn e() {
|
|||
let vec: &mut [Box<isize>] = &mut vec;
|
||||
match vec {
|
||||
[_a, _b, _c] => {} //~ ERROR cannot move out
|
||||
//~^ NOTE attempting to move value to here
|
||||
//~^^ NOTE and here
|
||||
//~^^^ NOTE and here
|
||||
//~| move occurs here
|
||||
//~| NOTE attempting to move value to here
|
||||
//~| NOTE and here
|
||||
//~| NOTE and here
|
||||
_ => {}
|
||||
}
|
||||
let a = vec[0]; //~ ERROR cannot move out
|
||||
//~^ NOTE attempting to move value to here
|
||||
//~| can not move out of here
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ mod foo {
|
|||
pub const d: u8 = 2;
|
||||
}
|
||||
|
||||
use foo::b as c; //~ NOTE constant imported here
|
||||
use foo::d; //~ NOTE constant imported here
|
||||
use foo::b as c; //~ NOTE is imported here
|
||||
use foo::d; //~ NOTE is imported here
|
||||
|
||||
const a: u8 = 2; //~ NOTE constant defined here
|
||||
const a: u8 = 2; //~ NOTE is defined here
|
||||
|
||||
fn main() {
|
||||
let a = 4; //~ ERROR variable bindings cannot
|
||||
//~^ NOTE there already is a constant in scope
|
||||
let c = 4; //~ ERROR variable bindings cannot
|
||||
//~^ NOTE there already is a constant in scope
|
||||
let d = 4; //~ ERROR variable bindings cannot
|
||||
//~^ NOTE there already is a constant in scope
|
||||
let a = 4; //~ ERROR let variables cannot
|
||||
//~^ NOTE cannot be named the same as a const variable
|
||||
let c = 4; //~ ERROR let variables cannot
|
||||
//~^ NOTE cannot be named the same as a const variable
|
||||
let d = 4; //~ ERROR let variables cannot
|
||||
//~^ NOTE cannot be named the same as a const variable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
struct hello(isize);
|
||||
|
||||
fn main() {
|
||||
let hello = 0; //~ERROR declaration of `hello` shadows
|
||||
let hello = 0; //~ERROR cannot be named the same
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,13 @@
|
|||
use self::A; //~ NOTE previous import of `A` here
|
||||
use self::B; //~ NOTE previous import of `B` here
|
||||
mod A {} //~ ERROR a module named `A` has already been imported in this module
|
||||
//~| `A` was already imported
|
||||
pub mod B {} //~ ERROR a module named `B` has already been imported in this module
|
||||
|
||||
//~| `B` was already imported
|
||||
mod C {
|
||||
use C::D; //~ NOTE previous import of `D` here
|
||||
mod D {} //~ ERROR a module named `D` has already been imported in this module
|
||||
//~| `D` was already imported
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ static foo: i32 = 0;
|
|||
|
||||
fn bar(foo: i32) {}
|
||||
//~^ ERROR static variables cannot be referenced in a pattern, use a `const` instead
|
||||
//~| static variable used in pattern
|
||||
|
||||
mod submod {
|
||||
pub static answer: i32 = 42;
|
||||
|
|
@ -23,6 +24,6 @@ use self::submod::answer;
|
|||
|
||||
fn question(answer: i32) {}
|
||||
//~^ ERROR static variables cannot be referenced in a pattern, use a `const` instead
|
||||
|
||||
//~| static variable used in pattern
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,14 @@ use std::ops::Div; //~ NOTE previous import
|
|||
use std::ops::Rem; //~ NOTE previous import
|
||||
|
||||
type Add = bool; //~ ERROR a trait named `Add` has already been imported in this module
|
||||
//~| was already imported
|
||||
struct Sub { x: f32 } //~ ERROR a trait named `Sub` has already been imported in this module
|
||||
//~| was already imported
|
||||
enum Mul { A, B } //~ ERROR a trait named `Mul` has already been imported in this module
|
||||
//~| was already imported
|
||||
mod Div { } //~ ERROR a trait named `Div` has already been imported in this module
|
||||
//~| was already imported
|
||||
trait Rem { } //~ ERROR a trait named `Rem` has already been imported in this module
|
||||
//~| was already imported
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
fn main() {
|
||||
match Some(1) {
|
||||
None @ _ => {} //~ ERROR declaration of `None` shadows an enum variant
|
||||
None @ _ => {} //~ ERROR cannot be named the same
|
||||
};
|
||||
const C: u8 = 1;
|
||||
match 1 {
|
||||
C @ 2 => { //~ ERROR variable bindings cannot shadow constants
|
||||
C @ 2 => { //~ ERROR cannot be named the same
|
||||
println!("{}", C);
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
// aux-build:issue_3907.rs
|
||||
extern crate issue_3907;
|
||||
|
||||
type Foo = issue_3907::Foo; //~ NOTE: type defined here
|
||||
type Foo = issue_3907::Foo; //~ NOTE: type aliases cannot be used for traits
|
||||
|
||||
struct S {
|
||||
name: isize
|
||||
}
|
||||
|
||||
impl Foo for S { //~ ERROR: `Foo` is not a trait
|
||||
//~^ NOTE: `type` aliases cannot be used for traits
|
||||
//~| `Foo` is not a trait
|
||||
fn bar() { }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait I {}
|
||||
type K = I; //~ NOTE: type defined here
|
||||
type K = I;
|
||||
//~^ NOTE: aliases cannot be used for traits
|
||||
impl K for isize {} //~ ERROR: `K` is not a trait
|
||||
//~^ NOTE: `type` aliases cannot be used for traits
|
||||
//~| is not a trait
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ fn main() {
|
|||
loop {
|
||||
f(&s, |hellothere| {
|
||||
match hellothere.x { //~ ERROR cannot move out
|
||||
//~| move occurs here
|
||||
box E::Foo(_) => {}
|
||||
box E::Bar(x) => println!("{}", x.to_string()), //~ NOTE attempting to move value to here
|
||||
box E::Baz => {}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,16 @@ impl S {
|
|||
}
|
||||
|
||||
fn func(arg: S) {
|
||||
//~^ HELP use `mut` as shown
|
||||
//~| SUGGESTION fn func(mut arg: S) {
|
||||
arg.mutate(); //~ ERROR cannot borrow immutable argument
|
||||
//~^ here to make mutable
|
||||
arg.mutate();
|
||||
//~^ ERROR cannot borrow immutable argument
|
||||
//~| cannot borrow mutably
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let local = S;
|
||||
//~^ HELP use `mut` as shown
|
||||
//~| SUGGESTION let mut local = S;
|
||||
local.mutate(); //~ ERROR cannot borrow immutable local variable
|
||||
//~^ here to make mutable
|
||||
local.mutate();
|
||||
//~^ ERROR cannot borrow immutable local variable
|
||||
//~| cannot borrow mutably
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:declaration of `None` shadows
|
||||
// error-pattern:cannot be named the same
|
||||
use std::option::*;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
struct foo(usize);
|
||||
|
||||
fn main() {
|
||||
let (foo, _) = (2, 3); //~ ERROR declaration of `foo` shadows
|
||||
let (foo, _) = (2, 3); //~ ERROR `foo` cannot be named the same as
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ use std::mem::transmute;
|
|||
|
||||
fn transmute() {}
|
||||
//~^ ERROR a value named `transmute` has already been imported in this module
|
||||
|
||||
//~| was already imported
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue