mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Resolve derive attributes even when shadowed
This commit is contained in:
parent
401daa5f77
commit
aa9d093488
3 changed files with 23 additions and 7 deletions
|
@ -53,12 +53,9 @@ pub fn try_resolve_derive_input_at(
|
|||
.take_while(|tok| tok.kind() != T!['('] && tok.kind() != T![,])
|
||||
.collect();
|
||||
let path = ast::Path::parse(&tokens.into_iter().rev().join("")).ok()?;
|
||||
match sema.scope(tt.syntax()).speculative_resolve(&path) {
|
||||
Some(hir::PathResolution::Macro(makro)) if makro.kind() == hir::MacroKind::Derive => {
|
||||
Some(makro)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
sema.scope(tt.syntax())
|
||||
.speculative_resolve_as_mac(&path)
|
||||
.filter(|mac| mac.kind() == hir::MacroKind::Derive)
|
||||
}
|
||||
|
||||
/// Picks the token with the highest rank returned by the passed in function.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue