mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
internal: Treat the self param as different from patterns when lowering
This commit is contained in:
parent
0931361b8f
commit
458f4a2960
18 changed files with 256 additions and 144 deletions
|
@ -101,7 +101,7 @@ use hir_def::{
|
|||
use hir_expand::{attrs::AttrId, name::AsName, HirFileId, HirFileIdExt, MacroCallId};
|
||||
use rustc_hash::FxHashMap;
|
||||
use smallvec::SmallVec;
|
||||
use stdx::{impl_from, never};
|
||||
use stdx::impl_from;
|
||||
use syntax::{
|
||||
ast::{self, HasName},
|
||||
AstNode, SyntaxNode,
|
||||
|
@ -253,14 +253,8 @@ impl SourceToDefCtx<'_, '_> {
|
|||
src: InFile<ast::SelfParam>,
|
||||
) -> Option<(DefWithBodyId, BindingId)> {
|
||||
let container = self.find_pat_or_label_container(src.syntax())?;
|
||||
let (body, source_map) = self.db.body_with_source_map(container);
|
||||
let pat_id = source_map.node_self_param(src.as_ref())?;
|
||||
if let crate::Pat::Bind { id, .. } = body[pat_id] {
|
||||
Some((container, id))
|
||||
} else {
|
||||
never!();
|
||||
None
|
||||
}
|
||||
let body = self.db.body(container);
|
||||
Some((container, body.self_param?))
|
||||
}
|
||||
pub(super) fn label_to_def(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue