Update tests

This commit is contained in:
Oliver Scherer 2018-11-27 10:56:36 +01:00
parent 2664aadaa2
commit 61efc3b71b
154 changed files with 391 additions and 256 deletions

View file

@ -14,4 +14,5 @@ trait I32Iterator = Iterator<Item = i32>;
fn main() {
let _: &I32Iterator<Item = u32> = &vec![42].into_iter();
//~^ ERROR type mismatch
}

View file

@ -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>;

View file

@ -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`

View file

@ -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
}

View file

@ -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
}

View file

@ -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`
@ -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`
@ -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`
@ -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`
@ -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`

View file

@ -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
}

View file

@ -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

View file

@ -6,4 +6,5 @@ macro_rules! r#await {
fn main() {
await!()
//~^ ERROR `await` is a keyword
}

View file

@ -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
@ -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
@ -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
@ -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
@ -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
@ -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

View file

@ -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
@ -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

View file

@ -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
}
}

View file

@ -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![]
};

View file

@ -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

View file

@ -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
@ -19,7 +19,7 @@ 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`
@ -27,7 +27,7 @@ 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`
@ -35,7 +35,7 @@ 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`
@ -43,7 +43,7 @@ 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`

View file

@ -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`
@ -17,7 +17,7 @@ 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`
@ -25,7 +25,7 @@ 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`
@ -33,7 +33,7 @@ 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`
@ -41,7 +41,7 @@ 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`

View file

@ -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`
@ -17,7 +17,7 @@ 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`
@ -25,7 +25,7 @@ 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`
@ -33,7 +33,7 @@ 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`
@ -41,7 +41,7 @@ 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`

View file

@ -19,6 +19,9 @@ mod borrowck_closures_unique {
pub fn e(x: &'static mut isize) {
static mut Y: isize = 3;
let mut c1 = |y: &'static mut isize| x = y;
//[migrate]~^ ERROR is not declared as mutable
//[nll]~^^ ERROR is not declared as mutable
//[ast]~^^^ closure cannot assign to immutable
unsafe { c1(&mut Y); }
}
}
@ -27,7 +30,10 @@ mod borrowck_closures_unique_grandparent {
pub fn ee(x: &'static mut isize) {
static mut Z: isize = 3;
let mut c1 = |z: &'static mut isize| {
//[ast]~^ closure cannot assign to immutable
let mut c2 = |y: &'static mut isize| x = y;
//[migrate]~^ ERROR is not declared as mutable
//[nll]~^^ ERROR is not declared as mutable
c2(z);
};
unsafe { c1(&mut Z); }
@ -38,15 +44,27 @@ mod borrowck_closures_unique_grandparent {
mod mutability_errors {
pub fn capture_assign_whole(x: (i32,)) {
|| { x = (1,); };
//[ast]~^ ERROR immutable argument
//[migrate]~^^ ERROR is not declared as mutable
//[nll]~^^^ ERROR is not declared as mutable
}
pub fn capture_assign_part(x: (i32,)) {
|| { x.0 = 1; };
//[ast]~^ ERROR immutable argument
//[migrate]~^^ ERROR is not declared as mutable
//[nll]~^^^ ERROR is not declared as mutable
}
pub fn capture_reborrow_whole(x: (i32,)) {
|| { &mut x; };
//[ast]~^ ERROR immutable argument
//[migrate]~^^ ERROR is not declared as mutable
//[nll]~^^^ ERROR is not declared as mutable
}
pub fn capture_reborrow_part(x: (i32,)) {
|| { &mut x.0; };
//[ast]~^ ERROR immutable argument
//[migrate]~^^ ERROR is not declared as mutable
//[nll]~^^^ ERROR is not declared as mutable
}
}

View file

@ -29,6 +29,7 @@ fn main() {
// This will compile, but then hard-abort at runtime.
// FIXME(oli-obk): this should instead panic (not hard-abort) at runtime.
let x: &'static u8 = &(bar() + 1);
//~^ ERROR does not live long enough
let y = *x;
unreachable!();
}

View file

@ -13,9 +13,9 @@
use std::intrinsics;
const SHR: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) };
//^~ ERROR: Overflowing shift by 8 in unchecked_shr
//~^ ERROR any use of this value will cause an error
const SHL: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) };
//^~ ERROR: Overflowing shift by 8 in unchecked_shl
//~^ ERROR any use of this value will cause an error
fn main() {
}

View file

@ -17,3 +17,4 @@ extern crate example_runner;
#[test]
fn wrong_kind(){}
//~^ ERROR trait bound `test::TestDescAndFn: example_runner::Testable` is not satisfied

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:9
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:5
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^^^^^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:9
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:5
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^^^^^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:9
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:5
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^^^^^
error: aborting due to previous error

View file

@ -29,7 +29,15 @@
#![feature(box_syntax)]
fn foo(x: Box<[i32]>) {
box *x; //~ ERROR E0161
box *x;
//[ast]~^ ERROR E0161
//[nll]~^^ ERROR E0161
//[zflags]~^^^ ERROR E0161
//[edition]~^^^^ ERROR E0161
//[astul]~^^^^^ ERROR E0161
//[nllul]~^^^^^^ ERROR E0161
//[zflagsul]~^^^^^^^ ERROR E0161
//[editionul]~^^^^^^^^ ERROR E0161
}
fn main() {}

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:9
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
--> $DIR/E0161.rs:32:5
|
LL | box *x; //~ ERROR E0161
LL | box *x;
| ^^^^^^
error: aborting due to previous error

View file

@ -11,7 +11,7 @@
#![feature(lang_items)]
// Arc is expected to be a struct, so this will error.
#[lang = "arc"]
#[lang = "arc"] //~ ERROR language item must be applied to a struct
static X: u32 = 42;
fn main() {}

View file

@ -1,7 +1,7 @@
error[E0718]: `arc` language item must be applied to a struct
--> $DIR/E0718.rs:14:1
|
LL | #[lang = "arc"]
LL | #[lang = "arc"] //~ ERROR language item must be applied to a struct
| ^^^^^^^^^^^^^^^ attribute should be applied to a struct, not a static item
error: aborting due to previous error

View file

@ -9,10 +9,12 @@
// except according to those terms.
trait Foo: Iterator<Item = i32, Item = i32> {}
//~^ ERROR is already specified
type Unit = ();
fn test() -> Box<Iterator<Item = (), Item = Unit>> {
//~^ ERROR is already specified
Box::new(None.into_iter())
}

View file

@ -7,7 +7,7 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/E0719.rs:15:38
--> $DIR/E0719.rs:16:38
|
LL | fn test() -> Box<Iterator<Item = (), Item = Unit>> {
| --------- ^^^^^^^^^^^ re-bound here

View file

@ -9,9 +9,13 @@
// except according to those terms.
const FOO: impl Copy = 42;
//~^ ERROR `impl Trait` not allowed
static BAR: impl Copy = 42;
//~^ ERROR `impl Trait` not allowed
fn main() {
let foo = impl Copy = 42;
//~^ ERROR expected expression, found keyword `impl`
let foo: impl Copy = 42;
}

View file

@ -1,5 +1,5 @@
error: expected expression, found keyword `impl`
--> $DIR/feature-gate-impl_trait_in_bindings.rs:16:15
--> $DIR/feature-gate-impl_trait_in_bindings.rs:18:15
|
LL | let foo = impl Copy = 42;
| ^^^^ expected expression
@ -13,7 +13,7 @@ LL | const FOO: impl Copy = 42;
= help: add #![feature(impl_trait_in_bindings)] to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-impl_trait_in_bindings.rs:13:13
--> $DIR/feature-gate-impl_trait_in_bindings.rs:14:13
|
LL | static BAR: impl Copy = 42;
| ^^^^^^^^^

View file

@ -14,6 +14,7 @@
// book
#[used]
//~^ ERROR attribute must be applied to a `static` variable
fn foo() {}
fn main() {}

View file

@ -9,5 +9,6 @@
// except according to those terms.
trait Foo = Default;
//~^ ERROR trait aliases are experimental
fn main() {}

View file

@ -15,6 +15,7 @@ struct Str {}
impl Trt for Str {}
const _ : () = {
//~^ ERROR is unstable
use std::marker::PhantomData;
struct ImplementsTrait<T: Trt>(PhantomData<T>);
let _ = ImplementsTrait::<Str>(PhantomData);

View file

@ -2,6 +2,7 @@ error[E0658]: naming constants with `_` is unstable (see issue #54912)
--> $DIR/feature-gate-underscore_const_names.rs:17:1
|
LL | / const _ : () = {
LL | | //~^ ERROR is unstable
LL | | use std::marker::PhantomData;
LL | | struct ImplementsTrait<T: Trt>(PhantomData<T>);
LL | | let _ = ImplementsTrait::<Str>(PhantomData);

View file

@ -13,6 +13,8 @@ fn dangle(x: &mut i32) -> &'static mut i32 {
loop {
match unsafe { g.resume() } {
GeneratorState::Complete(c) => return c,
//[nll]~^ ERROR explicit lifetime required
//[ast]~^^ ERROR explicit lifetime required
GeneratorState::Yielded(_) => (),
}
}

View file

@ -18,6 +18,9 @@ fn main() {
let foo: impl Copy = 42;
let _ = FOO.count_ones();
//~^ ERROR no method
let _ = BAR.count_ones();
//~^ ERROR no method
let _ = foo.count_ones();
//~^ ERROR no method
}

View file

@ -5,13 +5,13 @@ LL | let _ = FOO.count_ones();
| ^^^^^^^^^^
error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope
--> $DIR/bindings-opaque.rs:21:17
--> $DIR/bindings-opaque.rs:22:17
|
LL | let _ = BAR.count_ones();
| ^^^^^^^^^^
error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope
--> $DIR/bindings-opaque.rs:22:17
--> $DIR/bindings-opaque.rs:24:17
|
LL | let _ = foo.count_ones();
| ^^^^^^^^^^

View file

@ -12,23 +12,27 @@
fn a<T: Clone>(x: T) {
const foo: impl Clone = x;
//~^ ERROR can't capture dynamic environment in a fn item
}
fn b<T: Clone>(x: T) {
let _ = move || {
const foo: impl Clone = x;
//~^ ERROR can't capture dynamic environment in a fn item
};
}
trait Foo<T: Clone> {
fn a(x: T) {
const foo: impl Clone = x;
//~^ ERROR can't capture dynamic environment in a fn item
}
}
impl<T: Clone> Foo<T> for i32 {
fn a(x: T) {
const foo: impl Clone = x;
//~^ ERROR can't capture dynamic environment in a fn item
}
}

View file

@ -7,7 +7,7 @@ LL | const foo: impl Clone = x;
= help: use the `|| { ... }` closure form instead
error[E0434]: can't capture dynamic environment in a fn item
--> $DIR/bindings.rs:19:33
--> $DIR/bindings.rs:20:33
|
LL | const foo: impl Clone = x;
| ^
@ -15,7 +15,7 @@ LL | const foo: impl Clone = x;
= help: use the `|| { ... }` closure form instead
error[E0434]: can't capture dynamic environment in a fn item
--> $DIR/bindings.rs:25:33
--> $DIR/bindings.rs:27:33
|
LL | const foo: impl Clone = x;
| ^
@ -23,7 +23,7 @@ LL | const foo: impl Clone = x;
= help: use the `|| { ... }` closure form instead
error[E0434]: can't capture dynamic environment in a fn item
--> $DIR/bindings.rs:31:33
--> $DIR/bindings.rs:34:33
|
LL | const foo: impl Clone = x;
| ^

View file

@ -16,6 +16,8 @@ impl Pair<
isize
> {
fn say(self: &Pair<&str, isize>) {
//~^ ERROR mismatched method receiver
//~| ERROR mismatched method receiver
println!("{:?}", self);
}
}

View file

@ -10,6 +10,8 @@ note: the anonymous lifetime #2 defined on the method body at 18:5...
--> $DIR/issue-17905-2.rs:18:5
|
LL | / fn say(self: &Pair<&str, isize>) {
LL | | //~^ ERROR mismatched method receiver
LL | | //~| ERROR mismatched method receiver
LL | | println!("{:?}", self);
LL | | }
| |_____^
@ -36,6 +38,8 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m
--> $DIR/issue-17905-2.rs:18:5
|
LL | / fn say(self: &Pair<&str, isize>) {
LL | | //~^ ERROR mismatched method receiver
LL | | //~| ERROR mismatched method receiver
LL | | println!("{:?}", self);
LL | | }
| |_____^

View file

@ -18,6 +18,8 @@ pub trait Process<'a> {
fn push_process<P>(process: P) where P: Process<'static> {
let _: Box<for<'b> Wrap<'b>> = Box::new(Wrapper(process));
//~^ ERROR is not an iterator
//~| ERROR is not satisfied
}
fn main() {}

View file

@ -1,4 +1,5 @@
#[derive(PartialEq)] struct Comparable;
#[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
//~^ ERROR can't compare `Comparable`
fn main() {}

View file

@ -22,4 +22,5 @@ use std::process::Command;
fn main() {
Command::new("echo").arg("hello").exec();
//~^ ERROR no method named `exec`
}

View file

@ -14,12 +14,16 @@ mod foo {
}
use foo::{self};
//~^ ERROR is defined multiple times
use foo as self;
//~^ ERROR expected identifier
use foo::self;
//~^ ERROR `self` imports are only allowed within a { } list
use foo::A;
use foo::{self as A};
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -1,11 +1,11 @@
error: expected identifier, found keyword `self`
--> $DIR/import-self.rs:18:12
--> $DIR/import-self.rs:19:12
|
LL | use foo as self;
| ^^^^ expected identifier, found keyword
error[E0429]: `self` imports are only allowed within a { } list
--> $DIR/import-self.rs:20:5
--> $DIR/import-self.rs:22:5
|
LL | use foo::self;
| ^^^^^^^^^
@ -26,7 +26,7 @@ LL | use foo::{self as other_foo};
| ^^^^^^^^^^^^^^^^^
error[E0252]: the name `A` is defined multiple times
--> $DIR/import-self.rs:23:11
--> $DIR/import-self.rs:26:11
|
LL | use foo::A;
| ------ previous import of the type `A` here

View file

@ -14,5 +14,6 @@ mod foo {
}
use foo::{A, A};
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -14,5 +14,6 @@ mod foo {
}
use foo::{A, B as A};
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -16,5 +16,6 @@ mod foo {
use foo::bar;
extern crate issue_45829_b as bar;
//~^ ERROR the name `bar` is defined multiple times
fn main() {}

View file

@ -13,5 +13,6 @@
extern crate issue_45829_a;
extern crate issue_45829_b as issue_45829_a;
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -13,5 +13,6 @@
extern crate issue_45829_a;
extern crate issue_45829_b as issue_45829_a;
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -12,5 +12,6 @@
extern crate issue_45829_b;
use std as issue_45829_b;
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -17,5 +17,6 @@ mod foo {
}
use foo::{A, bar::B as A};
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -9,5 +9,6 @@
// except according to those terms.
use std::{collections::HashMap as A, sync::Arc as A};
//~^ ERROR is defined multiple times
fn main() {}

View file

@ -10,6 +10,7 @@
use core;
use std as core;
//~^ ERROR is defined multiple times
fn main() {
1 + 1;

View file

@ -10,6 +10,7 @@
fn main(){
if i in 1..10 {
//~^ ERROR expected `{`, found keyword `in`
break;
}
}

View file

@ -17,5 +17,6 @@ fn main() {
let x = A::A { foo: 3 };
match x {
A::A { fob } => { println!("{}", fob); }
//~^ ERROR does not have a field named `fob`
}
}

View file

@ -8,7 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::time::{foo, bar, buzz};
//~^ ERROR unresolved imports
use std::time::{abc, def};
//~^ ERROR unresolved imports
fn main(){
println!("Hello World!");
println!("Hello World!");
}

View file

@ -8,7 +8,7 @@ LL | use std::time::{foo, bar, buzz};
| no `foo` in `time`
error[E0432]: unresolved imports `std::time::abc`, `std::time::def`
--> $DIR/issue-53565.rs:11:17
--> $DIR/issue-53565.rs:12:17
|
LL | use std::time::{abc, def};
| ^^^ ^^^ no `def` in `time`

View file

@ -11,12 +11,14 @@ fn main() {
let items = vec![1, 2, 3];
let ref_items: &[i32] = &items;
let items_clone: Vec<i32> = ref_items.clone();
//~^ ERROR mismatched types
// in that case no suggestion will be triggered
let items_clone_2:Vec<i32> = items.clone();
let s = "hi";
let string: String = s.clone();
//~^ ERROR mismatched types
// in that case no suggestion will be triggered
let s2 = "hi";

View file

@ -11,7 +11,7 @@ LL | let items_clone: Vec<i32> = ref_items.clone();
found type `&[i32]`
error[E0308]: mismatched types
--> $DIR/issue-53692.rs:19:30
--> $DIR/issue-53692.rs:20:30
|
LL | let string: String = s.clone();
| ^^^^^^^^^

View file

@ -20,8 +20,10 @@ fn main() {
let bar = Bar { a: "1".to_string(), b: "2".to_string() };
match E::Foo("".into(), "".into(), "".into()) {
E::Foo(a, b, ref c) => {}
//~^ ERROR cannot bind by-move and by-ref in the same pattern
}
match bar {
Bar {a, ref b} => {}
//~^ ERROR cannot bind by-move and by-ref in the same pattern
}
}

View file

@ -8,7 +8,7 @@ LL | E::Foo(a, b, ref c) => {}
| by-move pattern here
error[E0009]: cannot bind by-move and by-ref in the same pattern
--> $DIR/issue-53840.rs:25:14
--> $DIR/issue-53840.rs:26:14
|
LL | Bar {a, ref b} => {}
| ^ ----- both by-ref and by-move used

View file

@ -1,5 +1,5 @@
fn main() {
[1][0u64 as usize];
[1][1.5 as usize]; // ERROR index out of bounds
[1][1u64 as usize]; // ERROR index out of bounds
[1][1.5 as usize]; //~ ERROR index out of bounds
[1][1u64 as usize]; //~ ERROR index out of bounds
}

View file

@ -1,7 +1,7 @@
error: index out of bounds: the len is 1 but the index is 1
--> $DIR/issue-54348.rs:3:5
|
LL | [1][1.5 as usize]; // ERROR index out of bounds
LL | [1][1.5 as usize]; //~ ERROR index out of bounds
| ^^^^^^^^^^^^^^^^^
|
= note: #[deny(const_err)] on by default
@ -9,7 +9,7 @@ LL | [1][1.5 as usize]; // ERROR index out of bounds
error: index out of bounds: the len is 1 but the index is 1
--> $DIR/issue-54348.rs:4:5
|
LL | [1][1u64 as usize]; // ERROR index out of bounds
LL | [1][1u64 as usize]; //~ ERROR index out of bounds
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -14,9 +14,11 @@ pub trait Graph<'a> {
fn out_neighbors(&'a self, u: &Self::Node) -> Box<Iterator<Item = Self::Node>> {
Box::new(self.out_edges(u).map(|e| e.target()))
//~^ ERROR cannot infer
}
fn in_neighbors(&'a self, u: &Self::Node) -> Box<Iterator<Item = Self::Node>> {
Box::new(self.in_edges(u).map(|e| e.target()))
//~^ ERROR cannot infer
}
}

View file

@ -24,7 +24,7 @@ LL | Box::new(self.out_edges(u).map(|e| e.target()))
found std::boxed::Box<dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node>>
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/issue-55796.rs:20:9
--> $DIR/issue-55796.rs:21:9
|
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -34,8 +34,8 @@ note: first, the lifetime cannot outlive the lifetime 'a as defined on the trait
|
LL | pub trait Graph<'a> {
| ^^
note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:20:39: 20:53]>` will meet its required lifetime bounds
--> $DIR/issue-55796.rs:20:9
note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:21:39: 21:53]>` will meet its required lifetime bounds
--> $DIR/issue-55796.rs:21:9
|
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,14 +1,23 @@
fn main() {
for _ in [0..1] {}
//~^ ERROR is not an iterator
for _ in [0..=1] {}
//~^ ERROR is not an iterator
for _ in [0..] {}
//~^ ERROR is not an iterator
for _ in [..1] {}
//~^ ERROR is not an iterator
for _ in [..=1] {}
//~^ ERROR is not an iterator
let start = 0;
let end = 0;
for _ in [start..end] {}
//~^ ERROR is not an iterator
let array_of_range = [start..end];
for _ in array_of_range {}
//~^ ERROR is not an iterator
for _ in [0..1, 2..3] {}
//~^ ERROR is not an iterator
for _ in [0..=1] {}
//~^ ERROR is not an iterator
}

View file

@ -9,7 +9,7 @@ LL | for _ in [0..1] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator
--> $DIR/array-of-ranges.rs:3:14
--> $DIR/array-of-ranges.rs:4:14
|
LL | for _ in [0..=1] {}
| ^^^^^^^ if you meant to iterate between two values, remove the square brackets
@ -19,7 +19,7 @@ LL | for _ in [0..=1] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::RangeFrom<{integer}>; 1]` is not an iterator
--> $DIR/array-of-ranges.rs:4:14
--> $DIR/array-of-ranges.rs:6:14
|
LL | for _ in [0..] {}
| ^^^^^ if you meant to iterate from a value onwards, remove the square brackets
@ -29,7 +29,7 @@ LL | for _ in [0..] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::RangeTo<{integer}>; 1]` is not an iterator
--> $DIR/array-of-ranges.rs:5:14
--> $DIR/array-of-ranges.rs:8:14
|
LL | for _ in [..1] {}
| ^^^^^ if you meant to iterate until a value, remove the square brackets and add a starting value
@ -39,7 +39,7 @@ LL | for _ in [..1] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::RangeToInclusive<{integer}>; 1]` is not an iterator
--> $DIR/array-of-ranges.rs:6:14
--> $DIR/array-of-ranges.rs:10:14
|
LL | for _ in [..=1] {}
| ^^^^^^ if you meant to iterate until a value (including it), remove the square brackets and add a starting value
@ -49,7 +49,7 @@ LL | for _ in [..=1] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
--> $DIR/array-of-ranges.rs:9:14
--> $DIR/array-of-ranges.rs:14:14
|
LL | for _ in [start..end] {}
| ^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets
@ -59,7 +59,7 @@ LL | for _ in [start..end] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
--> $DIR/array-of-ranges.rs:11:14
--> $DIR/array-of-ranges.rs:17:14
|
LL | for _ in array_of_range {}
| ^^^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets
@ -69,7 +69,7 @@ LL | for _ in array_of_range {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator
--> $DIR/array-of-ranges.rs:12:14
--> $DIR/array-of-ranges.rs:19:14
|
LL | for _ in [0..1, 2..3] {}
| ^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
@ -79,7 +79,7 @@ LL | for _ in [0..1, 2..3] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator
--> $DIR/array-of-ranges.rs:13:14
--> $DIR/array-of-ranges.rs:21:14
|
LL | for _ in [0..=1] {}
| ^^^^^^^ if you meant to iterate between two values, remove the square brackets

View file

@ -1,6 +1,9 @@
fn main() {
for _ in [1, 2] {}
//~^ ERROR is not an iterator
let x = [1, 2];
for _ in x {}
//~^ ERROR is not an iterator
for _ in [1.0, 2.0] {}
//~^ ERROR is not an iterator
}

View file

@ -9,7 +9,7 @@ LL | for _ in [1, 2] {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[{integer}; 2]` is not an iterator
--> $DIR/array.rs:4:14
--> $DIR/array.rs:5:14
|
LL | for _ in x {}
| ^ borrow the array with `&` or call `.iter()` on it to iterate over it
@ -19,7 +19,7 @@ LL | for _ in x {}
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[{float}; 2]` is not an iterator
--> $DIR/array.rs:5:14
--> $DIR/array.rs:7:14
|
LL | for _ in [1.0, 2.0] {}
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it

View file

@ -1,3 +1,4 @@
struct S<I: Iterator>(I);
struct T(S<u8>);
//~^ ERROR is not an iterator
fn main() {}

View file

@ -6,6 +6,7 @@ trait Future {
use std::error::Error;
fn foo() -> impl Future<Item=(), Error=Box<Error>> {
//~^ ERROR missing lifetime
Ok(())
}

View file

@ -3,5 +3,6 @@ macro_rules! empty { () => () }
fn main() {
match 42 {
_ => { empty!() }
//~^ ERROR expected expression, found `<eof>`
};
}

View file

@ -14,7 +14,10 @@ fn foo2(_: i32) {}
fn main() {
foo(1u8);
//~^ ERROR mismatched types
foo1(2f32);
//~^ ERROR mismatched types
foo2(3i16);
//~^ ERROR mismatched types
}

View file

@ -9,7 +9,7 @@ LL | foo(1u16);
| ^^^^
error[E0308]: mismatched types
--> $DIR/numeric-literal-cast.rs:17:10
--> $DIR/numeric-literal-cast.rs:18:10
|
LL | foo1(2f32);
| ^^^^ expected f64, found f32
@ -19,7 +19,7 @@ LL | foo1(2f64);
| ^^^^
error[E0308]: mismatched types
--> $DIR/numeric-literal-cast.rs:18:10
--> $DIR/numeric-literal-cast.rs:20:10
|
LL | foo2(3i16);
| ^^^^ expected i32, found i16

View file

@ -18,7 +18,9 @@ struct Bar { field: Vec<i32> }
fn main() {
let x = Rc::new(Bar { field: vec![] });
drop(x.field);
//~^ ERROR cannot move out of an `Rc`
let y = Arc::new(Bar { field: vec![] });
drop(y.field);
//~^ ERROR cannot move out of an `Arc`
}

View file

@ -5,7 +5,7 @@ LL | drop(x.field);
| ^^^^^^^ cannot move out of an `Rc`
error[E0507]: cannot move out of an `Arc`
--> $DIR/issue-52086.rs:23:10
--> $DIR/issue-52086.rs:24:10
|
LL | drop(y.field);
| ^^^^^^^ cannot move out of an `Arc`

View file

@ -17,37 +17,45 @@ impl Test {
fn bar(&self, x: &u32) -> &u32 {
let x = 22;
&x
//~^ ERROR cannot return reference to local variable
}
}
fn foo(x: &u32) -> &u32 {
let x = 22;
&x
//~^ ERROR cannot return reference to local variable
}
fn baz(x: &u32) -> &&u32 {
let x = 22;
&&x
//~^ ERROR cannot return value referencing local variable
//~| ERROR cannot return reference to temporary value
}
fn foobazbar<'a>(x: u32, y: &'a u32) -> &'a u32 {
let x = 22;
&x
//~^ ERROR cannot return reference to local variable
}
fn foobar<'a>(x: &'a u32) -> &'a u32 {
let x = 22;
&x
//~^ ERROR cannot return reference to local variable
}
fn foobaz<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 {
let x = 22;
&x
//~^ ERROR cannot return reference to local variable
}
fn foobarbaz<'a, 'b>(x: &'a u32, y: &'b u32, z: &'a u32) -> &'a u32 {
let x = 22;
&x
//~^ ERROR cannot return reference to local variable
}
fn main() { }

View file

@ -5,13 +5,13 @@ LL | &x
| ^^ returns a reference to data owned by the current function
error[E0515]: cannot return reference to local variable `x`
--> $DIR/issue-52534-1.rs:25:5
--> $DIR/issue-52534-1.rs:26:5
|
LL | &x
| ^^ returns a reference to data owned by the current function
error[E0515]: cannot return value referencing local variable `x`
--> $DIR/issue-52534-1.rs:30:5
--> $DIR/issue-52534-1.rs:32:5
|
LL | &&x
| ^--
@ -20,7 +20,7 @@ LL | &&x
| returns a value referencing data owned by the current function
error[E0515]: cannot return reference to temporary value
--> $DIR/issue-52534-1.rs:30:5
--> $DIR/issue-52534-1.rs:32:5
|
LL | &&x
| ^--
@ -29,13 +29,7 @@ LL | &&x
| returns a reference to data owned by the current function
error[E0515]: cannot return reference to local variable `x`
--> $DIR/issue-52534-1.rs:35:5
|
LL | &x
| ^^ returns a reference to data owned by the current function
error[E0515]: cannot return reference to local variable `x`
--> $DIR/issue-52534-1.rs:40:5
--> $DIR/issue-52534-1.rs:39:5
|
LL | &x
| ^^ returns a reference to data owned by the current function
@ -47,7 +41,13 @@ LL | &x
| ^^ returns a reference to data owned by the current function
error[E0515]: cannot return reference to local variable `x`
--> $DIR/issue-52534-1.rs:50:5
--> $DIR/issue-52534-1.rs:51:5
|
LL | &x
| ^^ returns a reference to data owned by the current function
error[E0515]: cannot return reference to local variable `x`
--> $DIR/issue-52534-1.rs:57:5
|
LL | &x
| ^^ returns a reference to data owned by the current function

View file

@ -17,6 +17,7 @@ fn foo(x: &u32) -> &u32 {
{
let x = 32;
y = &x
//~^ ERROR does not live long enough
}
println!("{}", y);

View file

@ -3,6 +3,7 @@ error[E0597]: `x` does not live long enough
|
LL | y = &x
| ^^^^^^ borrowed value does not live long enough
LL | //~^ ERROR does not live long enough
LL | }
| - `x` dropped here while still borrowed
LL |

View file

@ -20,11 +20,13 @@ fn baz(_: impl FnOnce(&u32, u32) -> &u32) {
fn bar() {
let x = 22;
foo(|a| &x)
//~^ ERROR does not live long enough
}
fn foobar() {
let y = 22;
baz(|first, second| &y)
//~^ ERROR does not live long enough
}
fn main() { }

View file

@ -5,6 +5,7 @@ LL | foo(|a| &x)
| - ^ `x` would have to be valid for `'0`...
| |
| has type `&'0 u32`
LL | //~^ ERROR does not live long enough
LL | }
| - ...but `x` will be dropped here, when the function `bar` returns
|
@ -12,12 +13,13 @@ LL | }
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch04-02-references-and-borrowing.html#dangling-references>
error[E0597]: `y` does not live long enough
--> $DIR/issue-52534.rs:27:26
--> $DIR/issue-52534.rs:28:26
|
LL | baz(|first, second| &y)
| ----- ^ `y` would have to be valid for `'0`...
| |
| has type `&'0 u32`
LL | //~^ ERROR does not live long enough
LL | }
| - ...but `y` will be dropped here, when the function `foobar` returns
|

View file

@ -23,6 +23,7 @@ fn bar(mut a: A) -> B {
a.b = B;
foo(a);
a.b.clone()
//~^ ERROR borrow of moved value
}
fn main() {}

View file

@ -13,4 +13,5 @@
fn main() {
let mut v: Vec<()> = Vec::new();
|| &mut v;
//~^ ERROR captured variable cannot escape `FnMut` closure body
}

View file

@ -10,8 +10,10 @@
pub fn main(){
let maybe = Some(vec![true, true]);
loop {
loop {
if let Some(thing) = maybe {
//~^ ERROR use of partially moved value
//~| ERROR use of moved value
}
}
}

View file

@ -6,7 +6,7 @@ LL | D("other").next(&_thing1)
| | |
| | borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
LL | }
...
LL | }
| - `_thing1` dropped here while still borrowed
LL |

View file

@ -5,6 +5,7 @@ fn main() {
let _thing2 = D("thing2");
side_effects();
D("other").next(&_thing1)
//~^ ERROR does not live long enough
}
}

View file

@ -3,7 +3,7 @@ error[E0597]: `_thing1` does not live long enough
|
LL | D("other").next(&_thing1)
| ^^^^^^^ borrowed value does not live long enough
LL | }
...
LL | }
| - `_thing1` dropped here while still borrowed
LL |

View file

@ -1,7 +1,7 @@
error[E0597]: `counter` does not live long enough
--> $DIR/issue-54556-niconii.rs:22:20
|
LL | if let Ok(_) = counter.lock() { }
LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough
| ^^^^^^^-------
| |
| borrowed value does not live long enough

View file

@ -19,7 +19,7 @@ impl Mutex {
fn main() {
let counter = Mutex;
if let Ok(_) = counter.lock() { }
if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough
// With this code as written, the dynamic semantics here implies
// that `Mutex::drop` for `counter` runs *before*

View file

@ -1,7 +1,7 @@
error[E0597]: `counter` does not live long enough
--> $DIR/issue-54556-niconii.rs:22:20
|
LL | if let Ok(_) = counter.lock() { }
LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough
| ^^^^^^^ borrowed value does not live long enough
...
LL | }

View file

@ -1,7 +1,7 @@
error[E0597]: `stmt` does not live long enough
--> $DIR/issue-54556-stephaneyfx.rs:27:21
|
LL | let rows = Rows(&stmt);
LL | let rows = Rows(&stmt); //~ ERROR does not live long enough
| ^^^^^ borrowed value does not live long enough
LL | rows.map(|row| row).next()
| ------------------- a temporary with access to the borrow is created here ...

Some files were not shown because too many files have changed in this diff Show more