Adjust & --bless tests due to no longer downgrading NLL errors on 2015.
This commit is contained in:
parent
aff9c833e5
commit
6ec9b3a0b6
@ -1,40 +0,0 @@
|
||||
error[E0503]: cannot use `y` because it was mutably borrowed
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:17:7
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
| --------- borrow of `y.0` occurs here
|
||||
...
|
||||
LL | Foo::Y(_, ref mut b) => b,
|
||||
| ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0503]: cannot use `y` because it was mutably borrowed
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:37:7
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
| --------- borrow of `y.0` occurs here
|
||||
...
|
||||
LL | Foo::Y(ref mut b, _) => b,
|
||||
| ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:37:14
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
| --------- first mutable borrow occurs here
|
||||
...
|
||||
LL | Foo::Y(ref mut b, _) => b,
|
||||
| ^^^^^^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- first borrow later used here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0499, E0503.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
@ -15,9 +15,7 @@ fn distinct_variant() {
|
||||
// reference.
|
||||
let b = match y {
|
||||
Foo::Y(_, ref mut b) => b,
|
||||
//~^ WARNING cannot use `y`
|
||||
//~| WARNING this error has been downgraded to a warning
|
||||
//~| WARNING this warning will become a hard error in the future
|
||||
//~^ ERROR cannot use `y`
|
||||
Foo::X => panic!()
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
warning[E0503]: cannot use `y` because it was mutably borrowed
|
||||
error[E0503]: cannot use `y` because it was mutably borrowed
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:17:7
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
@ -9,13 +9,9 @@ LL | Foo::Y(_, ref mut b) => b,
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error[E0503]: cannot use `y` because it was mutably borrowed
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:37:7
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:35:7
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
| --------- borrow of `y.0` occurs here
|
||||
@ -27,7 +23,7 @@ LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:37:14
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:35:14
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
| --------- first mutable borrow occurs here
|
||||
@ -38,7 +34,7 @@ LL | Foo::Y(ref mut b, _) => b,
|
||||
LL | *a += 1;
|
||||
| ------- first borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0499, E0503.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
||||
|
@ -1,366 +0,0 @@
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-describe-lvalue.rs:262:13
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ first mutable borrow occurs here
|
||||
LL | &mut x;
|
||||
| ^^^^^^ second mutable borrow occurs here
|
||||
LL | *y = 1;
|
||||
| ------ first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-describe-lvalue.rs:272:20
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ first mutable borrow occurs here
|
||||
LL | &mut x;
|
||||
| ^^^^^^ second mutable borrow occurs here
|
||||
LL | *y = 1;
|
||||
| ------ first borrow later used here
|
||||
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/borrowck-describe-lvalue.rs:270:16
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
LL | / || {
|
||||
LL | | let y = &mut x;
|
||||
LL | | &mut x;
|
||||
LL | | *y = 1;
|
||||
LL | | drop(y);
|
||||
LL | | }
|
||||
| |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
||||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
|
||||
error[E0503]: cannot use `f.x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:41:9
|
||||
|
|
||||
LL | let x = f.x();
|
||||
| - borrow of `f` occurs here
|
||||
LL | f.x;
|
||||
| ^^^ use of borrowed `f`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `g.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:48:9
|
||||
|
|
||||
LL | let x = g.x();
|
||||
| - borrow of `g` occurs here
|
||||
LL | g.0;
|
||||
| ^^^ use of borrowed `g`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `h.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:55:9
|
||||
|
|
||||
LL | let x = &mut h.0;
|
||||
| -------- borrow of `h.0` occurs here
|
||||
LL | h.0;
|
||||
| ^^^ use of borrowed `h.0`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:63:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `e` occurs here
|
||||
LL | match e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `e`
|
||||
LL | };
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `u.a` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:71:9
|
||||
|
|
||||
LL | let x = &mut u.a;
|
||||
| -------- borrow of `u.a` occurs here
|
||||
LL | u.a;
|
||||
| ^^^ use of borrowed `u.a`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `f.x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:78:9
|
||||
|
|
||||
LL | let x = f.x();
|
||||
| - borrow of `*f` occurs here
|
||||
LL | f.x;
|
||||
| ^^^ use of borrowed `*f`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `g.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:85:9
|
||||
|
|
||||
LL | let x = g.x();
|
||||
| - borrow of `*g` occurs here
|
||||
LL | g.0;
|
||||
| ^^^ use of borrowed `*g`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `h.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:92:9
|
||||
|
|
||||
LL | let x = &mut h.0;
|
||||
| -------- borrow of `h.0` occurs here
|
||||
LL | h.0;
|
||||
| ^^^ use of borrowed `h.0`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:100:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `*e` occurs here
|
||||
LL | match *e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `*e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `u.a` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:109:9
|
||||
|
|
||||
LL | let x = &mut u.a;
|
||||
| -------- borrow of `u.a` occurs here
|
||||
LL | u.a;
|
||||
| ^^^ use of borrowed `u.a`
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:117:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v {
|
||||
LL | &[x, _, .., _, _] => println!("{}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:122:18
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | &[_, x, .., _, _] => println!("{}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:127:25
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | &[_, _, .., x, _] => println!("{}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:132:28
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | &[_, _, .., _, x] => println!("{}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:143:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v {
|
||||
LL | &[x @ ..] => println!("{:?}", x),
|
||||
| ^^^^^^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:148:18
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | &[_, x @ ..] => println!("{:?}", x),
|
||||
| ^^^^^^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:153:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | &[x @ .., _] => println!("{:?}", x),
|
||||
| ^^^^^^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:158:18
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | &[_, x @ .., _] => println!("{:?}", x),
|
||||
| ^^^^^^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:171:13
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ borrow of `e` occurs here
|
||||
LL | match e {
|
||||
LL | E::A(ref ax) =>
|
||||
| ^^^^^^^^^^^^ use of borrowed `e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:171:18
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match e {
|
||||
LL | E::A(ref ax) =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:175:23
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ mutable borrow occurs here
|
||||
...
|
||||
LL | E::B { x: ref bx } =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:188:22
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match s {
|
||||
LL | S { y: (ref y0, _), .. } =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:194:28
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ mutable borrow occurs here
|
||||
...
|
||||
LL | S { x: F { y: ref x0, .. }, .. } =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0503]: cannot use `*v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:240:9
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | v[0].y;
|
||||
| ^^^^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:240:9
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | v[0].y;
|
||||
| ^^^^^^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:251:24
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match v {
|
||||
LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:210:29
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
LL | let p: &'a u8 = &*block.current;
|
||||
| ^^^^^^^^^^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:227:33
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
LL | let p : *const u8 = &*(*block).current;
|
||||
| ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0382]: use of moved value: `x`
|
||||
--> $DIR/borrowck-describe-lvalue.rs:282:22
|
||||
|
|
||||
LL | drop(x);
|
||||
| - value moved here
|
||||
LL | drop(x);
|
||||
| ^ value used here after move
|
||||
|
|
||||
= note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0382, E0499, E0502, E0503.
|
||||
For more information about an error, try `rustc --explain E0382`.
|
@ -208,10 +208,8 @@ fn main() {
|
||||
fn bump<'a>(mut block: &mut Block<'a>) {
|
||||
let x = &mut block;
|
||||
let p: &'a u8 = &*block.current;
|
||||
//~^ WARNING cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
//~| this error has been downgraded
|
||||
//~| this warning will become a hard error in the future
|
||||
// Warning because of issue rust#38899
|
||||
//~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
// See issue rust#38899
|
||||
drop(x);
|
||||
}
|
||||
}
|
||||
@ -225,10 +223,8 @@ fn main() {
|
||||
unsafe fn bump2(mut block: *mut Block2) {
|
||||
let x = &mut block;
|
||||
let p : *const u8 = &*(*block).current;
|
||||
//~^ WARNING cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
//~| this error has been downgraded
|
||||
//~| this warning will become a hard error in the future
|
||||
// Warning because of issue rust#38899
|
||||
//~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
// See issue rust#38899
|
||||
drop(x);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-describe-lvalue.rs:262:13
|
||||
--> $DIR/borrowck-describe-lvalue.rs:258:13
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ first mutable borrow occurs here
|
||||
@ -9,7 +9,7 @@ LL | *y = 1;
|
||||
| ------ first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-describe-lvalue.rs:272:20
|
||||
--> $DIR/borrowck-describe-lvalue.rs:268:20
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ first mutable borrow occurs here
|
||||
@ -19,7 +19,7 @@ LL | *y = 1;
|
||||
| ------ first borrow later used here
|
||||
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/borrowck-describe-lvalue.rs:270:16
|
||||
--> $DIR/borrowck-describe-lvalue.rs:266:16
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
@ -295,7 +295,7 @@ LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error[E0503]: cannot use `*v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:240:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:236:9
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
@ -306,7 +306,7 @@ LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:240:9
|
||||
--> $DIR/borrowck-describe-lvalue.rs:236:9
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
@ -317,7 +317,7 @@ LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:251:24
|
||||
--> $DIR/borrowck-describe-lvalue.rs:247:24
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ mutable borrow occurs here
|
||||
@ -328,7 +328,7 @@ LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:210:29
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
@ -338,13 +338,9 @@ LL | let p: &'a u8 = &*block.current;
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:227:33
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:225:33
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
@ -353,13 +349,9 @@ LL | let p : *const u8 = &*(*block).current;
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error[E0382]: use of moved value: `x`
|
||||
--> $DIR/borrowck-describe-lvalue.rs:282:22
|
||||
--> $DIR/borrowck-describe-lvalue.rs:278:22
|
||||
|
|
||||
LL | drop(x);
|
||||
| - value moved here
|
||||
@ -368,7 +360,7 @@ LL | drop(x);
|
||||
|
|
||||
= note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to 30 previous errors
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0382, E0499, E0502, E0503.
|
||||
For more information about an error, try `rustc --explain E0382`.
|
||||
|
@ -1,14 +0,0 @@
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-migrate-to-nll.rs:29:21
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
LL | let p: &'a u8 = &*block.current;
|
||||
| ^^^^^^^^^^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
@ -1,36 +0,0 @@
|
||||
// This is a test of the borrowck migrate mode. It leverages #38899, a
|
||||
// bug that is fixed by NLL: this code is (unsoundly) accepted by
|
||||
// AST-borrowck, but is correctly rejected by the NLL borrowck.
|
||||
//
|
||||
// Therefore, for backwards-compatiblity, under borrowck=migrate the
|
||||
// NLL checks will be emitted as *warnings*.
|
||||
//
|
||||
// In Rust 2018, no errors will be downgraded to warnings.
|
||||
|
||||
// NLL mode makes this compile-fail; we cannot currently encode a
|
||||
// test that is run-pass or compile-fail based on compare-mode. So
|
||||
// just ignore it instead:
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
// revisions: zflag edition
|
||||
//[zflag]compile-flags: -Z borrowck=migrate
|
||||
//[edition]edition:2018
|
||||
//[zflag] check-pass
|
||||
|
||||
pub struct Block<'a> {
|
||||
current: &'a u8,
|
||||
unrelated: &'a u8,
|
||||
}
|
||||
|
||||
fn bump<'a>(mut block: &mut Block<'a>) {
|
||||
let x = &mut block;
|
||||
let p: &'a u8 = &*block.current;
|
||||
//[edition]~^ ERROR cannot borrow `*block.current` as immutable
|
||||
// (use `x` and `p` so enabling NLL doesn't assign overly short lifetimes)
|
||||
drop(x);
|
||||
drop(p);
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,15 +0,0 @@
|
||||
warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-migrate-to-nll.rs:29:21
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
LL | let p: &'a u8 = &*block.current;
|
||||
| ^^^^^^^^^^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - mutable borrow later used here
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
@ -1,328 +0,0 @@
|
||||
error[E0493]: destructors cannot be evaluated at compile-time
|
||||
--> $DIR/min_const_fn.rs:37:25
|
||||
|
|
||||
LL | const fn into_inner(self) -> T { self.0 }
|
||||
| ^^^^ constant functions cannot evaluate destructors
|
||||
|
||||
error[E0723]: mutable references in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:39:36
|
||||
|
|
||||
LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0493]: destructors cannot be evaluated at compile-time
|
||||
--> $DIR/min_const_fn.rs:44:28
|
||||
|
|
||||
LL | const fn into_inner_lt(self) -> T { self.0 }
|
||||
| ^^^^ constant functions cannot evaluate destructors
|
||||
|
||||
error[E0723]: mutable references in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:46:42
|
||||
|
|
||||
LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0493]: destructors cannot be evaluated at compile-time
|
||||
--> $DIR/min_const_fn.rs:51:27
|
||||
|
|
||||
LL | const fn into_inner_s(self) -> T { self.0 }
|
||||
| ^^^^ constant functions cannot evaluate destructors
|
||||
|
||||
error[E0723]: mutable references in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:53:38
|
||||
|
|
||||
LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: mutable references in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:58:39
|
||||
|
|
||||
LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:76:16
|
||||
|
|
||||
LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:78:18
|
||||
|
|
||||
LL | const fn foo11_2<T: Send>(t: T) -> T { t }
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: only int, `bool` and `char` operations are stable in const fn
|
||||
--> $DIR/min_const_fn.rs:80:33
|
||||
|
|
||||
LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: only int, `bool` and `char` operations are stable in const fn
|
||||
--> $DIR/min_const_fn.rs:82:35
|
||||
|
|
||||
LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: only int and `bool` operations are stable in const fn
|
||||
--> $DIR/min_const_fn.rs:84:35
|
||||
|
|
||||
LL | const fn foo19_3(f: f32) -> f32 { -f }
|
||||
| ^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: only int, `bool` and `char` operations are stable in const fn
|
||||
--> $DIR/min_const_fn.rs:86:43
|
||||
|
|
||||
LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
|
||||
| ^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: cannot access `static` items in const fn
|
||||
--> $DIR/min_const_fn.rs:90:27
|
||||
|
|
||||
LL | const fn foo25() -> u32 { BAR }
|
||||
| ^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: cannot access `static` items in const fn
|
||||
--> $DIR/min_const_fn.rs:91:36
|
||||
|
|
||||
LL | const fn foo26() -> &'static u32 { &BAR }
|
||||
| ^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: casting pointers to ints is unstable in const fn
|
||||
--> $DIR/min_const_fn.rs:92:42
|
||||
|
|
||||
LL | const fn foo30(x: *const u32) -> usize { x as usize }
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: casting pointers to ints is unstable in const fn
|
||||
--> $DIR/min_const_fn.rs:94:63
|
||||
|
|
||||
LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: casting pointers to ints is unstable in const fn
|
||||
--> $DIR/min_const_fn.rs:96:42
|
||||
|
|
||||
LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: casting pointers to ints is unstable in const fn
|
||||
--> $DIR/min_const_fn.rs:98:63
|
||||
|
|
||||
LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: loops and conditional expressions are not stable in const fn
|
||||
--> $DIR/min_const_fn.rs:100:38
|
||||
|
|
||||
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: loops are not allowed in const fn
|
||||
--> $DIR/min_const_fn.rs:102:29
|
||||
|
|
||||
LL | const fn foo30_5(b: bool) { while b { } }
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: loops and conditional expressions are not stable in const fn
|
||||
--> $DIR/min_const_fn.rs:105:44
|
||||
|
|
||||
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: loops and conditional expressions are not stable in const fn
|
||||
--> $DIR/min_const_fn.rs:107:44
|
||||
|
|
||||
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: mutable references in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:109:14
|
||||
|
|
||||
LL | const fn inc(x: &mut i32) { *x += 1 }
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:114:6
|
||||
|
|
||||
LL | impl<T: std::fmt::Debug> Foo<T> {
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:119:6
|
||||
|
|
||||
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:124:6
|
||||
|
|
||||
LL | impl<T: Sync + Sized> Foo<T> {
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: `impl Trait` in const fn is unstable
|
||||
--> $DIR/min_const_fn.rs:130:24
|
||||
|
|
||||
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:132:34
|
||||
|
|
||||
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:134:22
|
||||
|
|
||||
LL | const fn no_apit(_x: impl std::fmt::Debug) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: `impl Trait` in const fn is unstable
|
||||
--> $DIR/min_const_fn.rs:135:23
|
||||
|
|
||||
LL | const fn no_rpit() -> impl std::fmt::Debug {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:136:23
|
||||
|
|
||||
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
|
||||
| ^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:137:32
|
||||
|
|
||||
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0515]: cannot return reference to temporary value
|
||||
--> $DIR/min_const_fn.rs:137:63
|
||||
|
|
||||
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
| ^--
|
||||
| ||
|
||||
| |temporary value created here
|
||||
| returns a reference to data owned by the current function
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:145:41
|
||||
|
|
||||
LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: function pointers in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:148:21
|
||||
|
|
||||
LL | const fn no_fn_ptrs(_x: fn()) {}
|
||||
| ^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: function pointers in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:150:27
|
||||
|
|
||||
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
|
||||
| ^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 37 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0515, E0723.
|
||||
For more information about an error, try `rustc --explain E0515`.
|
@ -136,9 +136,7 @@ const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn
|
||||
const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
|
||||
const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
//~^ ERROR trait bounds other than `Sized`
|
||||
//~| WARNING cannot return reference to temporary value
|
||||
//~| WARNING this error has been downgraded to a warning
|
||||
//~| WARNING this warning will become a hard error in the future
|
||||
//~| ERROR cannot return reference to temporary value
|
||||
|
||||
const fn no_unsafe() { unsafe {} }
|
||||
|
||||
|
@ -286,7 +286,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
warning[E0515]: cannot return reference to temporary value
|
||||
error[E0515]: cannot return reference to temporary value
|
||||
--> $DIR/min_const_fn.rs:137:63
|
||||
|
|
||||
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
@ -294,13 +294,9 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
| ||
|
||||
| |temporary value created here
|
||||
| returns a reference to data owned by the current function
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:145:41
|
||||
--> $DIR/min_const_fn.rs:143:41
|
||||
|
|
||||
LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -309,7 +305,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: function pointers in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:148:21
|
||||
--> $DIR/min_const_fn.rs:146:21
|
||||
|
|
||||
LL | const fn no_fn_ptrs(_x: fn()) {}
|
||||
| ^^
|
||||
@ -318,7 +314,7 @@ LL | const fn no_fn_ptrs(_x: fn()) {}
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: function pointers in const fn are unstable
|
||||
--> $DIR/min_const_fn.rs:150:27
|
||||
--> $DIR/min_const_fn.rs:148:27
|
||||
|
|
||||
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
|
||||
| ^^^^
|
||||
@ -326,7 +322,7 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 36 previous errors
|
||||
error: aborting due to 37 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0515, E0723.
|
||||
For more information about an error, try `rustc --explain E0515`.
|
||||
|
@ -1,31 +0,0 @@
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn_dyn.rs:9:5
|
||||
|
|
||||
LL | x.0.field;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn_dyn.rs:12:66
|
||||
|
|
||||
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
|
||||
| ^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/min_const_fn_dyn.rs:12:67
|
||||
|
|
||||
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
|
||||
| -^ - temporary value is freed at the end of this statement
|
||||
| ||
|
||||
| |creates a temporary which is freed while still in use
|
||||
| cast requires that borrow lasts for `'static`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0716, E0723.
|
||||
For more information about an error, try `rustc --explain E0716`.
|
@ -11,8 +11,6 @@ const fn no_inner_dyn_trait2(x: Hide) {
|
||||
}
|
||||
const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
|
||||
//~^ ERROR trait bounds other than `Sized`
|
||||
//~| WARNING temporary value dropped while borrowed
|
||||
//~| WARNING this error has been downgraded to a warning
|
||||
//~| WARNING this warning will become a hard error in the future
|
||||
//~| ERROR temporary value dropped while borrowed
|
||||
|
||||
fn main() {}
|
||||
|
@ -16,7 +16,7 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
warning[E0716]: temporary value dropped while borrowed
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/min_const_fn_dyn.rs:12:67
|
||||
|
|
||||
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
|
||||
@ -24,12 +24,8 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
|
||||
| ||
|
||||
| |creates a temporary which is freed while still in use
|
||||
| cast requires that borrow lasts for `'static`
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0716, E0723.
|
||||
For more information about an error, try `rustc --explain E0716`.
|
||||
|
@ -1,20 +1,18 @@
|
||||
// There isn't a great way to test feature(nll), since it just disables migrate
|
||||
// mode and changes some error messages. We just test for migrate mode.
|
||||
// mode and changes some error messages.
|
||||
|
||||
// FIXME(Centril): This test is probably obsolete now and `nll` should become
|
||||
// `accepted`.
|
||||
|
||||
// Don't use compare-mode=nll, since that turns on NLL.
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { //~ ERROR compilation successful
|
||||
fn main() {
|
||||
let mut x = (33, &0);
|
||||
|
||||
let m = &mut x;
|
||||
let p = &*x.1;
|
||||
//~^ WARNING cannot borrow
|
||||
//~| WARNING this error has been downgraded to a warning
|
||||
//~| WARNING this warning will become a hard error in the future
|
||||
//~^ ERROR cannot borrow
|
||||
m;
|
||||
}
|
||||
|
@ -1,29 +1,13 @@
|
||||
warning[E0502]: cannot borrow `*x.1` as immutable because it is also borrowed as mutable
|
||||
error[E0502]: cannot borrow `*x.1` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/feature-gate-nll.rs:15:13
|
||||
|
|
||||
LL | let m = &mut x;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | let p = &*x.1;
|
||||
| ^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL |
|
||||
LL | m;
|
||||
| - mutable borrow later used here
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/feature-gate-nll.rs:11:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | let mut x = (33, &0);
|
||||
LL | |
|
||||
LL | | let m = &mut x;
|
||||
... |
|
||||
LL | | m;
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
warning: captured variable cannot escape `FnMut` closure body
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-1.rs:11:9
|
||||
|
|
||||
LL | || {
|
||||
@ -8,15 +8,6 @@ LL | &mut x
|
||||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-40510-1.rs:20:1
|
||||
|
|
||||
LL | fn main() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-1.rs:11:9
|
||||
--> $DIR/issue-40510-1.rs:7:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
|
@ -1,21 +1,12 @@
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(unused)]
|
||||
|
||||
// revisions: migrate nll
|
||||
#![cfg_attr(nll, feature(nll))]
|
||||
|
||||
fn f() {
|
||||
let mut x: Box<()> = Box::new(());
|
||||
|
||||
|| {
|
||||
&mut x
|
||||
};
|
||||
//[migrate]~^^ WARNING captured variable cannot escape `FnMut` closure body
|
||||
//[migrate]~| WARNING this error has been downgraded to a warning
|
||||
//[migrate]~| WARNING this warning will become a hard error in the future
|
||||
//[nll]~^^^^^ ERROR captured variable cannot escape `FnMut` closure body
|
||||
//~^^ ERROR captured variable cannot escape `FnMut` closure body
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {}
|
||||
//[migrate]~^ ERROR
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-1.rs:11:9
|
||||
--> $DIR/issue-40510-1.rs:7:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
@ -1,4 +1,4 @@
|
||||
warning: captured variable cannot escape `FnMut` closure body
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-3.rs:11:9
|
||||
|
|
||||
LL | || {
|
||||
@ -10,15 +10,6 @@ LL | | }
|
||||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-40510-3.rs:22:1
|
||||
|
|
||||
LL | fn main() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-3.rs:11:9
|
||||
--> $DIR/issue-40510-3.rs:7:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
|
@ -1,9 +1,5 @@
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(unused)]
|
||||
|
||||
// revisions: migrate nll
|
||||
#![cfg_attr(nll, feature(nll))]
|
||||
|
||||
fn f() {
|
||||
let mut x: Vec<()> = Vec::new();
|
||||
|
||||
@ -11,13 +7,8 @@ fn f() {
|
||||
|| {
|
||||
x.push(())
|
||||
}
|
||||
//[migrate]~^^^ WARNING captured variable cannot escape `FnMut` closure body
|
||||
//[migrate]~| WARNING this error has been downgraded to a warning
|
||||
//[migrate]~| WARNING this warning will become a hard error in the future
|
||||
//[nll]~^^^^^^ ERROR captured variable cannot escape `FnMut` closure body
|
||||
//~^^^ ERROR captured variable cannot escape `FnMut` closure body
|
||||
};
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {}
|
||||
//[migrate]~^ ERROR
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-3.rs:11:9
|
||||
--> $DIR/issue-40510-3.rs:7:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
@ -1,4 +1,4 @@
|
||||
warning[E0713]: borrow may still be in use when destructor runs
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:52:5
|
||||
|
|
||||
LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
|
||||
@ -8,12 +8,8 @@ LL | &mut *s.0
|
||||
...
|
||||
LL | }
|
||||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
warning[E0713]: borrow may still be in use when destructor runs
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
|
||||
|
|
||||
LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
|
||||
@ -23,12 +19,8 @@ LL | &mut *(*s).0
|
||||
...
|
||||
LL | }
|
||||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
warning[E0713]: borrow may still be in use when destructor runs
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:74:5
|
||||
|
|
||||
LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
|
||||
@ -38,23 +30,7 @@ LL | &mut *(**s).0
|
||||
...
|
||||
LL | }
|
||||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:81:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | let mut x = 1;
|
||||
LL | | {
|
||||
LL | | let mut long_lived = Scribble(&mut x);
|
||||
... |
|
||||
LL | | *boxed_boxed_scribbled(Box::new(Box::new(Scribble(&mut x)))) += 10;
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0713`.
|
||||
|
@ -2,27 +2,16 @@
|
||||
// mutable borrows that would be scribbled over by destructors before
|
||||
// the return occurs.
|
||||
//
|
||||
// We will explicitly test NLL, and migration modes;
|
||||
// thus we will also skip the automated compare-mode=nll.
|
||||
// We will explicitly test NLL; thus we will also skip the automated compare-mode=nll.
|
||||
|
||||
// revisions: nll migrate
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
// This test is going to pass in the migrate revision, because the AST-borrowck
|
||||
// accepted this code in the past (see notes below). So we use `#[rustc_error]`
|
||||
// to keep the outcome as an error in all scenarios, and rely on the stderr
|
||||
// files to show what the actual behavior is. (See rust-lang/rust#49855.)
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#![cfg_attr(nll, feature(nll))]
|
||||
|
||||
struct Scribble<'a>(&'a mut u32);
|
||||
|
||||
impl<'a> Drop for Scribble<'a> { fn drop(&mut self) { *self.0 = 42; } }
|
||||
|
||||
// this is okay, in both AST-borrowck and NLL: The `Scribble` here *has*
|
||||
// to strictly outlive `'a`
|
||||
// this is okay: The `Scribble` here *has* to strictly outlive `'a`
|
||||
fn borrowed_scribble<'a>(s: &'a mut Scribble) -> &'a mut u32 {
|
||||
&mut *s.0
|
||||
}
|
||||
@ -44,41 +33,21 @@ fn boxed_boxed_borrowed_scribble<'a>(s: Box<Box<&'a mut Scribble>>) -> &'a mut u
|
||||
// * (Maybe in the future the two-phase borrows system will be
|
||||
// extended to support this case. But for now, it is an error in
|
||||
// NLL, even with two-phase borrows.)
|
||||
//
|
||||
// In any case, the AST-borrowck was not smart enough to know that
|
||||
// this should be an error. (Which is perhaps the essence of why
|
||||
// rust-lang/rust#45696 arose in the first place.)
|
||||
fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
|
||||
&mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
|
||||
//[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
|
||||
//[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility
|
||||
//[migrate]~| WARNING this represents potential undefined behavior in your code
|
||||
&mut *s.0 //~ ERROR borrow may still be in use when destructor runs [E0713]
|
||||
}
|
||||
|
||||
// This, by analogy to previous case, is *also* not okay.
|
||||
//
|
||||
// (But again, AST-borrowck was not smart enogh to know that this
|
||||
// should be an error.)
|
||||
fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
|
||||
&mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
|
||||
//[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
|
||||
//[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility
|
||||
//[migrate]~| WARNING this represents potential undefined behavior in your code
|
||||
&mut *(*s).0 //~ ERROR borrow may still be in use when destructor runs [E0713]
|
||||
}
|
||||
|
||||
// This, by analogy to previous case, is *also* not okay.
|
||||
//
|
||||
// (But again, AST-borrowck was not smart enogh to know that this
|
||||
// should be an error.)
|
||||
fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
|
||||
&mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
|
||||
//[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
|
||||
//[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility
|
||||
//[migrate]~| WARNING this represents potential undefined behavior in your code
|
||||
&mut *(**s).0 //~ ERROR borrow may still be in use when destructor runs [E0713]
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { //[migrate]~ ERROR compilation successful
|
||||
fn main() {
|
||||
let mut x = 1;
|
||||
{
|
||||
let mut long_lived = Scribble(&mut x);
|
||||
|
@ -0,0 +1,33 @@
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:37:5
|
||||
|
|
||||
LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | &mut *s.0
|
||||
| ^^^^^^^^^ returning this value requires that `*s.0` is borrowed for `'a`
|
||||
LL | }
|
||||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:42:5
|
||||
|
|
||||
LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | &mut *(*s).0
|
||||
| ^^^^^^^^^^^^ returning this value requires that `*s.0` is borrowed for `'a`
|
||||
LL | }
|
||||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:47:5
|
||||
|
|
||||
LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | &mut *(**s).0
|
||||
| ^^^^^^^^^^^^^ returning this value requires that `*s.0` is borrowed for `'a`
|
||||
LL | }
|
||||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0713`.
|
@ -1,18 +0,0 @@
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-49824.rs:10:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
LL | / || {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _y = &mut x;
|
||||
LL | | }
|
||||
| |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
||||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,16 +1,8 @@
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// This test checks that a warning occurs with migrate mode.
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {
|
||||
//~^ ERROR compilation successful
|
||||
let mut x = 0;
|
||||
|| {
|
||||
|| {
|
||||
//~^ WARNING captured variable cannot escape `FnMut` closure body
|
||||
//~| WARNING this error has been downgraded to a warning
|
||||
//~| WARNING this warning will become a hard error in the future
|
||||
//~^ ERROR captured variable cannot escape `FnMut` closure body
|
||||
let _y = &mut x;
|
||||
}
|
||||
};
|
||||
|
@ -1,33 +1,16 @@
|
||||
warning: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-49824.rs:10:9
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-49824.rs:4:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
LL | / || {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _y = &mut x;
|
||||
LL | | }
|
||||
| |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
||||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-49824.rs:6:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | |
|
||||
LL | | let mut x = 0;
|
||||
LL | | || {
|
||||
... |
|
||||
LL | | };
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
// Regression test for issue #38899
|
||||
|
||||
#![feature(nll)]
|
||||
|
||||
pub struct Block<'a> {
|
||||
current: &'a u8,
|
||||
unrelated: &'a u8,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowed-referent-issue-38899.rs:13:21
|
||||
--> $DIR/borrowed-referent-issue-38899.rs:11:21
|
||||
|
|
||||
LL | let x = &mut block;
|
||||
| ---------- mutable borrow occurs here
|
||||
|
@ -1,22 +0,0 @@
|
||||
error[E0303]: pattern bindings are not allowed after an `@`
|
||||
--> $DIR/pattern-bindings-after-at.rs:8:31
|
||||
|
|
||||
LL | ref mut z @ &mut Some(ref a) => {
|
||||
| ^^^^^ not allowed after `@`
|
||||
|
||||
error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/pattern-bindings-after-at.rs:8:31
|
||||
|
|
||||
LL | ref mut z @ &mut Some(ref a) => {
|
||||
| ----------------------^^^^^-
|
||||
| | |
|
||||
| | immutable borrow occurs here
|
||||
| mutable borrow occurs here
|
||||
...
|
||||
LL | **z = None;
|
||||
| ---------- mutable borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0303, E0502.
|
||||
For more information about an error, try `rustc --explain E0303`.
|
@ -7,9 +7,7 @@ fn main() {
|
||||
match &mut Some(1) {
|
||||
ref mut z @ &mut Some(ref a) => {
|
||||
//~^ ERROR pattern bindings are not allowed after an `@`
|
||||
//~| WARN cannot borrow `_` as immutable because it is also borrowed as mutable
|
||||
//~| WARN this error has been downgraded to a warning for backwards compatibility
|
||||
//~| WARN this represents potential undefined behavior in your code and this warning will
|
||||
//~| ERROR cannot borrow `_` as immutable because it is also borrowed as mutable
|
||||
**z = None;
|
||||
println!("{}", *a);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0303]: pattern bindings are not allowed after an `@`
|
||||
LL | ref mut z @ &mut Some(ref a) => {
|
||||
| ^^^^^ not allowed after `@`
|
||||
|
||||
warning[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
|
||||
error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/pattern-bindings-after-at.rs:8:31
|
||||
|
|
||||
LL | ref mut z @ &mut Some(ref a) => {
|
||||
@ -15,12 +15,8 @@ LL | ref mut z @ &mut Some(ref a) => {
|
||||
...
|
||||
LL | **z = None;
|
||||
| ---------- mutable borrow later used here
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0303, E0502.
|
||||
For more information about an error, try `rustc --explain E0303`.
|
||||
|
@ -1,49 +0,0 @@
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:6:17
|
||||
|
|
||||
LL | static B: u32 = A;
|
||||
| ^
|
||||
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:9:18
|
||||
|
|
||||
LL | static C: &u32 = &A;
|
||||
| ^^
|
||||
|
||||
error[E0712]: thread-local variable borrowed past end of function
|
||||
--> $DIR/thread-local-in-ctfe.rs:9:18
|
||||
|
|
||||
LL | static C: &u32 = &A;
|
||||
| ^^- end of enclosing function is here
|
||||
| |
|
||||
| thread-local variables cannot be borrowed beyond the end of the function
|
||||
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:15:16
|
||||
|
|
||||
LL | const D: u32 = A;
|
||||
| ^
|
||||
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:18:17
|
||||
|
|
||||
LL | const E: &u32 = &A;
|
||||
| ^^
|
||||
|
||||
error[E0712]: thread-local variable borrowed past end of function
|
||||
--> $DIR/thread-local-in-ctfe.rs:18:17
|
||||
|
|
||||
LL | const E: &u32 = &A;
|
||||
| ^^- end of enclosing function is here
|
||||
| |
|
||||
| thread-local variables cannot be borrowed beyond the end of the function
|
||||
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:25:5
|
||||
|
|
||||
LL | A
|
||||
| ^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0712`.
|
@ -8,18 +8,14 @@ static B: u32 = A;
|
||||
|
||||
static C: &u32 = &A;
|
||||
//~^ ERROR thread-local statics cannot be accessed at compile-time
|
||||
//~| WARNING thread-local variable borrowed past end of function
|
||||
//~| WARNING this error has been downgraded to a warning
|
||||
//~| WARNING this warning will become a hard error in the future
|
||||
//~| ERROR thread-local variable borrowed past end of function
|
||||
|
||||
const D: u32 = A;
|
||||
//~^ ERROR thread-local statics cannot be accessed at compile-time
|
||||
|
||||
const E: &u32 = &A;
|
||||
//~^ ERROR thread-local statics cannot be accessed at compile-time
|
||||
//~| WARNING thread-local variable borrowed past end of function
|
||||
//~| WARNING this error has been downgraded to a warning
|
||||
//~| WARNING this warning will become a hard error in the future
|
||||
//~| ERROR thread-local variable borrowed past end of function
|
||||
|
||||
const fn f() -> u32 {
|
||||
A
|
||||
|
@ -10,48 +10,40 @@ error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
LL | static C: &u32 = &A;
|
||||
| ^^
|
||||
|
||||
warning[E0712]: thread-local variable borrowed past end of function
|
||||
error[E0712]: thread-local variable borrowed past end of function
|
||||
--> $DIR/thread-local-in-ctfe.rs:9:18
|
||||
|
|
||||
LL | static C: &u32 = &A;
|
||||
| ^^- end of enclosing function is here
|
||||
| |
|
||||
| thread-local variables cannot be borrowed beyond the end of the function
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:15:16
|
||||
--> $DIR/thread-local-in-ctfe.rs:13:16
|
||||
|
|
||||
LL | const D: u32 = A;
|
||||
| ^
|
||||
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:18:17
|
||||
--> $DIR/thread-local-in-ctfe.rs:16:17
|
||||
|
|
||||
LL | const E: &u32 = &A;
|
||||
| ^^
|
||||
|
||||
warning[E0712]: thread-local variable borrowed past end of function
|
||||
--> $DIR/thread-local-in-ctfe.rs:18:17
|
||||
error[E0712]: thread-local variable borrowed past end of function
|
||||
--> $DIR/thread-local-in-ctfe.rs:16:17
|
||||
|
|
||||
LL | const E: &u32 = &A;
|
||||
| ^^- end of enclosing function is here
|
||||
| |
|
||||
| thread-local variables cannot be borrowed beyond the end of the function
|
||||
|
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error[E0625]: thread-local statics cannot be accessed at compile-time
|
||||
--> $DIR/thread-local-in-ctfe.rs:25:5
|
||||
--> $DIR/thread-local-in-ctfe.rs:21:5
|
||||
|
|
||||
LL | A
|
||||
| ^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0712`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user