1
Fork 0

Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov

Improve and test cross-crate hygiene

- Decode the parent expansion for traits and enums in `rustc_resolve`, this was already being used for resolution in typeck
- Avoid suggesting importing names with def-site hygiene, since it's often not useful
- Add more tests

r? `@petrochenkov`
This commit is contained in:
Guillaume Gomez 2021-10-30 20:30:27 +02:00 committed by GitHub
commit 1a1f525bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 525 additions and 32 deletions

View file

@ -842,9 +842,11 @@ impl<'a> Resolver<'a> {
// collect results based on the filter function
// 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
&& ns == namespace
&& !ptr::eq(in_module, parent_scope.module)
&& !ident.span.normalize_to_macros_2_0().from_expansion()
{
let res = name_binding.res();
if filter_fn(res) {