diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-27 12:12:25 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-27 13:05:49 +0000 |
| commit | b8bfd08999babd4b70822c445eb7b016e1f52fab (patch) | |
| tree | 3b2c422aed9dff1fb224185b3bddf3f0d2463843 | |
| parent | bb90c4bf3593d5edf61f16c37ca9c285af0b47f4 (diff) | |
| download | rust-b8bfd08999babd4b70822c445eb7b016e1f52fab.tar.gz rust-b8bfd08999babd4b70822c445eb7b016e1f52fab.zip | |
Rename `RibKind::ClosureOrAsync` to reflect how it is actually used
| -rw-r--r-- | compiler/rustc_resolve/src/ident.rs | 6 | ||||
| -rw-r--r-- | 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 f2fd4b0bf60..1a50bd5ec98 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 83f9f3a4210..3be962dab90 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); |
