mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
fix: Don't create hir::Local
s from const path patterns
This commit is contained in:
parent
15e7112da3
commit
9050db2e80
2 changed files with 21 additions and 2 deletions
|
@ -213,10 +213,15 @@ impl SourceToDefCtx<'_, '_> {
|
|||
src: InFile<ast::IdentPat>,
|
||||
) -> Option<(DefWithBodyId, PatId)> {
|
||||
let container = self.find_pat_or_label_container(src.syntax())?;
|
||||
let (_body, source_map) = self.db.body_with_source_map(container);
|
||||
let (body, source_map) = self.db.body_with_source_map(container);
|
||||
let src = src.map(ast::Pat::from);
|
||||
let pat_id = source_map.node_pat(src.as_ref())?;
|
||||
Some((container, pat_id))
|
||||
// the pattern could resolve to a constant, verify that that is not the case
|
||||
if let crate::Pat::Bind { .. } = body[pat_id] {
|
||||
Some((container, pat_id))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
pub(super) fn self_param_to_def(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue