From 707d2ebb5be0512271ee7c2039d29d6f2c0e2f0e Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sat, 21 May 2022 12:59:02 -0400 Subject: [PATCH] Use revisions for NLL (consistently) in higher-ranked-trait-bounds --- ...e-59311.stderr => issue-59311.base.stderr} | 4 ++-- .../issue-59311.nll.stderr | 6 ++--- .../higher-rank-trait-bounds/issue-59311.rs | 9 ++++++- .../issue-71955.base.stderr | 20 ++++++++++++++++ .../issue-71955.nll.stderr | 24 +++++++++---------- .../normalize-under-binder/issue-71955.rs | 13 ++++------ 6 files changed, 49 insertions(+), 27 deletions(-) rename src/test/ui/higher-rank-trait-bounds/{issue-59311.stderr => issue-59311.base.stderr} (85%) create mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.base.stderr diff --git a/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr b/src/test/ui/higher-rank-trait-bounds/issue-59311.base.stderr similarity index 85% rename from src/test/ui/higher-rank-trait-bounds/issue-59311.stderr rename to src/test/ui/higher-rank-trait-bounds/issue-59311.base.stderr index 3dd05bba5c0..ec576ee529a 100644 --- a/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr +++ b/src/test/ui/higher-rank-trait-bounds/issue-59311.base.stderr @@ -1,11 +1,11 @@ error[E0477]: the type `&'a V` does not fulfill the required lifetime - --> $DIR/issue-59311.rs:17:5 + --> $DIR/issue-59311.rs:21:5 | LL | v.t(|| {}); | ^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/issue-59311.rs:15:24 + --> $DIR/issue-59311.rs:19:24 | LL | for<'a> &'a V: T + 'static, | ^^^^^^^ diff --git a/src/test/ui/higher-rank-trait-bounds/issue-59311.nll.stderr b/src/test/ui/higher-rank-trait-bounds/issue-59311.nll.stderr index 15e83ab5a34..7f98cefdf01 100644 --- a/src/test/ui/higher-rank-trait-bounds/issue-59311.nll.stderr +++ b/src/test/ui/higher-rank-trait-bounds/issue-59311.nll.stderr @@ -1,13 +1,13 @@ error: higher-ranked lifetime error - --> $DIR/issue-59311.rs:17:5 + --> $DIR/issue-59311.rs:21:5 | LL | v.t(|| {}); | ^^^^^^^^^^ | - = note: could not prove [closure@$DIR/issue-59311.rs:17:9: 17:14] well-formed + = note: could not prove [closure@$DIR/issue-59311.rs:21:9: 21:14] well-formed error: higher-ranked lifetime error - --> $DIR/issue-59311.rs:17:9 + --> $DIR/issue-59311.rs:21:9 | LL | v.t(|| {}); | ^^^^^ diff --git a/src/test/ui/higher-rank-trait-bounds/issue-59311.rs b/src/test/ui/higher-rank-trait-bounds/issue-59311.rs index 69708577285..a63c5754f8f 100644 --- a/src/test/ui/higher-rank-trait-bounds/issue-59311.rs +++ b/src/test/ui/higher-rank-trait-bounds/issue-59311.rs @@ -6,6 +6,10 @@ // an error, but the regression test is here to ensure // that it does not ICE. See discussion on #74889 for details. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + pub trait T { fn t(&self, _: F) {} } @@ -14,7 +18,10 @@ pub fn crash(v: &V) where for<'a> &'a V: T + 'static, { - v.t(|| {}); //~ ERROR: `&'a V` does not fulfill the required lifetime + v.t(|| {}); + //[base]~^ ERROR: `&'a V` does not fulfill the required lifetime + //[nll]~^^ ERROR: higher-ranked lifetime error + //[nll]~| ERROR: higher-ranked lifetime error } fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.base.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.base.stderr new file mode 100644 index 00000000000..c24afdd418b --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.base.stderr @@ -0,0 +1,20 @@ +error: implementation of `Parser` is not general enough + --> $DIR/issue-71955.rs:49:5 + | +LL | foo(bar, "string", |s| s.len() == 5); + | ^^^ implementation of `Parser` is not general enough + | + = note: `for<'a> fn(&'a str) -> (&'a str, &'a str) {bar}` must implement `Parser<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` + +error: implementation of `Parser` is not general enough + --> $DIR/issue-71955.rs:53:5 + | +LL | foo(baz, "string", |s| s.0.len() == 5); + | ^^^ implementation of `Parser` is not general enough + | + = note: `for<'a> fn(&'a str) -> (&'a str, Wrapper<'a>) {baz}` must implement `Parser<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr index 0f38f8e3283..9d3cd4dee53 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-71955.rs:54:5 + --> $DIR/issue-71955.rs:49:5 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -7,18 +7,18 @@ LL | foo(bar, "string", |s| s.len() == 5); = note: expected type `for<'r, 's> FnOnce<(&'r &'s str,)>` found type `for<'r> FnOnce<(&'r &str,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:54:24 + --> $DIR/issue-71955.rs:49:24 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:9 + --> $DIR/issue-71955.rs:29:9 | LL | F2: FnOnce(&::Output) -> bool | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/issue-71955.rs:54:5 + --> $DIR/issue-71955.rs:49:5 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -26,18 +26,18 @@ LL | foo(bar, "string", |s| s.len() == 5); = note: expected type `FnOnce<(&&str,)>` found type `for<'r> FnOnce<(&'r &str,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:54:24 + --> $DIR/issue-71955.rs:49:24 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:44 + --> $DIR/issue-71955.rs:29:44 | LL | F2: FnOnce(&::Output) -> bool | ^^^^ error[E0308]: mismatched types - --> $DIR/issue-71955.rs:58:5 + --> $DIR/issue-71955.rs:53:5 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -45,18 +45,18 @@ LL | foo(baz, "string", |s| s.0.len() == 5); = note: expected type `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>` found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:58:24 + --> $DIR/issue-71955.rs:53:24 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:9 + --> $DIR/issue-71955.rs:29:9 | LL | F2: FnOnce(&::Output) -> bool | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/issue-71955.rs:58:5 + --> $DIR/issue-71955.rs:53:5 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -64,12 +64,12 @@ LL | foo(baz, "string", |s| s.0.len() == 5); = note: expected type `FnOnce<(&Wrapper<'_>,)>` found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:58:24 + --> $DIR/issue-71955.rs:53:24 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:44 + --> $DIR/issue-71955.rs:29:44 | LL | F2: FnOnce(&::Output) -> bool | ^^^^ diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs index 4b7e207b96d..8d283afd09d 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs @@ -1,13 +1,8 @@ // ignore-compare-mode-nll -// revisions: migrate nll +// revisions: base nll // [nll]compile-flags: -Zborrowck=mir + // check-fail - -// Since we are testing nll (and migration) explicitly as a separate -// revisions, don't worry about the --compare-mode=nll on this test. - -// ignore-compare-mode-nll - #![feature(rustc_attrs)] trait Parser<'s> { @@ -52,11 +47,11 @@ fn main() { } foo(bar, "string", |s| s.len() == 5); - //[migrate]~^ ERROR implementation of `Parser` is not general enough + //[base]~^ ERROR implementation of `Parser` is not general enough //[nll]~^^ ERROR mismatched types //[nll]~| ERROR mismatched types foo(baz, "string", |s| s.0.len() == 5); - //[migrate]~^ ERROR implementation of `Parser` is not general enough + //[base]~^ ERROR implementation of `Parser` is not general enough //[nll]~^^ ERROR mismatched types //[nll]~| ERROR mismatched types }