Rename RibKind::ClosureOrAsync to reflect how it is actually used

This commit is contained in:
Oli Scherer 2023-10-27 12:12:25 +00:00
parent bb90c4bf35
commit b8bfd08999
2 changed files with 12 additions and 12 deletions

View File

@ -1083,7 +1083,7 @@ fn validate_res_from_ribs(
for rib in ribs {
match rib.kind {
RibKind::Normal
| RibKind::ClosureOrAsync
| RibKind::FnOrCoroutine
| RibKind::Module(..)
| RibKind::MacroDefinition(..)
| RibKind::ForwardGenericParamBan => {
@ -1156,7 +1156,7 @@ fn validate_res_from_ribs(
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 @@ fn validate_res_from_ribs(
for rib in ribs {
let has_generic_params = match rib.kind {
RibKind::Normal
| RibKind::ClosureOrAsync
| RibKind::FnOrCoroutine
| RibKind::Module(..)
| RibKind::MacroDefinition(..)
| RibKind::InlineAsmSym

View File

@ -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 @@ fn is_label_barrier(self) -> bool {
RibKind::Normal | RibKind::MacroDefinition(..) => false,
RibKind::AssocItem
| RibKind::ClosureOrAsync
| RibKind::FnOrCoroutine
| RibKind::Item(..)
| RibKind::ConstantItem(..)
| RibKind::Module(..)
@ -924,9 +924,9 @@ fn visit_fn(&mut self, fn_kind: FnKind<'ast>, sp: Span, fn_id: NodeId) {
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 @@ fn resolve_expr(&mut self, expr: &'ast Expr, parent: Option<&'ast Expr>) {
..
}) => {
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 @@ fn resolve_expr(&mut self, expr: &'ast Expr, parent: Option<&'ast Expr>) {
})
});
}
// 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 @@ fn resolve_expr(&mut self, expr: &'ast Expr, parent: Option<&'ast Expr>) {
}
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);