remove feature(nll) in more cases.

This commit is contained in:
Mazdak Farrokhzad 2019-09-06 16:23:00 +02:00
parent b638aa1f5b
commit 2b80ed99db
33 changed files with 47 additions and 81 deletions

View File

@ -7,8 +7,6 @@
// reaches the panic code when executed, despite the compiler warning
// about that match arm being unreachable.
#![feature(nll)]
fn main() {
let b = &mut true;
match b {

View File

@ -1,5 +1,5 @@
error[E0382]: use of moved value: `b`
--> $DIR/issue-27282-move-match-input-into-guard.rs:18:14
--> $DIR/issue-27282-move-match-input-into-guard.rs:16:14
|
LL | let b = &mut true;
| - move occurs because `b` has type `&mut bool`, which does not implement the `Copy` trait

View File

@ -1,11 +1,6 @@
// Issue 27282: Example 1: This sidesteps the AST checks disallowing
// mutable borrows in match guards by hiding the mutable borrow in a
// guard behind a move (of the ref mut pattern id) within a closure.
//
// This example is not rejected by AST borrowck (and then reliably
// segfaults when executed).
#![feature(nll)]
fn main() {
match Some(&4) {

View File

@ -1,5 +1,5 @@
error[E0507]: cannot move out of `foo` in pattern guard
--> $DIR/issue-27282-move-ref-mut-into-guard.rs:14:19
--> $DIR/issue-27282-move-ref-mut-into-guard.rs:9:19
|
LL | if { (|| { let bar = foo; bar.take() })(); false } => {},
| ^^ ---

View File

@ -9,8 +9,6 @@
// diverges, and therefore a single final fake-read at the very end
// after the final match arm would not suffice.
#![feature(nll)]
struct ForceFnOnce;
fn main() {

View File

@ -1,5 +1,5 @@
error[E0510]: cannot mutably borrow `x` in match guard
--> $DIR/issue-27282-mutate-before-diverging-arm-1.rs:23:14
--> $DIR/issue-27282-mutate-before-diverging-arm-1.rs:21:14
|
LL | match x {
| - value is immutable in match guard

View File

@ -13,8 +13,6 @@
// occurs in the pattern-match itself, and not in the guard
// expression.
#![feature(nll)]
struct ForceFnOnce;
fn main() {

View File

@ -1,5 +1,5 @@
error[E0510]: cannot mutably borrow `x` in match guard
--> $DIR/issue-27282-mutate-before-diverging-arm-2.rs:28:18
--> $DIR/issue-27282-mutate-before-diverging-arm-2.rs:26:18
|
LL | match x {
| - value is immutable in match guard

View File

@ -8,7 +8,7 @@
// This case is interesting because a borrow of **x is untracked, because **x is
// immutable. However, for matches we care that **x refers to the same value
// until we have chosen a match arm.
#![feature(nll)]
struct ForceFnOnce;
fn main() {
let mut x = &mut &Some(&2);

View File

@ -1,5 +1,3 @@
#![feature(nll)]
// test for https://github.com/rust-lang/rust/issues/29723
fn main() {

View File

@ -1,5 +1,5 @@
error[E0382]: use of moved value: `s`
--> $DIR/issue-29723.rs:12:13
--> $DIR/issue-29723.rs:10:13
|
LL | let s = String::new();
| - move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait

View File

@ -1,7 +1,5 @@
// Regression test for issue #45045
#![feature(nll)]
enum Xyz {
A,
B,

View File

@ -1,5 +1,5 @@
error[E0503]: cannot use `e` because it was mutably borrowed
--> $DIR/borrowed-match-issue-45045.rs:15:9
--> $DIR/borrowed-match-issue-45045.rs:13:9
|
LL | let f = &mut e;
| ------ borrow of `e` occurs here

View File

@ -1,7 +1,5 @@
// Test that the 'static bound from the Copy impl is respected. Regression test for #29149.
#![feature(nll)]
#[derive(Clone)] struct Foo<'a>(&'a u32);
impl Copy for Foo<'static> {}

View File

@ -1,5 +1,5 @@
error[E0597]: `s` does not live long enough
--> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:10:17
--> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:8:17
|
LL | let a = Foo(&s);
| ^^ borrowed value does not live long enough

View File

@ -1,5 +1,3 @@
#![feature(nll)]
enum DropOption<T> {
Some(T),
None,

View File

@ -1,5 +1,5 @@
error[E0713]: borrow may still be in use when destructor runs
--> $DIR/enum-drop-access.rs:15:31
--> $DIR/enum-drop-access.rs:13:31
|
LL | fn drop_enum(opt: DropOption<&mut i32>) -> Option<&mut i32> {
| - let's call the lifetime of this reference `'1`
@ -13,7 +13,7 @@ LL | }
| - here, drop of `opt` needs exclusive access to `*opt.0`, because the type `DropOption<&mut i32>` implements the `Drop` trait
error[E0713]: borrow may still be in use when destructor runs
--> $DIR/enum-drop-access.rs:24:36
--> $DIR/enum-drop-access.rs:22:36
|
LL | fn optional_drop_enum(opt: Option<DropOption<&mut i32>>) -> Option<&mut i32> {
| - let's call the lifetime of this reference `'1`

View File

@ -12,8 +12,6 @@
// tests that are meant to continue failing to compile once
// rust-lang/rust#54987 is implemented.
#![feature(nll)]
struct S<Y> {
x: u32,

View File

@ -1,17 +1,17 @@
error[E0381]: assign to part of possibly-uninitialized variable: `s`
--> $DIR/issue-21232-partial-init-and-use.rs:99:5
--> $DIR/issue-21232-partial-init-and-use.rs:97:5
|
LL | s.x = 10; s.y = Box::new(20);
| ^^^^^^^^ use of possibly-uninitialized `s`
error[E0381]: assign to part of possibly-uninitialized variable: `t`
--> $DIR/issue-21232-partial-init-and-use.rs:106:5
--> $DIR/issue-21232-partial-init-and-use.rs:104:5
|
LL | t.0 = 10; t.1 = Box::new(20);
| ^^^^^^^^ use of possibly-uninitialized `t`
error[E0382]: assign to part of moved value: `s`
--> $DIR/issue-21232-partial-init-and-use.rs:113:5
--> $DIR/issue-21232-partial-init-and-use.rs:111:5
|
LL | let mut s: S<B> = S::new(); drop(s);
| ----- - value moved here
@ -21,7 +21,7 @@ LL | s.x = 10; s.y = Box::new(20);
| ^^^^^^^^ value partially assigned here after move
error[E0382]: assign to part of moved value: `t`
--> $DIR/issue-21232-partial-init-and-use.rs:120:5
--> $DIR/issue-21232-partial-init-and-use.rs:118:5
|
LL | let mut t: T = (0, Box::new(0)); drop(t);
| ----- - value moved here
@ -31,19 +31,19 @@ LL | t.0 = 10; t.1 = Box::new(20);
| ^^^^^^^^ value partially assigned here after move
error[E0381]: assign to part of possibly-uninitialized variable: `s`
--> $DIR/issue-21232-partial-init-and-use.rs:127:5
--> $DIR/issue-21232-partial-init-and-use.rs:125:5
|
LL | s.x = 10;
| ^^^^^^^^ use of possibly-uninitialized `s`
error[E0381]: assign to part of possibly-uninitialized variable: `t`
--> $DIR/issue-21232-partial-init-and-use.rs:134:5
--> $DIR/issue-21232-partial-init-and-use.rs:132:5
|
LL | t.0 = 10;
| ^^^^^^^^ use of possibly-uninitialized `t`
error[E0382]: assign to part of moved value: `s`
--> $DIR/issue-21232-partial-init-and-use.rs:141:5
--> $DIR/issue-21232-partial-init-and-use.rs:139:5
|
LL | let mut s: S<B> = S::new(); drop(s);
| ----- - value moved here
@ -53,7 +53,7 @@ LL | s.x = 10;
| ^^^^^^^^ value partially assigned here after move
error[E0382]: assign to part of moved value: `t`
--> $DIR/issue-21232-partial-init-and-use.rs:148:5
--> $DIR/issue-21232-partial-init-and-use.rs:146:5
|
LL | let mut t: T = (0, Box::new(0)); drop(t);
| ----- - value moved here
@ -63,31 +63,31 @@ LL | t.0 = 10;
| ^^^^^^^^ value partially assigned here after move
error[E0381]: assign to part of possibly-uninitialized variable: `s`
--> $DIR/issue-21232-partial-init-and-use.rs:155:5
--> $DIR/issue-21232-partial-init-and-use.rs:153:5
|
LL | s.x = 10;
| ^^^^^^^^ use of possibly-uninitialized `s`
error[E0381]: assign to part of possibly-uninitialized variable: `t`
--> $DIR/issue-21232-partial-init-and-use.rs:162:5
--> $DIR/issue-21232-partial-init-and-use.rs:160:5
|
LL | t.0 = 10;
| ^^^^^^^^ use of possibly-uninitialized `t`
error[E0381]: assign to part of possibly-uninitialized variable: `q`
--> $DIR/issue-21232-partial-init-and-use.rs:178:5
--> $DIR/issue-21232-partial-init-and-use.rs:176:5
|
LL | q.r.f.x = 10; q.r.f.y = Box::new(20);
| ^^^^^^^^^^^^ use of possibly-uninitialized `q.r.f`
error[E0381]: assign to part of possibly-uninitialized variable: `q`
--> $DIR/issue-21232-partial-init-and-use.rs:185:5
--> $DIR/issue-21232-partial-init-and-use.rs:183:5
|
LL | q.r.f.0 = 10; q.r.f.1 = Box::new(20);
| ^^^^^^^^^^^^ use of possibly-uninitialized `q.r.f`
error[E0382]: assign to part of moved value: `q.r`
--> $DIR/issue-21232-partial-init-and-use.rs:192:5
--> $DIR/issue-21232-partial-init-and-use.rs:190:5
|
LL | let mut q: Q<S<B>> = Q::new(S::new()); drop(q.r);
| --- value moved here
@ -97,7 +97,7 @@ LL | q.r.f.x = 10; q.r.f.y = Box::new(20);
= note: move occurs because `q.r` has type `R<S<std::boxed::Box<u32>>>`, which does not implement the `Copy` trait
error[E0382]: assign to part of moved value: `q.r`
--> $DIR/issue-21232-partial-init-and-use.rs:199:5
--> $DIR/issue-21232-partial-init-and-use.rs:197:5
|
LL | let mut q: Q<T> = Q::new((0, Box::new(0))); drop(q.r);
| --- value moved here
@ -107,19 +107,19 @@ LL | q.r.f.0 = 10; q.r.f.1 = Box::new(20);
= note: move occurs because `q.r` has type `R<(u32, std::boxed::Box<u32>)>`, which does not implement the `Copy` trait
error[E0381]: assign to part of possibly-uninitialized variable: `q`
--> $DIR/issue-21232-partial-init-and-use.rs:206:5
--> $DIR/issue-21232-partial-init-and-use.rs:204:5
|
LL | q.r.f.x = 10;
| ^^^^^^^^^^^^ use of possibly-uninitialized `q.r.f`
error[E0381]: assign to part of possibly-uninitialized variable: `q`
--> $DIR/issue-21232-partial-init-and-use.rs:213:5
--> $DIR/issue-21232-partial-init-and-use.rs:211:5
|
LL | q.r.f.0 = 10;
| ^^^^^^^^^^^^ use of possibly-uninitialized `q.r.f`
error[E0382]: assign to part of moved value: `q.r`
--> $DIR/issue-21232-partial-init-and-use.rs:220:5
--> $DIR/issue-21232-partial-init-and-use.rs:218:5
|
LL | let mut q: Q<S<B>> = Q::new(S::new()); drop(q.r);
| --- value moved here
@ -129,7 +129,7 @@ LL | q.r.f.x = 10;
= note: move occurs because `q.r` has type `R<S<std::boxed::Box<u32>>>`, which does not implement the `Copy` trait
error[E0382]: assign to part of moved value: `q.r`
--> $DIR/issue-21232-partial-init-and-use.rs:227:5
--> $DIR/issue-21232-partial-init-and-use.rs:225:5
|
LL | let mut q: Q<T> = Q::new((0, Box::new(0))); drop(q.r);
| --- value moved here
@ -139,19 +139,19 @@ LL | q.r.f.0 = 10;
= note: move occurs because `q.r` has type `R<(u32, std::boxed::Box<u32>)>`, which does not implement the `Copy` trait
error[E0381]: assign to part of possibly-uninitialized variable: `q`
--> $DIR/issue-21232-partial-init-and-use.rs:234:5
--> $DIR/issue-21232-partial-init-and-use.rs:232:5
|
LL | q.r.f.x = 10;
| ^^^^^^^^^^^^ use of possibly-uninitialized `q.r.f`
error[E0381]: assign to part of possibly-uninitialized variable: `q`
--> $DIR/issue-21232-partial-init-and-use.rs:241:5
--> $DIR/issue-21232-partial-init-and-use.rs:239:5
|
LL | q.r.f.0 = 10;
| ^^^^^^^^^^^^ use of possibly-uninitialized `q.r.f`
error[E0382]: assign to part of moved value: `c`
--> $DIR/issue-21232-partial-init-and-use.rs:259:13
--> $DIR/issue-21232-partial-init-and-use.rs:257:13
|
LL | let mut c = (1, "".to_owned());
| ----- move occurs because `c` has type `(i32, std::string::String)`, which does not implement the `Copy` trait
@ -162,7 +162,7 @@ LL | c.0 = 2;
| ^^^^^^^ value partially assigned here after move
error[E0382]: assign to part of moved value: `c`
--> $DIR/issue-21232-partial-init-and-use.rs:269:13
--> $DIR/issue-21232-partial-init-and-use.rs:267:13
|
LL | let mut c = (1, (1, "".to_owned()));
| ----- move occurs because `c` has type `(i32, (i32, std::string::String))`, which does not implement the `Copy` trait
@ -173,7 +173,7 @@ LL | (c.1).0 = 2;
| ^^^^^^^^^^^ value partially assigned here after move
error[E0382]: assign to part of moved value: `c.1`
--> $DIR/issue-21232-partial-init-and-use.rs:277:13
--> $DIR/issue-21232-partial-init-and-use.rs:275:13
|
LL | c2 => {
| -- value moved here

View File

@ -1,7 +1,5 @@
// Regression test for issue #48238
#![feature(nll)]
fn use_val<'a>(val: &'a u8) -> &'a u8 {
val
}

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-48238.rs:11:13
--> $DIR/issue-48238.rs:9:13
|
LL | move || use_val(&orig);
| ------- ^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`

View File

@ -3,8 +3,6 @@
// one of its fields, it is useful to be reminded of the significance
// of the fact that the type implements Drop.
#![feature(nll)]
pub struct S<'a> { url: &'a mut String }
impl<'a> Drop for S<'a> { fn drop(&mut self) { } }

View File

@ -1,5 +1,5 @@
error[E0713]: borrow may still be in use when destructor runs
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:13:5
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:11:5
|
LL | fn finish_1(s: S) -> &mut String {
| - has type `S<'1>`
@ -9,7 +9,7 @@ LL | }
| - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait
error[E0713]: borrow may still be in use when destructor runs
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:18:13
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:16:13
|
LL | fn finish_2(s: S) -> &mut String {
| - has type `S<'1>`
@ -19,7 +19,7 @@ LL | }
| - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait
error[E0713]: borrow may still be in use when destructor runs
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:23:21
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:21:21
|
LL | fn finish_3(s: S) -> &mut String {
| - has type `S<'1>`
@ -29,7 +29,7 @@ LL | }
| - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait
error[E0509]: cannot move out of type `S<'_>`, which implements the `Drop` trait
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:28:13
--> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:26:13
|
LL | let p = s.url; p
| ^^^^^

View File

@ -1,5 +1,3 @@
#![feature(nll)]
fn main() {
let mut v: Vec<()> = Vec::new();
|| &mut v;

View File

@ -1,5 +1,5 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-53040.rs:5:8
--> $DIR/issue-53040.rs:3:8
|
LL | || &mut v;
| - ^^^^^^ returns a reference to a captured variable which escapes the closure body

View File

@ -1,5 +1,3 @@
#![feature(nll)]
struct Archive;
struct ArchiveIterator<'a> {
x: &'a Archive,

View File

@ -1,5 +1,5 @@
error[E0713]: borrow may still be in use when destructor runs
--> $DIR/issue-53773.rs:43:22
--> $DIR/issue-53773.rs:41:22
|
LL | members.push(child.raw);
| ^^^^^^^^^

View File

@ -1,5 +1,4 @@
#![allow(unused)]
#![feature(nll)]
// ignore-tidy-linelength

View File

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `r.r2_union.f3_union` (via `r.r2_union.f3_union.s2_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f3_union.s1_leaf.l1_u8`)
--> $DIR/issue-57100.rs:44:20
--> $DIR/issue-57100.rs:43:20
|
LL | let mref = &mut r.r2_union.f3_union.s1_leaf.l1_u8;
| -------------------------------------- mutable borrow occurs here (via `r.r2_union.f3_union.s1_leaf.l1_u8`)
@ -13,7 +13,7 @@ LL | println!("{} {}", mref, nref)
= note: `r.r2_union.f3_union.s2_leaf.l1_u8` is a field of the union `Second`, so it overlaps the field `r.r2_union.f3_union.s1_leaf.l1_u8`
error[E0502]: cannot borrow `r.r2_union` (via `r.r2_union.f1_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f2_leaf.l1_u8`)
--> $DIR/issue-57100.rs:62:20
--> $DIR/issue-57100.rs:61:20
|
LL | let mref = &mut r.r2_union.f2_leaf.l1_u8;
| ----------------------------- mutable borrow occurs here (via `r.r2_union.f2_leaf.l1_u8`)

View File

@ -1,5 +1,3 @@
#![feature(nll)]
// Here is arielb1's basic example from rust-lang/rust#27282
// that AST borrowck is flummoxed by:

View File

@ -1,5 +1,5 @@
error[E0507]: cannot move out of `foo` in pattern guard
--> $DIR/match-guards-always-borrow.rs:10:14
--> $DIR/match-guards-always-borrow.rs:8:14
|
LL | (|| { let bar = foo; bar.take() })();
| ^^ ---

View File

@ -5,8 +5,6 @@
// Test that we don't allow mutating the value being matched on in a way that
// changes which patterns it matches, until we have chosen an arm.
#![feature(nll)]
struct A(i32, i32);
fn struct_example(mut a: A) {

View File

@ -1,5 +1,5 @@
error[E0503]: cannot use `e` because it was mutably borrowed
--> $DIR/match-on-borrowed.rs:51:9
--> $DIR/match-on-borrowed.rs:49:9
|
LL | E::V(ref mut x, _) => x,
| --------- borrow of `e.0` occurs here
@ -11,7 +11,7 @@ LL | x;
| - borrow later used here
error[E0503]: cannot use `*f` because it was mutably borrowed
--> $DIR/match-on-borrowed.rs:64:9
--> $DIR/match-on-borrowed.rs:62:9
|
LL | E::V(ref mut x, _) => x,
| --------- borrow of `f.0` occurs here
@ -23,7 +23,7 @@ LL | x;
| - borrow later used here
error[E0503]: cannot use `t` because it was mutably borrowed
--> $DIR/match-on-borrowed.rs:82:9
--> $DIR/match-on-borrowed.rs:80:9
|
LL | let x = &mut t;
| ------ borrow of `t` occurs here
@ -35,7 +35,7 @@ LL | x;
| - borrow later used here
error[E0381]: use of possibly-uninitialized variable: `n`
--> $DIR/match-on-borrowed.rs:92:11
--> $DIR/match-on-borrowed.rs:90:11
|
LL | match n {}
| ^ use of possibly-uninitialized `n`