Skip to content

Commit

Permalink
Auto merge of #60171 - matthewjasper:full-nll-compare-mode, r=pnkfelix
Browse files Browse the repository at this point in the history
Use -Zborrowck=mir for NLL compare mode

closes #56993

r? @pnkfelix
  • Loading branch information
bors committed May 17, 2019
2 parents 3940146 + be5fe05 commit b982867
Show file tree
Hide file tree
Showing 496 changed files with 5,202 additions and 964 deletions.
1 change: 0 additions & 1 deletion src/test/codegen/enum-debug-niche-2.rs
Expand Up @@ -13,7 +13,6 @@
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}}

#![feature(never_type)]
#![feature(nll)]

#[derive(Copy, Clone)]
pub struct Entity {
Expand Down
4 changes: 2 additions & 2 deletions src/test/incremental/hashes/closure_expressions.rs
Expand Up @@ -49,14 +49,14 @@ pub fn add_parameter() {
// Change parameter pattern ----------------------------------------------------
#[cfg(cfail1)]
pub fn change_parameter_pattern() {
let _ = |x: &u32| x;
let _ = |x: (u32,)| x;
}

#[cfg(not(cfail1))]
#[rustc_clean(cfg="cfail2", except="HirBody, mir_built, typeck_tables_of")]
#[rustc_clean(cfg="cfail3")]
pub fn change_parameter_pattern() {
let _ = |&x: &u32| x;
let _ = |(x,): (u32,)| x;
}


Expand Down
2 changes: 0 additions & 2 deletions src/test/mir-opt/remove_fake_borrows.rs
Expand Up @@ -2,8 +2,6 @@

// ignore-wasm32-bare

#![feature(nll)]

fn match_guard(x: Option<&&i32>, c: bool) -> i32 {
match x {
Some(0) if c => 0,
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-fail/issue-51345.rs
@@ -1,7 +1,5 @@
// error-pattern: thread 'main' panicked at 'explicit panic'

#![feature(nll)]

fn main() {
let mut vec = vec![];
vec.push((vec.len(), panic!()));
Expand Down
Expand Up @@ -3,8 +3,6 @@
#![allow(unused_variables)]
// Test case from #39963.

#![feature(nll)]

#[derive(Clone)]
struct Foo(Option<Box<Foo>>, Option<Box<Foo>>);

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs
@@ -1,5 +1,4 @@
// run-pass
#![feature(nll)]
#![deny(unused_mut)]

#[derive(Debug)]
Expand Down
4 changes: 0 additions & 4 deletions src/test/run-pass/borrowck/two-phase-bin-ops.rs
@@ -1,8 +1,4 @@
// run-pass
// revisions: lxl nll

#![cfg_attr(nll, feature(nll))]

use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
use std::ops::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssign};

Expand Down
Expand Up @@ -5,7 +5,6 @@
// See further discussion on rust-lang/rust#24535,
// rust-lang/rfcs#1006, and rust-lang/rfcs#107

#![feature(nll)]
#![feature(bind_by_move_pattern_guards)]

fn main() {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issues/issue-48962.rs
@@ -1,7 +1,6 @@
// run-pass
#![allow(unused_must_use)]
// Test that we are able to reinitialize box with moved referent
#![feature(nll)]
static mut ORDER: [usize; 3] = [0, 0, 0];
static mut INDEX: usize = 0;

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issues/issue-51345.rs
@@ -1,6 +1,5 @@
// run-pass
#![allow(unreachable_code)]
#![feature(nll)]

fn main() {
let mut v = Vec::new();
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/nll/issue-47153-generic-const.rs
Expand Up @@ -3,7 +3,6 @@
// Regression test for #47153: constants in a generic context (such as
// a trait) used to ICE.

#![feature(nll)]
#![allow(warnings)]

trait Foo {
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/nll/issue-47589.rs
@@ -1,7 +1,5 @@
// run-pass

#![feature(nll)]

pub struct DescriptorSet<'a> {
pub slots: Vec<AttachInfo<'a, Resources>>
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/nll/issue-48623-closure.rs
Expand Up @@ -2,8 +2,6 @@
#![allow(path_statements)]
#![allow(dead_code)]

#![feature(nll)]

struct WithDrop;

impl Drop for WithDrop {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/nll/issue-48623-generator.rs
Expand Up @@ -2,7 +2,6 @@
#![allow(path_statements)]
#![allow(dead_code)]

#![feature(nll)]
#![feature(generators, generator_trait)]

struct WithDrop;
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/nll/issue-50343.rs
@@ -1,6 +1,5 @@
// run-pass

#![feature(nll)]
#![deny(unused_mut)]

fn main() {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs
@@ -1,6 +1,5 @@
// run-pass

#![feature(nll)]
#![deny(unused_mut)]

struct Foo {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs
@@ -1,6 +1,5 @@
// run-pass

#![feature(nll)]
#![allow(unused_variables)]

pub trait TryTransform {
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/nll/mutating_references.rs
@@ -1,7 +1,5 @@
// run-pass

#![feature(nll)]

struct List<T> {
value: T,
next: Option<Box<List<T>>>,
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/nll/process_or_insert_default.rs
@@ -1,7 +1,5 @@
// run-pass

#![feature(nll)]

use std::collections::HashMap;

fn process_or_insert_default(map: &mut HashMap<usize, String>, key: usize) {
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/nll/rc-loop.rs
Expand Up @@ -6,8 +6,6 @@
// `x`. The lexical checker makes this very painful. The NLL checker
// does not.

#![feature(nll)]

use std::rc::Rc;

#[derive(Debug, PartialEq, Eq)]
Expand Down
@@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29
|
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'a` must outlive `'b`

error: lifetime may not live long enough
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
|
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'b` must outlive `'a`

error: aborting due to 2 previous errors

@@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/associated-types-subtyping-1.rs:24:12
|
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let a: <T as Trait<'a>>::Type = make_any();
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`

error: lifetime may not live long enough
--> $DIR/associated-types-subtyping-1.rs:35:13
|
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let _c: <T as Trait<'a>>::Type = b;
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`

error: aborting due to 2 previous errors

@@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-contravariant.rs:45:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`

error: lifetime may not live long enough
--> $DIR/project-fn-ret-contravariant.rs:45:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`

error: aborting due to 2 previous errors

@@ -0,0 +1,10 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-contravariant.rs:38:4
|
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: aborting due to previous error

@@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`

error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`

error: aborting due to 2 previous errors

@@ -0,0 +1,24 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:38:12
|
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
LL | let a = bar(f, x);
| ^^^^^^^^^ argument requires that `'a` must outlive `'b`

error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:39:12
|
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | let b = bar(f, y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`

error: aborting due to 2 previous errors

@@ -0,0 +1,11 @@
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:48:4
|
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
| -- lifetime `'a` defined here
...
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: aborting due to previous error

40 changes: 40 additions & 0 deletions src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr
@@ -0,0 +1,40 @@
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`.

0 comments on commit b982867

Please sign in to comment.