1
Fork 0

Use revisions for NLL in nll

This commit is contained in:
Jack Huey 2022-05-21 13:42:16 -04:00
parent b9f241d407
commit cc97875d26
17 changed files with 48 additions and 41 deletions

View file

@ -1,12 +0,0 @@
error[E0308]: mismatched types
--> $DIR/hrtb-exists-forall-fn.rs:17:34
|
LL | let _: for<'b> fn(&'b u32) = foo();
| ^^^^^ one type is more general than the other
|
= note: expected fn pointer `for<'b> fn(&'b u32)`
found fn pointer `fn(&u32)`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -1,11 +1,11 @@
error[E0601]: `main` function not found in crate `continue_after_missing_main` error[E0601]: `main` function not found in crate `continue_after_missing_main`
--> $DIR/continue-after-missing-main.rs:30:2 --> $DIR/continue-after-missing-main.rs:34:2
| |
LL | } LL | }
| ^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs` | ^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs`
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/continue-after-missing-main.rs:28:56 --> $DIR/continue-after-missing-main.rs:32:56
| |
LL | tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>, LL | tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>,
| ------------------------------------------------------------------ these two types are declared with different lifetimes... | ------------------------------------------------------------------ these two types are declared with different lifetimes...

View file

@ -1,5 +1,5 @@
error[E0601]: `main` function not found in crate `continue_after_missing_main` error[E0601]: `main` function not found in crate `continue_after_missing_main`
--> $DIR/continue-after-missing-main.rs:30:2 --> $DIR/continue-after-missing-main.rs:34:2
| |
LL | } LL | }
| ^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs` | ^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs`

View file

@ -1,3 +1,7 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
#![allow(dead_code)] #![allow(dead_code)]
struct Tableau<'a, MP> { struct Tableau<'a, MP> {
@ -26,5 +30,5 @@ fn create_and_solve_subproblems<'data_provider, 'original_data, MP>(
tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>, tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>,
) { ) {
let _: AdaptedMatrixProvider<'original_data, MP> = tableau.provider().clone_with_extra_bound(); let _: AdaptedMatrixProvider<'original_data, MP> = tableau.provider().clone_with_extra_bound();
//~^ ERROR lifetime mismatch //[base]~^ ERROR lifetime mismatch
} //~ ERROR `main` function not found in crate } //~ ERROR `main` function not found in crate

View file

@ -1,28 +1,28 @@
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/issue-52213.rs:2:11 --> $DIR/issue-52213.rs:6:11
| |
LL | match (&t,) { LL | match (&t,) {
| ^^^^^ | ^^^^^
| |
note: first, the lifetime cannot outlive the lifetime `'a` as defined here... note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/issue-52213.rs:1:23 --> $DIR/issue-52213.rs:5:23
| |
LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
| ^^ | ^^
note: ...so that the types are compatible note: ...so that the types are compatible
--> $DIR/issue-52213.rs:2:11 --> $DIR/issue-52213.rs:6:11
| |
LL | match (&t,) { LL | match (&t,) {
| ^^^^^ | ^^^^^
= note: expected `(&&(T,),)` = note: expected `(&&(T,),)`
found `(&&'a (T,),)` found `(&&'a (T,),)`
note: but, the lifetime must be valid for the lifetime `'b` as defined here... note: but, the lifetime must be valid for the lifetime `'b` as defined here...
--> $DIR/issue-52213.rs:1:27 --> $DIR/issue-52213.rs:5:27
| |
LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
| ^^ | ^^
note: ...so that reference does not outlive borrowed content note: ...so that reference does not outlive borrowed content
--> $DIR/issue-52213.rs:3:20 --> $DIR/issue-52213.rs:8:20
| |
LL | ((u,),) => u, LL | ((u,),) => u,
| ^ | ^

View file

@ -1,11 +1,11 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/issue-52213.rs:3:20 --> $DIR/issue-52213.rs:8:20
| |
LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
| -- -- lifetime `'b` defined here | -- -- lifetime `'b` defined here
| | | |
| lifetime `'a` defined here | lifetime `'a` defined here
LL | match (&t,) { ...
LL | ((u,),) => u, LL | ((u,),) => u,
| ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
| |

View file

@ -1,6 +1,12 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
match (&t,) { //~ ERROR cannot infer an appropriate lifetime match (&t,) {
//[base]~^ ERROR cannot infer an appropriate lifetime
((u,),) => u, ((u,),) => u,
//[nll]~^ ERROR lifetime may not live long enough
} }
} }

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-52533-1.rs:9:18 --> $DIR/issue-52533-1.rs:13:18
| |
LL | gimme(|x, y| y) LL | gimme(|x, y| y)
| ^ lifetime mismatch | ^ lifetime mismatch
@ -7,12 +7,12 @@ LL | gimme(|x, y| y)
= note: expected reference `&Foo<'_, '_, u32>` = note: expected reference `&Foo<'_, '_, u32>`
found reference `&Foo<'_, '_, u32>` found reference `&Foo<'_, '_, u32>`
note: the anonymous lifetime #3 defined here... note: the anonymous lifetime #3 defined here...
--> $DIR/issue-52533-1.rs:9:11 --> $DIR/issue-52533-1.rs:13:11
| |
LL | gimme(|x, y| y) LL | gimme(|x, y| y)
| ^^^^^^^^ | ^^^^^^^^
note: ...does not necessarily outlive the anonymous lifetime #2 defined here note: ...does not necessarily outlive the anonymous lifetime #2 defined here
--> $DIR/issue-52533-1.rs:9:11 --> $DIR/issue-52533-1.rs:13:11
| |
LL | gimme(|x, y| y) LL | gimme(|x, y| y)
| ^^^^^^^^ | ^^^^^^^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/issue-52533-1.rs:9:18 --> $DIR/issue-52533-1.rs:13:18
| |
LL | gimme(|x, y| y) LL | gimme(|x, y| y)
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`

View file

@ -1,3 +1,7 @@
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
#![allow(warnings)] #![allow(warnings)]
struct Foo<'a, 'b, T: 'a + 'b> { x: &'a T, y: &'b T } struct Foo<'a, 'b, T: 'a + 'b> { x: &'a T, y: &'b T }
@ -7,5 +11,6 @@ fn gimme(_: impl for<'a, 'b, 'c> FnOnce(&'a Foo<'a, 'b, u32>,
fn main() { fn main() {
gimme(|x, y| y) gimme(|x, y| y)
//~^ ERROR mismatched types [E0308] //[base]~^ ERROR mismatched types [E0308]
//[nll]~^^ ERROR lifetime may not live long enough
} }

View file

@ -4,11 +4,6 @@
// when buffering lints, which resulted in ICE later on, // when buffering lints, which resulted in ICE later on,
// see #94502. // see #94502.
// Errors with `nll` which is already tested in enough other tests,
// so we ignore it here.
//
// ignore-compare-mode-nll
struct Repro; struct Repro;
impl Repro { impl Repro {
fn get(&self) -> &i32 { fn get(&self) -> &i32 {

View file

@ -1,5 +1,5 @@
error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 --> $DIR/projection-where-clause-env-wrong-bound.rs:19:5
| |
LL | bar::<T::Output>() LL | bar::<T::Output>()
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | bar::<T::Output>()
= help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`... = help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`...
= note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds... = note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds...
note: ...that is required by this bound note: ...that is required by this bound
--> $DIR/projection-where-clause-env-wrong-bound.rs:29:8 --> $DIR/projection-where-clause-env-wrong-bound.rs:33:8
| |
LL | T: 'a, LL | T: 'a,
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 --> $DIR/projection-where-clause-env-wrong-bound.rs:19:5
| |
LL | bar::<T::Output>() LL | bar::<T::Output>()
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
// Test that we are able to establish that `<T as // Test that we are able to establish that `<T as
// MyTrait<'a>>::Output` outlives `'b` here. We need to prove however // MyTrait<'a>>::Output` outlives `'b` here. We need to prove however
// that `<T as MyTrait<'a>>::Output` outlives `'a`, so we also have to // that `<T as MyTrait<'a>>::Output` outlives `'a`, so we also have to

View file

@ -1,5 +1,5 @@
error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 --> $DIR/projection-where-clause-env-wrong-lifetime.rs:18:5
| |
LL | bar::<<T as MyTrait<'a>>::Output>() LL | bar::<<T as MyTrait<'a>>::Output>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | bar::<<T as MyTrait<'a>>::Output>()
= help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`... = help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`...
= note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds... = note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds...
note: ...that is required by this bound note: ...that is required by this bound
--> $DIR/projection-where-clause-env-wrong-lifetime.rs:20:8 --> $DIR/projection-where-clause-env-wrong-lifetime.rs:25:8
| |
LL | T: 'a, LL | T: 'a,
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 --> $DIR/projection-where-clause-env-wrong-lifetime.rs:18:5
| |
LL | bar::<<T as MyTrait<'a>>::Output>() LL | bar::<<T as MyTrait<'a>>::Output>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
// Test that if we need to prove that `<T as MyTrait<'a>>::Output: // Test that if we need to prove that `<T as MyTrait<'a>>::Output:
// 'a`, but we only know that `<T as MyTrait<'b>>::Output: 'a`, that // 'a`, but we only know that `<T as MyTrait<'b>>::Output: 'a`, that
// doesn't suffice. // doesn't suffice.
@ -12,7 +16,8 @@ where
<T as MyTrait<'b>>::Output: 'a, <T as MyTrait<'b>>::Output: 'a,
{ {
bar::<<T as MyTrait<'a>>::Output>() bar::<<T as MyTrait<'a>>::Output>()
//~^ ERROR the associated type `<T as MyTrait<'a>>::Output` may not live long enough //[base]~^ ERROR the associated type `<T as MyTrait<'a>>::Output` may not live long enough
//[nll]~^^ ERROR the associated type `<T as MyTrait<'_>>::Output` may not live long enough
} }
fn bar<'a, T>() -> &'a () fn bar<'a, T>() -> &'a ()