about summary refs log tree commit diff
path: root/compiler/rustc_resolve
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-06-24 16:43:49 +0900
committerGitHub <noreply@github.com>2022-06-24 16:43:49 +0900
commit5e98e55668f25cd046073bd67dbcfd6b58ec467e (patch)
tree2b3ee9ef5bd82f2cded85c4989ffe49857a7783c /compiler/rustc_resolve
parentd26b03c429699eda669175a0f1e69fb9e664ad7d (diff)
parent9730221b9d8adafcd7615d5dc43cf83a60baf123 (diff)
downloadrust-5e98e55668f25cd046073bd67dbcfd6b58ec467e.tar.gz
rust-5e98e55668f25cd046073bd67dbcfd6b58ec467e.zip
Rollup merge of #98419 - WaffleLapkin:remove_excess_rib, r=compiler-errors
Remove excess rib while resolving closures

I've mentioned this on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60ClosureOrAsyncRibKind.60.20weirdness/near/286982959), in `rustc_resolve`, while resolving closures we add an excess `ClosureOrAsyncRibKind`. It's excess because we later add another one in `visit_fn`.

I couldn't find a way in which removing this will break anything, all test seem to pass, etc.

r? ``@compiler-errors``
cc ``@davidtwco``
Diffstat (limited to 'compiler/rustc_resolve')
-rw-r--r--compiler/rustc_resolve/src/late.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index e36f55b2e02..640d13ea435 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -3514,7 +3514,9 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
                     })
                 });
             }
-            ExprKind::Async(..) | ExprKind::Closure(..) => {
+            // For closures, ClosureOrAsyncRibKind is added in visit_fn
+            ExprKind::Closure(..) => visit::walk_expr(self, expr),
+            ExprKind::Async(..) => {
                 self.with_label_rib(ClosureOrAsyncRibKind, |this| visit::walk_expr(this, expr));
             }
             ExprKind::Repeat(ref elem, ref ct) => {