Don't suggest importing items with hygienic names
This will potentially hide a few correct suggestions, but importing these items from another module is not generally possible.
This commit is contained in:
parent
4ecb49eba3
commit
1536d7220b
2 changed files with 3 additions and 1 deletions
|
@ -831,9 +831,11 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
// collect results based on the filter function
|
// collect results based on the filter function
|
||||||
// avoid suggesting anything from the same module in which we are resolving
|
// avoid suggesting anything from the same module in which we are resolving
|
||||||
|
// avoid suggesting anything with a hygienic name
|
||||||
if ident.name == lookup_ident.name
|
if ident.name == lookup_ident.name
|
||||||
&& ns == namespace
|
&& ns == namespace
|
||||||
&& !ptr::eq(in_module, parent_scope.module)
|
&& !ptr::eq(in_module, parent_scope.module)
|
||||||
|
&& !ident.span.normalize_to_macros_2_0().from_expansion()
|
||||||
{
|
{
|
||||||
let res = name_binding.res();
|
let res = name_binding.res();
|
||||||
if filter_fn(res) {
|
if filter_fn(res) {
|
||||||
|
|
|
@ -709,7 +709,7 @@ impl SyntaxContext {
|
||||||
/// pub fn f() {} // `f`'s `SyntaxContext` has a single `ExpnId` from `m`.
|
/// pub fn f() {} // `f`'s `SyntaxContext` has a single `ExpnId` from `m`.
|
||||||
/// pub fn $i() {} // `$i`'s `SyntaxContext` is empty.
|
/// pub fn $i() {} // `$i`'s `SyntaxContext` is empty.
|
||||||
/// }
|
/// }
|
||||||
/// n(f);
|
/// n!(f);
|
||||||
/// macro n($j:ident) {
|
/// macro n($j:ident) {
|
||||||
/// use foo::*;
|
/// use foo::*;
|
||||||
/// f(); // `f`'s `SyntaxContext` has a mark from `m` and a mark from `n`
|
/// f(); // `f`'s `SyntaxContext` has a mark from `m` and a mark from `n`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue