From cbd325707bc44c08f60ee3312af815cfb96ee86a Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 21 Mar 2021 00:59:45 +0100 Subject: Track labels in scopes --- crates/hir/src/lib.rs | 1 + crates/hir/src/semantics.rs | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'crates/hir/src') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 30e577671..e34be7e42 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2199,6 +2199,7 @@ pub enum ScopeDef { ImplSelfType(Impl), AdtSelfType(Adt), Local(Local), + Label(Label), Unknown, } diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 15651bb22..1198e3f0b 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -839,6 +839,10 @@ impl<'a> SemanticsScope<'a> { let parent = resolver.body_owner().unwrap(); ScopeDef::Local(Local { parent, pat_id }) } + resolver::ScopeDef::Label(label_id) => { + let parent = resolver.body_owner().unwrap(); + ScopeDef::Label(Label { parent, label_id }) + } }; f(name, def) }) -- cgit v1.2.3