From e93982a78fc7725f4fd01c39b2c48b6a2028893f Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 25 Oct 2022 13:47:43 +0000 Subject: [PATCH] adopt to compiler changes --- compiler/rustc_ast_lowering/src/path.rs | 2 +- .../impl-fn-predefined-lifetimes.rs | 4 ++- .../impl-fn-predefined-lifetimes.stderr | 29 ++++++++++++------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index b7cda13fa4b..c6955741fd4 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -346,7 +346,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn lower_parenthesized_parameter_data( &mut self, data: &ParenthesizedArgs, - itctx: ImplTraitContext, + itctx: &ImplTraitContext, ) -> (GenericArgsCtor<'hir>, bool) { // Switch to `PassThrough` mode for anonymous lifetimes; this // means that we permit things like `&Ref`, where `Ref` has diff --git a/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.rs b/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.rs index 5e2379b2f9a..15778662375 100644 --- a/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.rs +++ b/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.rs @@ -2,8 +2,10 @@ use std::fmt::Debug; fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { - //~^ ERROR hidden type for `impl Debug` captures lifetime that does not appear in bounds + //~^ ERROR cannot resolve opaque type + |x| x + //~^ ERROR concrete type differs from previous defining opaque type use } fn _b<'a>() -> impl Fn(&'a u8) -> (impl Debug + 'a) { diff --git a/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.stderr b/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.stderr index 1247ffad7c3..7747319c153 100644 --- a/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.stderr +++ b/src/test/ui/impl-trait/impl-fn-predefined-lifetimes.stderr @@ -1,15 +1,24 @@ -error[E0700]: hidden type for `impl Debug` captures lifetime that does not appear in bounds +error: concrete type differs from previous defining opaque type use + --> $DIR/impl-fn-predefined-lifetimes.rs:7:9 + | +LL | |x| x + | ^ expected `impl Debug + '_`, got `&u8` + | +note: previous use here + --> $DIR/impl-fn-predefined-lifetimes.rs:7:5 + | +LL | |x| x + | ^^^^^ + +error[E0720]: cannot resolve opaque type --> $DIR/impl-fn-predefined-lifetimes.rs:4:35 | LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { - | ^^^^^^^^^^^^^^^ - | -note: hidden type `&' u8` captures lifetime smaller than the function body - --> $DIR/impl-fn-predefined-lifetimes.rs:4:35 - | -LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ recursive opaque type +... +LL | |x| x + | ----- returning here with type `[closure@$DIR/impl-fn-predefined-lifetimes.rs:7:5: 7:8]` -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0720`.