diff options
Diffstat (limited to 'tests')
23 files changed, 97 insertions, 81 deletions
diff --git a/tests/ui/async-await/async-borrowck-escaping-block-error.stderr b/tests/ui/async-await/async-borrowck-escaping-block-error.stderr index 8410e7eca57..6ea03c99aa0 100644 --- a/tests/ui/async-await/async-borrowck-escaping-block-error.stderr +++ b/tests/ui/async-await/async-borrowck-escaping-block-error.stderr @@ -6,11 +6,7 @@ LL | Box::new(async { x } ) | | | may outlive borrowed value `x` | -note: async block is returned here - --> $DIR/async-borrowck-escaping-block-error.rs:6:5 - | -LL | Box::new(async { x } ) - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: async blocks are not executed immediately and must either take a reference or ownership of outside variables they use help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword | LL | Box::new(async move { x } ) diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs index c7a37a81848..123e23d6107 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs @@ -5,12 +5,12 @@ struct Point { x: i32, y: i32, } -fn foo () -> impl FnMut()->() { +fn foo () -> impl FnMut() { let mut p = Point {x: 1, y: 2 }; let mut c = || { - //~^ ERROR closure may outlive the current function, but it borrows `p` - p.x+=5; + p.x += 5; println!("{:?}", p); + //~^ ERROR `p` does not live long enough }; c } diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr index d47f0539b84..96910375e09 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr @@ -1,22 +1,23 @@ -error[E0373]: closure may outlive the current function, but it borrows `p`, which is owned by the current function - --> $DIR/borrowck-4.rs:10:17 +error[E0597]: `p` does not live long enough + --> $DIR/borrowck-4.rs:12:25 | -LL | let mut c = || { - | ^^ may outlive borrowed value `p` -... -LL | println!("{:?}", p); - | - `p` is borrowed here - | -note: closure is returned here - --> $DIR/borrowck-4.rs:15:5 - | -LL | c - | ^ -help: to force the closure to take ownership of `p` (and any other referenced variables), use the `move` keyword - | -LL | let mut c = move || { - | ++++ +LL | let mut p = Point {x: 1, y: 2 }; + | ----- binding `p` declared here +LL | let mut c = || { + | -- + | | + | _________________value captured here + | | +LL | | p.x += 5; +LL | | println!("{:?}", p); + | | ^ borrowed value does not live long enough +LL | | +LL | | }; + | |_____- assignment requires that `p` is borrowed for `'static` +LL | c +LL | } + | - `p` dropped here while still borrowed error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/impl-trait/does-not-live-long-enough.stderr b/tests/ui/impl-trait/does-not-live-long-enough.stderr index cfc13298071..9f3918ce3e0 100644 --- a/tests/ui/impl-trait/does-not-live-long-enough.stderr +++ b/tests/ui/impl-trait/does-not-live-long-enough.stderr @@ -1,12 +1,14 @@ error[E0373]: closure may outlive the current function, but it borrows `prefix`, which is owned by the current function --> $DIR/does-not-live-long-enough.rs:6:33 | +LL | fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> { + | -- lifetime `'a` defined here LL | self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref()) | ^^^ ------ `prefix` is borrowed here | | | may outlive borrowed value `prefix` | -note: closure is returned here +note: function requires argument type to outlive `'a` --> $DIR/does-not-live-long-enough.rs:6:9 | LL | self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref()) diff --git a/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs b/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs index 3aa52fe2644..e9af42b30e9 100644 --- a/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs +++ b/tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs @@ -1,5 +1,7 @@ //@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver trait Id { type This; diff --git a/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs b/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs index 6860fc5e6a5..878b8746bfa 100644 --- a/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs +++ b/tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs @@ -1,7 +1,9 @@ // Nested impl-traits can impose different member constraints on the same region variable. //@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver trait Cap<'a> {} impl<T> Cap<'_> for T {} diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.rs b/tests/ui/impl-trait/nested-rpit-hrtb.rs index 11d79bcff73..f4ff13d6c20 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.rs +++ b/tests/ui/impl-trait/nested-rpit-hrtb.rs @@ -48,6 +48,7 @@ fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = im // This should resolve. fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {} //~^ ERROR implementation of `Bar` is not general enough +//~| ERROR lifetime may not live long enough // This should resolve. fn two_htrb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Qux<'b>> {} diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.stderr b/tests/ui/impl-trait/nested-rpit-hrtb.stderr index 2e95ef370c7..93cd7bd788f 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.stderr +++ b/tests/ui/impl-trait/nested-rpit-hrtb.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/nested-rpit-hrtb.rs:56:77 + --> $DIR/nested-rpit-hrtb.rs:57:77 | LL | fn two_htrb_outlives() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Sized + 'b> {} | ^^ undeclared lifetime @@ -15,7 +15,7 @@ LL | fn two_htrb_outlives<'b>() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Siz | ++++ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/nested-rpit-hrtb.rs:64:82 + --> $DIR/nested-rpit-hrtb.rs:65:82 | LL | fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {} | ^^ undeclared lifetime @@ -87,6 +87,12 @@ LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc but trait `Qux<'_>` is implemented for `()` = help: for that trait implementation, expected `()`, found `&'a ()` +error: lifetime may not live long enough + --> $DIR/nested-rpit-hrtb.rs:49:93 + | +LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {} + | -- lifetime `'b` defined here ^^ opaque type requires that `'b` must outlive `'static` + error: implementation of `Bar` is not general enough --> $DIR/nested-rpit-hrtb.rs:49:93 | @@ -97,7 +103,7 @@ LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = = note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0` error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied - --> $DIR/nested-rpit-hrtb.rs:60:64 + --> $DIR/nested-rpit-hrtb.rs:61:64 | LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {} | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()` @@ -106,7 +112,7 @@ LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> but trait `Qux<'_>` is implemented for `()` = help: for that trait implementation, expected `()`, found `&'a ()` -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0261, E0277, E0657. For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/impl-trait/no-anonymize-regions.rs b/tests/ui/impl-trait/no-anonymize-regions.rs index 4f7f7c0641c..a89c9e05a34 100644 --- a/tests/ui/impl-trait/no-anonymize-regions.rs +++ b/tests/ui/impl-trait/no-anonymize-regions.rs @@ -1,5 +1,7 @@ //@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver // A regression test for an error in `redis` while working on #139587. // diff --git a/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr b/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr index 08c8365b180..96e242d5d48 100644 --- a/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr +++ b/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr @@ -1,12 +1,8 @@ -error[E0792]: expected generic lifetime parameter, found `'_` +error: non-defining use of `impl Sized + '_` in the defining scope --> $DIR/as-projection-term.rs:14:19 | -LL | fn recur<'a>() -> impl Sized + 'a { - | -- this generic parameter must be used with a generic lifetime parameter -... LL | prove_proj(|| recur()); | ^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs b/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs index 4c5adc7a00a..f0cf333b6a1 100644 --- a/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs +++ b/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs @@ -12,6 +12,6 @@ fn recur<'a>() -> impl Sized + 'a { // inference variable at this point, we unify it with `opaque<'1>` and // end up ignoring that defining use as the hidden type is equal to its key. prove_proj(|| recur()); - //[next]~^ ERROR expected generic lifetime parameter, found `'_` + //[next]~^ ERROR non-defining use of `impl Sized + '_` in the defining scope } fn main() {} diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs index 80a4ab35527..5fa13152653 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.rs @@ -31,6 +31,7 @@ mod capture_tait { #[define_opaque(Opq2)] fn test() -> Opq2 {} //~^ ERROR hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds + //~| ERROR expected generic lifetime parameter, found `'a` } mod capture_tait_complex_pass { @@ -52,7 +53,8 @@ mod capture_tait_complex_fail { type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; #[define_opaque(Opq2)] fn test() -> Opq2 {} - //~^ ERROR hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'a` + //~| ERROR expected generic lifetime parameter, found `'a` } // non-defining use because 'static is used. diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr index 665b9a91696..8e2c02f15c5 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr @@ -16,6 +16,15 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {} | | opaque type defined here | hidden type `&'a ()` captures the lifetime `'a` as defined here +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:32:23 + | +LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | fn test() -> Opq2 {} + | ^^ + error[E0700]: hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds --> $DIR/higher-ranked-regions-basic.rs:32:23 | @@ -28,7 +37,7 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:42:23 + --> $DIR/higher-ranked-regions-basic.rs:43:23 | LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b | -- this generic parameter must be used with a generic lifetime parameter @@ -37,7 +46,7 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'b` - --> $DIR/higher-ranked-regions-basic.rs:42:23 + --> $DIR/higher-ranked-regions-basic.rs:43:23 | LL | type Opq0<'a> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -45,19 +54,26 @@ LL | type Opq0<'a> = impl Sized; LL | fn test() -> Opq2 {} | ^^ -error[E0700]: hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds - --> $DIR/higher-ranked-regions-basic.rs:54:23 +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:55:23 | -LL | type Opq0<'a> = impl Sized; - | ---------- opaque type defined here LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a - | -- hidden type `&'b ()` captures the lifetime `'b` as defined here + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | fn test() -> Opq2 {} + | ^^ + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/higher-ranked-regions-basic.rs:55:23 + | +LL | type Opq0<'a> = impl Sized; + | -- this generic parameter must be used with a generic lifetime parameter ... LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:63:65 + --> $DIR/higher-ranked-regions-basic.rs:65:65 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -66,7 +82,7 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:72:60 + --> $DIR/higher-ranked-regions-basic.rs:74:60 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -75,7 +91,7 @@ LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:82:23 + --> $DIR/higher-ranked-regions-basic.rs:84:23 | LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; | -- this generic parameter must be used with a generic lifetime parameter @@ -84,7 +100,7 @@ LL | fn test() -> Opq2 {} | ^^ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:82:23 + --> $DIR/higher-ranked-regions-basic.rs:84:23 | LL | type Opq0<'a, 'b> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter @@ -92,7 +108,7 @@ LL | type Opq0<'a, 'b> = impl Sized; LL | fn test() -> Opq2 {} | ^^ -error: aborting due to 10 previous errors +error: aborting due to 12 previous errors Some errors have detailed explanations: E0700, E0792. For more information about an error, try `rustc --explain E0700`. diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs index c24672816ac..eb9b376686a 100644 --- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs +++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs @@ -18,7 +18,7 @@ mod bav { impl Bar for i32 {} fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> { - val.use_self() //~ ERROR cannot return value referencing function parameter + val.use_self() //~ ERROR cannot return value referencing function parameter `val` } } diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index 3a1f685f16b..9a3cfa9987a 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap<std::slice::Iter<'static, i32>, {closure@$DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:9:21: 9:24}>` captures lifetime `'_` + = note: hidden type `FilterMap<std::slice::Iter<'_, i32>, {closure@$DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:9:21: 9:24}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs index 902d6ca57e6..5c6ad2cc725 100644 --- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs +++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.rs @@ -8,7 +8,7 @@ fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> { Some(a) } else { None::<Opaque<'static>> - //~^ ERROR hidden type for `Opaque<'static>` captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'static` } } diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr index 562ab4168b5..2cb8f03235a 100644 --- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr +++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr @@ -1,15 +1,12 @@ -error[E0700]: hidden type for `Opaque<'static>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'static` --> $DIR/different_args_considered_equal2.rs:10:9 | LL | pub type Opaque<'a> = impl Sized; - | ---------- opaque type defined here -... -LL | fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> { - | -- hidden type `*mut &'a str` captures the lifetime `'a` as defined here + | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type ... LL | None::<Opaque<'static>> | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr index 4a5360c9922..43e887f36c5 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr @@ -1,15 +1,12 @@ -error[E0700]: hidden type for `Opaque<'x>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/generic-not-strictly-equal.rs:34:5 | LL | type Opaque<'a> = impl Copy + Captures<'a>; - | ------------------------ opaque type defined here -... -LL | fn test<'x>(_: Opaque<'x>) { - | -- hidden type `&'x u8` captures the lifetime `'x` as defined here + | -- this generic parameter must be used with a generic lifetime parameter ... LL | relate(opaque, hidden); // defining use: Opaque<'?1> := u8 | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs index c1059e3da33..42f363d0e57 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs @@ -32,8 +32,7 @@ fn test<'x>(_: Opaque<'x>) { ensure_outlives::<'x>(opaque); // outlives constraint: '?1: 'x relate(opaque, hidden); // defining use: Opaque<'?1> := u8 - //[basic]~^ ERROR expected generic lifetime parameter, found `'_` - //[member_constraints]~^^ ERROR captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'_` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs index baeba1d3de6..013651e8775 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.rs @@ -9,7 +9,7 @@ impl Foo for () { type Assoc<'a, 'b> = impl Sized; fn bar<'a: 'a, 'b: 'b>(x: &'a ()) -> Self::Assoc<'a, 'b> { let closure = |x: &'a ()| -> Self::Assoc<'b, 'a> { x }; - //~^ ERROR `<() as Foo>::Assoc<'b, 'a>` captures lifetime that does not appear in bounds + //~^ ERROR expected generic lifetime parameter, found `'_` x } } diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr index a7d3e7f0be4..f399520e7fd 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr @@ -1,13 +1,12 @@ -error[E0700]: hidden type for `<() as Foo>::Assoc<'b, 'a>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/in-assoc-ty-early-bound.rs:11:60 | LL | type Assoc<'a, 'b> = impl Sized; - | ---------- opaque type defined here + | -- this generic parameter must be used with a generic lifetime parameter LL | fn bar<'a: 'a, 'b: 'b>(x: &'a ()) -> Self::Assoc<'a, 'b> { - | -- hidden type `&'a ()` captures the lifetime `'a` as defined here LL | let closure = |x: &'a ()| -> Self::Assoc<'b, 'a> { x }; | ^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs index 92c8a8f3216..21df53c43d7 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs @@ -13,7 +13,7 @@ impl Foo for () { { let _ = |x: &'a ()| { let _: Self::Assoc<'a> = x; - //~^ ERROR `<() as Foo>::Assoc<'a>` captures lifetime that does not appear in bound + //~^ ERROR expected generic lifetime parameter, found `'_` }; } } diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr index 7ce4517fb1e..aaed03e739b 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr @@ -1,14 +1,12 @@ -error[E0700]: hidden type for `<() as Foo>::Assoc<'a>` captures lifetime that does not appear in bounds +error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/in-assoc-ty-early-bound2.rs:15:20 | LL | type Assoc<'a> = impl Sized; - | ---------- opaque type defined here -LL | fn bar<'a: 'a>() - | -- hidden type `&'a ()` captures the lifetime `'a` as defined here + | -- this generic parameter must be used with a generic lifetime parameter ... LL | let _: Self::Assoc<'a> = x; | ^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0792`. |
