Skip to content

Commit b8bfd08

Browse files
committed
Rename RibKind::ClosureOrAsync to reflect how it is actually used
1 parent bb90c4b commit b8bfd08

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

compiler/rustc_resolve/src/ident.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
10831083
for rib in ribs {
10841084
match rib.kind {
10851085
RibKind::Normal
1086-
| RibKind::ClosureOrAsync
1086+
| RibKind::FnOrCoroutine
10871087
| RibKind::Module(..)
10881088
| RibKind::MacroDefinition(..)
10891089
| RibKind::ForwardGenericParamBan => {
@@ -1156,7 +1156,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
11561156
for rib in ribs {
11571157
let has_generic_params: HasGenericParams = match rib.kind {
11581158
RibKind::Normal
1159-
| RibKind::ClosureOrAsync
1159+
| RibKind::FnOrCoroutine
11601160
| RibKind::Module(..)
11611161
| RibKind::MacroDefinition(..)
11621162
| RibKind::InlineAsmSym
@@ -1240,7 +1240,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
12401240
for rib in ribs {
12411241
let has_generic_params = match rib.kind {
12421242
RibKind::Normal
1243-
| RibKind::ClosureOrAsync
1243+
| RibKind::FnOrCoroutine
12441244
| RibKind::Module(..)
12451245
| RibKind::MacroDefinition(..)
12461246
| RibKind::InlineAsmSym

compiler/rustc_resolve/src/late.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ pub(crate) enum RibKind<'a> {
177177
/// upvars).
178178
AssocItem,
179179

180-
/// We passed through a closure. Disallow labels.
181-
ClosureOrAsync,
180+
/// We passed through a function, closure or coroutine signature. Disallow labels.
181+
FnOrCoroutine,
182182

183183
/// We passed through an item scope. Disallow upvars.
184184
Item(HasGenericParams),
@@ -215,7 +215,7 @@ impl RibKind<'_> {
215215
pub(crate) fn contains_params(&self) -> bool {
216216
match self {
217217
RibKind::Normal
218-
| RibKind::ClosureOrAsync
218+
| RibKind::FnOrCoroutine
219219
| RibKind::ConstantItem(..)
220220
| RibKind::Module(_)
221221
| RibKind::MacroDefinition(_)
@@ -231,7 +231,7 @@ impl RibKind<'_> {
231231
RibKind::Normal | RibKind::MacroDefinition(..) => false,
232232

233233
RibKind::AssocItem
234-
| RibKind::ClosureOrAsync
234+
| RibKind::FnOrCoroutine
235235
| RibKind::Item(..)
236236
| RibKind::ConstantItem(..)
237237
| RibKind::Module(..)
@@ -924,9 +924,9 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
924924
debug!("(resolving function) entering function");
925925

926926
// Create a value rib for the function.
927-
self.with_rib(ValueNS, RibKind::ClosureOrAsync, |this| {
927+
self.with_rib(ValueNS, RibKind::FnOrCoroutine, |this| {
928928
// Create a label rib for the function.
929-
this.with_label_rib(RibKind::ClosureOrAsync, |this| {
929+
this.with_label_rib(RibKind::FnOrCoroutine, |this| {
930930
match fn_kind {
931931
FnKind::Fn(_, _, sig, _, generics, body) => {
932932
this.visit_generics(generics);
@@ -4287,7 +4287,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
42874287
..
42884288
}) => {
42894289
self.with_rib(ValueNS, RibKind::Normal, |this| {
4290-
this.with_label_rib(RibKind::ClosureOrAsync, |this| {
4290+
this.with_label_rib(RibKind::FnOrCoroutine, |this| {
42914291
// Resolve arguments:
42924292
this.resolve_params(&fn_decl.inputs);
42934293
// No need to resolve return type --
@@ -4304,7 +4304,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
43044304
})
43054305
});
43064306
}
4307-
// For closures, ClosureOrAsyncRibKind is added in visit_fn
4307+
// For closures, RibKind::FnOrCoroutine is added in visit_fn
43084308
ExprKind::Closure(box ast::Closure {
43094309
binder: ClosureBinder::For { ref generic_params, span },
43104310
..
@@ -4322,7 +4322,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
43224322
}
43234323
ExprKind::Closure(..) => visit::walk_expr(self, expr),
43244324
ExprKind::Gen(..) => {
4325-
self.with_label_rib(RibKind::ClosureOrAsync, |this| visit::walk_expr(this, expr));
4325+
self.with_label_rib(RibKind::FnOrCoroutine, |this| visit::walk_expr(this, expr));
43264326
}
43274327
ExprKind::Repeat(ref elem, ref ct) => {
43284328
self.visit_expr(elem);

0 commit comments

Comments
 (0)