aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/source_binder.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index e7bc4df97..55eb7da35 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -181,7 +181,7 @@ pub enum PathResolution {
181 /// An item 181 /// An item
182 Def(crate::ModuleDef), 182 Def(crate::ModuleDef),
183 /// A local binding (only value namespace) 183 /// A local binding (only value namespace)
184 LocalBinding(Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>), 184 LocalBinding(Either<AstPtr<ast::BindPat>, AstPtr<ast::SelfParam>>),
185 /// A generic parameter 185 /// A generic parameter
186 GenericParam(u32), 186 GenericParam(u32),
187 SelfType(crate::ImplBlock), 187 SelfType(crate::ImplBlock),
@@ -307,7 +307,18 @@ impl SourceAnalyzer {
307 let res = match res { 307 let res = match res {
308 crate::Resolution::Def(it) => PathResolution::Def(it), 308 crate::Resolution::Def(it) => PathResolution::Def(it),
309 crate::Resolution::LocalBinding(it) => { 309 crate::Resolution::LocalBinding(it) => {
310 PathResolution::LocalBinding(self.body_source_map.as_ref()?.pat_syntax(it)?) 310 // We get a `PatId` from resolver, but it actually can only
311 // point at `BindPat`, and not at the arbitrary pattern.
312 let pat_ptr = self.body_source_map.as_ref()?.pat_syntax(it)?;
313 let pat_ptr = match pat_ptr {
314 Either::A(pat) => {
315 let pat: AstPtr<ast::BindPat> =
316 pat.cast_checking_kind(|kind| kind == BIND_PAT).unwrap();
317 Either::A(pat)
318 }
319 Either::B(self_param) => Either::B(self_param),
320 };
321 PathResolution::LocalBinding(pat_ptr)
311 } 322 }
312 crate::Resolution::GenericParam(it) => PathResolution::GenericParam(it), 323 crate::Resolution::GenericParam(it) => PathResolution::GenericParam(it),
313 crate::Resolution::SelfType(it) => PathResolution::SelfType(it), 324 crate::Resolution::SelfType(it) => PathResolution::SelfType(it),