Skip to content

Commit b982867

Browse files
committed
Auto merge of #60171 - matthewjasper:full-nll-compare-mode, r=pnkfelix
Use -Zborrowck=mir for NLL compare mode closes #56993 r? @pnkfelix
2 parents 3940146 + be5fe05 commit b982867

File tree

496 files changed

+5202
-964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

496 files changed

+5202
-964
lines changed

src/test/codegen/enum-debug-niche-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}}
1414

1515
#![feature(never_type)]
16-
#![feature(nll)]
1716

1817
#[derive(Copy, Clone)]
1918
pub struct Entity {

src/test/incremental/hashes/closure_expressions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ pub fn add_parameter() {
4949
// Change parameter pattern ----------------------------------------------------
5050
#[cfg(cfail1)]
5151
pub fn change_parameter_pattern() {
52-
let _ = |x: &u32| x;
52+
let _ = |x: (u32,)| x;
5353
}
5454

5555
#[cfg(not(cfail1))]
5656
#[rustc_clean(cfg="cfail2", except="HirBody, mir_built, typeck_tables_of")]
5757
#[rustc_clean(cfg="cfail3")]
5858
pub fn change_parameter_pattern() {
59-
let _ = |&x: &u32| x;
59+
let _ = |(x,): (u32,)| x;
6060
}
6161

6262

src/test/mir-opt/remove_fake_borrows.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// ignore-wasm32-bare
44

5-
#![feature(nll)]
6-
75
fn match_guard(x: Option<&&i32>, c: bool) -> i32 {
86
match x {
97
Some(0) if c => 0,

src/test/run-fail/issue-51345.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// error-pattern: thread 'main' panicked at 'explicit panic'
22

3-
#![feature(nll)]
4-
53
fn main() {
64
let mut vec = vec![];
75
vec.push((vec.len(), panic!()));

src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#![allow(unused_variables)]
44
// Test case from #39963.
55

6-
#![feature(nll)]
7-
86
#[derive(Clone)]
97
struct Foo(Option<Box<Foo>>, Option<Box<Foo>>);
108

src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
#![feature(nll)]
32
#![deny(unused_mut)]
43

54
#[derive(Debug)]

src/test/run-pass/borrowck/two-phase-bin-ops.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
// run-pass
2-
// revisions: lxl nll
3-
4-
#![cfg_attr(nll, feature(nll))]
5-
62
use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
73
use std::ops::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssign};
84

src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// See further discussion on rust-lang/rust#24535,
66
// rust-lang/rfcs#1006, and rust-lang/rfcs#107
77

8-
#![feature(nll)]
98
#![feature(bind_by_move_pattern_guards)]
109

1110
fn main() {

src/test/run-pass/issues/issue-48962.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// run-pass
22
#![allow(unused_must_use)]
33
// Test that we are able to reinitialize box with moved referent
4-
#![feature(nll)]
54
static mut ORDER: [usize; 3] = [0, 0, 0];
65
static mut INDEX: usize = 0;
76

src/test/run-pass/issues/issue-51345.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
#![allow(unreachable_code)]
3-
#![feature(nll)]
43

54
fn main() {
65
let mut v = Vec::new();

src/test/run-pass/nll/issue-47153-generic-const.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Regression test for #47153: constants in a generic context (such as
44
// a trait) used to ICE.
55

6-
#![feature(nll)]
76
#![allow(warnings)]
87

98
trait Foo {

src/test/run-pass/nll/issue-47589.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-pass
22

3-
#![feature(nll)]
4-
53
pub struct DescriptorSet<'a> {
64
pub slots: Vec<AttachInfo<'a, Resources>>
75
}

src/test/run-pass/nll/issue-48623-closure.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#![allow(path_statements)]
33
#![allow(dead_code)]
44

5-
#![feature(nll)]
6-
75
struct WithDrop;
86

97
impl Drop for WithDrop {

src/test/run-pass/nll/issue-48623-generator.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(path_statements)]
33
#![allow(dead_code)]
44

5-
#![feature(nll)]
65
#![feature(generators, generator_trait)]
76

87
struct WithDrop;

src/test/run-pass/nll/issue-50343.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

3-
#![feature(nll)]
43
#![deny(unused_mut)]
54

65
fn main() {

src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

3-
#![feature(nll)]
43
#![deny(unused_mut)]
54

65
struct Foo {

src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

3-
#![feature(nll)]
43
#![allow(unused_variables)]
54

65
pub trait TryTransform {

src/test/run-pass/nll/mutating_references.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-pass
22

3-
#![feature(nll)]
4-
53
struct List<T> {
64
value: T,
75
next: Option<Box<List<T>>>,

src/test/run-pass/nll/process_or_insert_default.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-pass
22

3-
#![feature(nll)]
4-
53
use std::collections::HashMap;
64

75
fn process_or_insert_default(map: &mut HashMap<usize, String>, key: usize) {

src/test/run-pass/nll/rc-loop.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
// `x`. The lexical checker makes this very painful. The NLL checker
77
// does not.
88

9-
#![feature(nll)]
10-
119
use std::rc::Rc;
1210

1311
#[derive(Debug, PartialEq, Eq)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29
3+
|
4+
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
...
9+
LL | let z: I::A = if cond { x } else { y };
10+
| ^ assignment requires that `'a` must outlive `'b`
11+
12+
error: lifetime may not live long enough
13+
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
14+
|
15+
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
16+
| -- -- lifetime `'b` defined here
17+
| |
18+
| lifetime `'a` defined here
19+
...
20+
LL | let z: I::A = if cond { x } else { y };
21+
| ^ assignment requires that `'b` must outlive `'a`
22+
23+
error: aborting due to 2 previous errors
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/associated-types-subtyping-1.rs:24:12
3+
|
4+
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
...
9+
LL | let a: <T as Trait<'a>>::Type = make_any();
10+
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
11+
12+
error: lifetime may not live long enough
13+
--> $DIR/associated-types-subtyping-1.rs:35:13
14+
|
15+
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
16+
| -- -- lifetime `'b` defined here
17+
| |
18+
| lifetime `'a` defined here
19+
...
20+
LL | let _c: <T as Trait<'a>>::Type = b;
21+
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
22+
23+
error: aborting due to 2 previous errors
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/project-fn-ret-contravariant.rs:45:4
3+
|
4+
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
...
9+
LL | (a, b)
10+
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
11+
12+
error: lifetime may not live long enough
13+
--> $DIR/project-fn-ret-contravariant.rs:45:4
14+
|
15+
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
16+
| -- -- lifetime `'b` defined here
17+
| |
18+
| lifetime `'a` defined here
19+
...
20+
LL | (a, b)
21+
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
22+
23+
error: aborting due to 2 previous errors
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/project-fn-ret-contravariant.rs:38:4
3+
|
4+
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
5+
| -- lifetime `'a` defined here
6+
LL | bar(foo, x)
7+
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
8+
9+
error: aborting due to previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/project-fn-ret-invariant.rs:55:4
3+
|
4+
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
...
9+
LL | (a, b)
10+
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
11+
12+
error: lifetime may not live long enough
13+
--> $DIR/project-fn-ret-invariant.rs:55:4
14+
|
15+
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
16+
| -- -- lifetime `'b` defined here
17+
| |
18+
| lifetime `'a` defined here
19+
...
20+
LL | (a, b)
21+
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
22+
23+
error: aborting due to 2 previous errors
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/project-fn-ret-invariant.rs:38:12
3+
|
4+
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
9+
LL | let a = bar(f, x);
10+
| ^^^^^^^^^ argument requires that `'a` must outlive `'b`
11+
12+
error: lifetime may not live long enough
13+
--> $DIR/project-fn-ret-invariant.rs:39:12
14+
|
15+
LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
16+
| -- -- lifetime `'b` defined here
17+
| |
18+
| lifetime `'a` defined here
19+
...
20+
LL | let b = bar(f, y);
21+
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
22+
23+
error: aborting due to 2 previous errors
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/project-fn-ret-invariant.rs:48:4
3+
|
4+
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
5+
| -- lifetime `'a` defined here
6+
...
7+
LL | bar(foo, x)
8+
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
9+
10+
error: aborting due to previous error
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
error[E0503]: cannot use `y` because it was mutably borrowed
2+
--> $DIR/borrowck-anon-fields-variant.rs:17:7
3+
|
4+
LL | Foo::Y(ref mut a, _) => a,
5+
| --------- borrow of `y.0` occurs here
6+
...
7+
LL | Foo::Y(_, ref mut b) => b,
8+
| ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
9+
...
10+
LL | *a += 1;
11+
| ------- borrow later used here
12+
13+
error[E0503]: cannot use `y` because it was mutably borrowed
14+
--> $DIR/borrowck-anon-fields-variant.rs:37:7
15+
|
16+
LL | Foo::Y(ref mut a, _) => a,
17+
| --------- borrow of `y.0` occurs here
18+
...
19+
LL | Foo::Y(ref mut b, _) => b,
20+
| ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
21+
...
22+
LL | *a += 1;
23+
| ------- borrow later used here
24+
25+
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
26+
--> $DIR/borrowck-anon-fields-variant.rs:37:14
27+
|
28+
LL | Foo::Y(ref mut a, _) => a,
29+
| --------- first mutable borrow occurs here
30+
...
31+
LL | Foo::Y(ref mut b, _) => b,
32+
| ^^^^^^^^^ second mutable borrow occurs here
33+
...
34+
LL | *a += 1;
35+
| ------- first borrow later used here
36+
37+
error: aborting due to 3 previous errors
38+
39+
Some errors have detailed explanations: E0499, E0503.
40+
For more information about an error, try `rustc --explain E0499`.

0 commit comments

Comments
 (0)