Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 4, 2018
1 parent 2664aad commit 61efc3b
Show file tree
Hide file tree
Showing 154 changed files with 387 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ trait I32Iterator = Iterator<Item = i32>;

fn main() {
let _: &I32Iterator<Item = u32> = &vec![42].into_iter();
//~^ ERROR type mismatch
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#![feature(trait_alias)]

trait Foo: Iterator<Item = i32> {}
trait Bar: Foo<Item = u32> {}
trait Bar: Foo<Item = u32> {} //~ ERROR type annotations required

trait I32Iterator = Iterator<Item = i32>;
trait U32Iterator = I32Iterator<Item = u32>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0284]: type annotations required: cannot resolve `<Self as std::iter::Iterator>::Item == i32`
--> $DIR/associated-types-overridden-binding.rs:14:1
|
LL | trait Bar: Foo<Item = u32> {}
LL | trait Bar: Foo<Item = u32> {} //~ ERROR type annotations required
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: required by `Foo`
Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/await-keyword/2015-edition-warning.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@

mod outer_mod {
pub mod r#await {
//~^ ERROR `await` is a keyword
//~| WARN was previously accepted
pub struct r#await;
//~^ ERROR `await` is a keyword
//~| WARN was previously accepted
}
}
use outer_mod::r#await::r#await;
//~^ ERROR `await` is a keyword
//~| ERROR `await` is a keyword
//~| WARN was previously accepted
//~| WARN was previously accepted

fn main() {
match r#await { r#await => {} }
//~^ ERROR `await` is a keyword
//~| ERROR `await` is a keyword
//~| WARN was previously accepted
//~| WARN was previously accepted
}
12 changes: 12 additions & 0 deletions src/test/ui/await-keyword/2015-edition-warning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@

mod outer_mod {
pub mod await {
//~^ ERROR `await` is a keyword
//~| WARN was previously accepted
pub struct await;
//~^ ERROR `await` is a keyword
//~| WARN was previously accepted
}
}
use outer_mod::await::await;
//~^ ERROR `await` is a keyword
//~| ERROR `await` is a keyword
//~| WARN was previously accepted
//~| WARN was previously accepted

fn main() {
match await { await => {} }
//~^ ERROR `await` is a keyword
//~| ERROR `await` is a keyword
//~| WARN was previously accepted
//~| WARN was previously accepted
}
10 changes: 5 additions & 5 deletions src/test/ui/await-keyword/2015-edition-warning.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LL | #![deny(keyword_idents)]
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-warning.rs:8:20
--> $DIR/2015-edition-warning.rs:10:20
|
LL | pub struct await;
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
Expand All @@ -22,7 +22,7 @@ LL | pub struct await;
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-warning.rs:11:16
--> $DIR/2015-edition-warning.rs:15:16
|
LL | use outer_mod::await::await;
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
Expand All @@ -31,7 +31,7 @@ LL | use outer_mod::await::await;
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-warning.rs:11:23
--> $DIR/2015-edition-warning.rs:15:23
|
LL | use outer_mod::await::await;
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
Expand All @@ -40,7 +40,7 @@ LL | use outer_mod::await::await;
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-warning.rs:14:11
--> $DIR/2015-edition-warning.rs:22:11
|
LL | match await { await => {} }
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
Expand All @@ -49,7 +49,7 @@ LL | match await { await => {} }
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-warning.rs:14:19
--> $DIR/2015-edition-warning.rs:22:19
|
LL | match await { await => {} }
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
Expand Down
10 changes: 6 additions & 4 deletions src/test/ui/await-keyword/2018-edition-error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
#![allow(non_camel_case_types)]

mod outer_mod {
pub mod await {
pub struct await;
pub mod await { //~ ERROR `await` is a keyword
pub struct await; //~ ERROR `await` is a keyword
}
}
use self::outer_mod::await::await;
use self::outer_mod::await::await; //~ ERROR `await` is a keyword
//~^ ERROR `await` is a keyword

fn main() {
match await { await => () }
match await { await => () } //~ ERROR `await` is a keyword
//~^ ERROR `await` is a keyword
}
16 changes: 8 additions & 8 deletions src/test/ui/await-keyword/2018-edition-error.stderr
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
error[E0721]: `await` is a keyword in the 2018 edition
--> $DIR/2018-edition-error.rs:5:13
|
LL | pub mod await {
LL | pub mod await { //~ ERROR `await` is a keyword
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error[E0721]: `await` is a keyword in the 2018 edition
--> $DIR/2018-edition-error.rs:6:20
|
LL | pub struct await;
LL | pub struct await; //~ ERROR `await` is a keyword
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error[E0721]: `await` is a keyword in the 2018 edition
--> $DIR/2018-edition-error.rs:9:22
|
LL | use self::outer_mod::await::await;
LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error[E0721]: `await` is a keyword in the 2018 edition
--> $DIR/2018-edition-error.rs:9:29
|
LL | use self::outer_mod::await::await;
LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error[E0721]: `await` is a keyword in the 2018 edition
--> $DIR/2018-edition-error.rs:12:11
--> $DIR/2018-edition-error.rs:13:11
|
LL | match await { await => () }
LL | match await { await => () } //~ ERROR `await` is a keyword
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error[E0721]: `await` is a keyword in the 2018 edition
--> $DIR/2018-edition-error.rs:12:19
--> $DIR/2018-edition-error.rs:13:19
|
LL | match await { await => () }
LL | match await { await => () } //~ ERROR `await` is a keyword
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error: aborting due to 6 previous errors
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/await-keyword/post_expansion_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ macro_rules! r#await {

fn main() {
await!()
//~^ ERROR `await` is a keyword
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `t.0`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:25:31
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:31
|
LL | drop(t);
| - value moved here
Expand All @@ -10,7 +10,7 @@ LL | println!("{:?} {:?}", t.0, t.1);
= note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `t.1`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:25:36
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:36
|
LL | drop(t);
| - value moved here
Expand All @@ -21,7 +21,7 @@ LL | println!("{:?} {:?}", t.0, t.1);
= note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `u.0`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:33:31
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:31
|
LL | drop(u);
| - value moved here
Expand All @@ -32,7 +32,7 @@ LL | println!("{:?} {:?}", u.0, u.1);
= note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `u.1`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:33:36
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:36
|
LL | drop(u);
| - value moved here
Expand All @@ -43,7 +43,7 @@ LL | println!("{:?} {:?}", u.0, u.1);
= note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `v.x`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:41:31
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:31
|
LL | drop(v);
| - value moved here
Expand All @@ -54,7 +54,7 @@ LL | println!("{:?} {:?}", v.x, v.y);
= note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `v.y`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:41:36
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:36
|
LL | drop(v);
| - value moved here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | t.0 = S(1);
= note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait

error[E0382]: assign to part of moved value: `u`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:31:9
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:34:9
|
LL | drop(u);
| - value moved here
Expand All @@ -19,7 +19,7 @@ LL | u.0 = S(1);
= note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait

error[E0382]: assign to part of moved value: `v`
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:39:9
--> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:45:9
|
LL | drop(v);
| - value moved here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,32 @@ fn main() {
let mut t: Tuple = (S(0), 0);
drop(t);
t.0 = S(1);
//[nll]~^ ERROR assign to part of moved value
t.1 = 2;
println!("{:?} {:?}", t.0, t.1);
//[ast]~^ ERROR use of moved value
//[ast]~^^ ERROR use of moved value
}

{
let mut u: Tpair = Tpair(S(0), 0);
drop(u);
u.0 = S(1);
//[nll]~^ ERROR assign to part of moved value
u.1 = 2;
println!("{:?} {:?}", u.0, u.1);
//[ast]~^ ERROR use of moved value
//[ast]~^^ ERROR use of moved value
}

{
let mut v: Spair = Spair { x: S(0), y: 0 };
drop(v);
v.x = S(1);
//[nll]~^ ERROR assign to part of moved value
v.y = 2;
println!("{:?} {:?}", v.x, v.y);
//[ast]~^ ERROR use of moved value
//[ast]~^^ ERROR use of moved value
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl Value {
fn foo(val: Value) {
let _reviewers_original: Vec<Value> = match val.as_array() {
Some(array) => {
*array
*array //~ ERROR cannot move out of borrowed content
}
None => vec![]
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0507]: cannot move out of borrowed content
--> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13
|
LL | *array
LL | *array //~ ERROR cannot move out of borrowed content
| ^^^^^^
| |
| cannot move out of borrowed content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | x
|

error[E0595]: closure cannot assign to immutable argument `x`
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:29:22
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:32:22
|
LL | let mut c1 = |z: &'static mut isize| {
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
Expand All @@ -19,31 +19,31 @@ LL | x
|

error[E0595]: closure cannot assign to immutable argument `x`
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:9
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9
|
LL | pub fn capture_assign_whole(x: (i32,)) {
| - help: make this binding mutable: `mut x`
LL | || { x = (1,); };
| ^^ cannot borrow mutably

error[E0595]: closure cannot assign to immutable argument `x`
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:9
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:9
|
LL | pub fn capture_assign_part(x: (i32,)) {
| - help: make this binding mutable: `mut x`
LL | || { x.0 = 1; };
| ^^ cannot borrow mutably

error[E0595]: closure cannot assign to immutable argument `x`
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:9
|
LL | pub fn capture_reborrow_whole(x: (i32,)) {
| - help: make this binding mutable: `mut x`
LL | || { &mut x; };
| ^^ cannot borrow mutably

error[E0595]: closure cannot assign to immutable argument `x`
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:9
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:9
|
LL | pub fn capture_reborrow_part(x: (i32,)) {
| - help: make this binding mutable: `mut x`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y;
| ^^^^^ cannot assign

error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:50
|
LL | pub fn ee(x: &'static mut isize) {
| - help: consider changing this to be mutable: `mut x`
Expand All @@ -17,31 +17,31 @@ LL | let mut c2 = |y: &'static mut isize| x = y;
| ^^^^^ cannot assign

error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14
|
LL | pub fn capture_assign_whole(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
LL | || { x = (1,); };
| ^^^^^^^^ cannot assign

error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14
|
LL | pub fn capture_assign_part(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
LL | || { x.0 = 1; };
| ^^^^^^^ cannot assign

error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:14
|
LL | pub fn capture_reborrow_whole(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
LL | || { &mut x; };
| ^^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:14
|
LL | pub fn capture_reborrow_part(x: (i32,)) {
| - help: consider changing this to be mutable: `mut x`
Expand Down
Loading

0 comments on commit 61efc3b

Please sign in to comment.