Update the "English-language" to-string function of a cmt to use

more modern terminology and update tests accordingly.
This commit is contained in:
Niko Matsakis 2015-01-08 09:12:06 -05:00
parent 0a32010e43
commit 2387651f7d
24 changed files with 124 additions and 87 deletions

View file

@ -37,9 +37,9 @@ fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
let m = &mut x;
let n = &y;
*m //~ ERROR: cannot move out of dereference of `&mut`-pointer
*m //~ ERROR: cannot move out of borrowed content
+
*n; //~ ERROR: cannot move out of dereference of `&`-pointer
*n; //~ ERROR: cannot move out of borrowed content
}
struct Foo;

View file

@ -20,5 +20,5 @@ impl A {
pub fn main() {
let a = box A;
a.foo();
//~^ ERROR cannot borrow immutable dereference of `Box` `*a` as mutable
//~^ ERROR cannot borrow immutable `Box` content `*a` as mutable
}

View file

@ -33,7 +33,7 @@ fn test1() {
}
fn test2<F>(f: &F) where F: FnMut() {
(*f)(); //~ ERROR: cannot borrow immutable dereference of `&`-pointer `*f` as mutable
(*f)(); //~ ERROR: cannot borrow immutable borrowed content `*f` as mutable
}
fn test3<F>(f: &mut F) where F: FnMut() {
@ -41,7 +41,7 @@ fn test3<F>(f: &mut F) where F: FnMut() {
}
fn test4(f: &Test) {
f.f.call_mut(()) //~ ERROR: cannot borrow immutable dereference of `Box` `*f.f` as mutable
f.f.call_mut(()) //~ ERROR: cannot borrow immutable `Box` content `*f.f` as mutable
}
fn test5(f: &mut Test) {

View file

@ -11,16 +11,16 @@
fn with<F>(f: F) where F: FnOnce(&String) {}
fn arg_item(&_x: &String) {}
//~^ ERROR cannot move out of dereference of `&`-pointer
//~^ ERROR cannot move out of borrowed content
fn arg_closure() {
with(|&_x| ())
//~^ ERROR cannot move out of dereference of `&`-pointer
//~^ ERROR cannot move out of borrowed content
}
fn let_pat() {
let &_x = &"hi".to_string();
//~^ ERROR cannot move out of dereference of `&`-pointer
//~^ ERROR cannot move out of borrowed content
}
pub fn main() {}

View file

@ -12,5 +12,5 @@ use std::rc::Rc;
pub fn main() {
let _x = Rc::new(vec!(1i, 2)).into_iter();
//~^ ERROR cannot move out of dereference of `&`-pointer
//~^ ERROR cannot move out of borrowed content
}

View file

@ -12,5 +12,5 @@ use std::rc::Rc;
pub fn main() {
let _x = *Rc::new("hi".to_string());
//~^ ERROR cannot move out of dereference of `&`-pointer
//~^ ERROR cannot move out of borrowed content
}

View file

@ -25,7 +25,7 @@ pub fn main() {
match x {
[_, tail..] => {
match tail {
[Foo { string: a }, //~ ERROR cannot move out of dereference of `&`-pointer
[Foo { string: a }, //~ ERROR cannot move out of borrowed content
Foo { string: b }] => {
//~^^ NOTE attempting to move value to here
//~^^ NOTE and here

View file

@ -28,5 +28,5 @@ fn main() {
let v = MyVec { data: vec!(box 1i, box 2, box 3) };
let good = &v[0]; // Shouldn't fail here
let bad = v[0];
//~^ ERROR cannot move out of dereference (dereference is implicit, due to indexing)
//~^ ERROR cannot move out of indexed content
}

View file

@ -66,5 +66,5 @@ fn main() {
x: 1,
};
s[2] = 20;
//~^ ERROR cannot assign to immutable dereference (dereference is implicit, due to indexing)
//~^ ERROR cannot assign to immutable indexed content
}

View file

@ -41,9 +41,9 @@ impl Index<uint> for T {
fn main() {
S[0];
//~^ ERROR cannot move out of dereference
//~^ ERROR cannot move out of indexed content
//~^^ ERROR E0161
T[0];
//~^ ERROR cannot move out of dereference
//~^ ERROR cannot move out of indexed content
//~^^ ERROR E0161
}

View file

@ -15,10 +15,10 @@
pub fn main() {
let _x: Box<str> = box *"hello world";
//~^ ERROR E0161
//~^^ ERROR cannot move out of dereference
//~^^ ERROR cannot move out of borrowed content
let array: &[int] = &[1, 2, 3];
let _x: Box<[int]> = box *array;
//~^ ERROR E0161
//~^^ ERROR cannot move out of dereference
//~^^ ERROR cannot move out of borrowed content
}

View file

@ -12,11 +12,11 @@ fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
match (l1, l2) {
([], []) => println!("both empty"),
([], [hd, tl..]) | ([hd, tl..], []) => println!("one empty"),
//~^ ERROR: cannot move out of dereference
//~^^ ERROR: cannot move out of dereference
//~^ ERROR: cannot move out of borrowed content
//~^^ ERROR: cannot move out of borrowed content
([hd1, tl1..], [hd2, tl2..]) => println!("both nonempty"),
//~^ ERROR: cannot move out of dereference
//~^^ ERROR: cannot move out of dereference
//~^ ERROR: cannot move out of borrowed content
//~^^ ERROR: cannot move out of borrowed content
}
}

View file

@ -15,6 +15,6 @@
fn main() {
(|&:| box *[0us].as_slice())();
//~^ ERROR cannot move out of dereference
//~^ ERROR cannot move out of borrowed content
//~^^ ERROR cannot move a value of type [usize]
}

View file

@ -19,7 +19,7 @@ trait parse {
impl parse for parser {
fn parse(&self) -> Vec<int> {
self.tokens //~ ERROR cannot move out of dereference of `&`-pointer
self.tokens //~ ERROR cannot move out of borrowed content
}
}

View file

@ -23,5 +23,5 @@ fn main() {
Foo::bar(&x); //~ERROR cannot borrow `x`
let x = Foo;
Foo::baz(&x); //~ERROR cannot borrow immutable dereference of `&`-pointer as mutable
Foo::baz(&x); //~ERROR cannot borrow immutable borrowed content as mutable
}

View file

@ -14,5 +14,5 @@ fn main() {
let x: &[int] = &[1, 2, 3, 4, 5];
// Can't mutably slice an immutable slice
let slice: &mut [int] = &mut [0, 1];
let _ = &mut x[2..4]; //~ERROR cannot borrow immutable dereference of `&`-pointer `*x` as mutabl
let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable
}

View file

@ -13,5 +13,5 @@
fn main() {
let x: &[int] = &[1, 2, 3, 4, 5];
// Immutable slices are not mutable.
let y: &mut[_] = &x[2..4]; //~ ERROR cannot borrow immutable dereference of `&`-pointer as mutab
let y: &mut[_] = &x[2..4]; //~ ERROR cannot borrow immutable borrowed content as mutable
}

View file

@ -16,11 +16,11 @@ use std::ptr;
fn main() {
let x = ATOMIC_BOOL_INIT;
let x = *&x; //~ ERROR: cannot move out of dereference
let x = *&x; //~ ERROR: cannot move out of borrowed content
let x = ATOMIC_INT_INIT;
let x = *&x; //~ ERROR: cannot move out of dereference
let x = *&x; //~ ERROR: cannot move out of borrowed content
let x = ATOMIC_UINT_INIT;
let x = *&x; //~ ERROR: cannot move out of dereference
let x = *&x; //~ ERROR: cannot move out of borrowed content
let x: AtomicPtr<uint> = AtomicPtr::new(ptr::null_mut());
let x = *&x; //~ ERROR: cannot move out of dereference
let x = *&x; //~ ERROR: cannot move out of borrowed content
}

View file

@ -31,9 +31,9 @@ fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
let m = &mut x;
let n = &y;
!*m; //~ ERROR: cannot move out of dereference of `&mut`-pointer
!*m; //~ ERROR: cannot move out of borrowed content
!*n; //~ ERROR: cannot move out of dereference of `&`-pointer
!*n; //~ ERROR: cannot move out of borrowed content
}
fn main() {}