fix NameRefClass misclassifying proc-macros
This commit is contained in:
parent
9eed85b171
commit
22160c418b
@ -56,7 +56,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||
<span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration public">Fn</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span><span class="colon">:</span> <span class="trait public">FnMut</span><span class="angle"><</span><span class="type_param">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span>
|
||||
<span class="brace">}</span>
|
||||
|
||||
<span class="module crate_root library">proc_macros</span><span class="operator">::</span><span class="function library">mirror</span><span class="macro_bang">!</span> <span class="brace">{</span>
|
||||
<span class="module crate_root library">proc_macros</span><span class="operator">::</span><span class="macro library">mirror</span><span class="macro_bang">!</span> <span class="brace">{</span>
|
||||
<span class="brace">{</span>
|
||||
<span class="comma">,</span><span class="builtin_type">i32</span> <span class="colon">:</span><span class="field declaration public">x</span> <span class="keyword">pub</span>
|
||||
<span class="comma">,</span><span class="builtin_type">i32</span> <span class="colon">:</span><span class="field declaration public">y</span> <span class="keyword">pub</span>
|
||||
|
@ -416,10 +416,10 @@ impl NameRefClass {
|
||||
}
|
||||
|
||||
if let Some(path) = ast::PathSegment::cast(parent.clone()).map(|it| it.parent_path()) {
|
||||
if path.qualifier().is_none() {
|
||||
if path.parent_path().is_none() {
|
||||
if let Some(macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) {
|
||||
// Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment
|
||||
// paths are handled below (allowing `log$0::info!` to resolve to the log crate).
|
||||
// Only use this to resolve to macro calls for last segments as qualifiers resolve
|
||||
// to modules below.
|
||||
if let Some(macro_def) = sema.resolve_macro_call(¯o_call) {
|
||||
return Some(NameRefClass::Definition(Definition::Macro(macro_def)));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user