mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
internal: Expand the derive attribute into a pseudo expansion
This commit is contained in:
parent
1fe3b2edd6
commit
7b89d5ede2
17 changed files with 178 additions and 155 deletions
|
@ -371,10 +371,10 @@ impl SourceAnalyzer {
|
|||
return builtin.map(PathResolution::BuiltinAttr);
|
||||
}
|
||||
return match resolve_hir_path_as_macro(db, &self.resolver, &hir_path) {
|
||||
res @ Some(m) if m.is_attr() => res.map(PathResolution::Macro),
|
||||
Some(m) => Some(PathResolution::Macro(m)),
|
||||
// this labels any path that starts with a tool module as the tool itself, this is technically wrong
|
||||
// but there is no benefit in differentiating these two cases for the time being
|
||||
_ => path.first_segment().and_then(|it| it.name_ref()).and_then(|name_ref| {
|
||||
None => path.first_segment().and_then(|it| it.name_ref()).and_then(|name_ref| {
|
||||
match self.resolver.krate() {
|
||||
Some(krate) => ToolModule::by_name(db, krate.into(), &name_ref.text()),
|
||||
None => ToolModule::builtin(&name_ref.text()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue