From b8bfd08999babd4b70822c445eb7b016e1f52fab Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 27 Oct 2023 12:12:25 +0000 Subject: [PATCH] Rename `RibKind::ClosureOrAsync` to reflect how it is actually used --- compiler/rustc_resolve/src/ident.rs | 6 +++--- compiler/rustc_resolve/src/late.rs | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index f2fd4b0bf60c4..1a50bd5ec9865 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -1083,7 +1083,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { for rib in ribs { match rib.kind { RibKind::Normal - | RibKind::ClosureOrAsync + | RibKind::FnOrCoroutine | RibKind::Module(..) | RibKind::MacroDefinition(..) | RibKind::ForwardGenericParamBan => { @@ -1156,7 +1156,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { for rib in ribs { let has_generic_params: HasGenericParams = match rib.kind { RibKind::Normal - | RibKind::ClosureOrAsync + | RibKind::FnOrCoroutine | RibKind::Module(..) | RibKind::MacroDefinition(..) | RibKind::InlineAsmSym @@ -1240,7 +1240,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { for rib in ribs { let has_generic_params = match rib.kind { RibKind::Normal - | RibKind::ClosureOrAsync + | RibKind::FnOrCoroutine | RibKind::Module(..) | RibKind::MacroDefinition(..) | RibKind::InlineAsmSym diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 83f9f3a4210b8..3be962dab90b9 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -177,8 +177,8 @@ pub(crate) enum RibKind<'a> { /// upvars). AssocItem, - /// We passed through a closure. Disallow labels. - ClosureOrAsync, + /// We passed through a function, closure or coroutine signature. Disallow labels. + FnOrCoroutine, /// We passed through an item scope. Disallow upvars. Item(HasGenericParams), @@ -215,7 +215,7 @@ impl RibKind<'_> { pub(crate) fn contains_params(&self) -> bool { match self { RibKind::Normal - | RibKind::ClosureOrAsync + | RibKind::FnOrCoroutine | RibKind::ConstantItem(..) | RibKind::Module(_) | RibKind::MacroDefinition(_) @@ -231,7 +231,7 @@ impl RibKind<'_> { RibKind::Normal | RibKind::MacroDefinition(..) => false, RibKind::AssocItem - | RibKind::ClosureOrAsync + | RibKind::FnOrCoroutine | RibKind::Item(..) | RibKind::ConstantItem(..) | RibKind::Module(..) @@ -924,9 +924,9 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, debug!("(resolving function) entering function"); // Create a value rib for the function. - self.with_rib(ValueNS, RibKind::ClosureOrAsync, |this| { + self.with_rib(ValueNS, RibKind::FnOrCoroutine, |this| { // Create a label rib for the function. - this.with_label_rib(RibKind::ClosureOrAsync, |this| { + this.with_label_rib(RibKind::FnOrCoroutine, |this| { match fn_kind { FnKind::Fn(_, _, sig, _, generics, body) => { this.visit_generics(generics); @@ -4287,7 +4287,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { .. }) => { self.with_rib(ValueNS, RibKind::Normal, |this| { - this.with_label_rib(RibKind::ClosureOrAsync, |this| { + this.with_label_rib(RibKind::FnOrCoroutine, |this| { // Resolve arguments: this.resolve_params(&fn_decl.inputs); // No need to resolve return type -- @@ -4304,7 +4304,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { }) }); } - // For closures, ClosureOrAsyncRibKind is added in visit_fn + // For closures, RibKind::FnOrCoroutine is added in visit_fn ExprKind::Closure(box ast::Closure { binder: ClosureBinder::For { ref generic_params, span }, .. @@ -4322,7 +4322,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { } ExprKind::Closure(..) => visit::walk_expr(self, expr), ExprKind::Gen(..) => { - self.with_label_rib(RibKind::ClosureOrAsync, |this| visit::walk_expr(this, expr)); + self.with_label_rib(RibKind::FnOrCoroutine, |this| visit::walk_expr(this, expr)); } ExprKind::Repeat(ref elem, ref ct) => { self.visit_expr(elem);