Skip to content

Commit

Permalink
Rename RibKind::ClosureOrAsync to reflect how it is actually used
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 27, 2023
1 parent bb90c4b commit b8bfd08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_resolve/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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(_)
Expand All @@ -231,7 +231,7 @@ impl RibKind<'_> {
RibKind::Normal | RibKind::MacroDefinition(..) => false,

RibKind::AssocItem
| RibKind::ClosureOrAsync
| RibKind::FnOrCoroutine
| RibKind::Item(..)
| RibKind::ConstantItem(..)
| RibKind::Module(..)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 --
Expand All @@ -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 },
..
Expand All @@ -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);
Expand Down

0 comments on commit b8bfd08

Please sign in to comment.