resolve: Fix access to extern and stdlib prelude from opaque macros
Ok, it's hard to explain what happens, but identifier's hygienic contexts need to be "adjusted" to modules/scopes before they are resolved in them.
To be resolved in all kinds on preludes the identifier needs to be adjusted to the root expansion (aka "no expansion").
Previously this was done for the `macro m() { ::my_crate::foo }` case, but forgotten for all other cases.
This commit is contained in:
parent
f923942094
commit
0ec6ea7333
5 changed files with 42 additions and 0 deletions
|
|
@ -2247,6 +2247,7 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
|
||||
if !module.no_implicit_prelude {
|
||||
ident.span.adjust(Mark::root());
|
||||
if ns == TypeNS {
|
||||
if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
|
||||
return Some(LexicalScopeBinding::Item(binding));
|
||||
|
|
|
|||
|
|
@ -856,6 +856,7 @@ impl<'a> Resolver<'a> {
|
|||
match self.hygienic_lexical_parent(module, &mut ident.span) {
|
||||
Some(parent_module) => WhereToResolve::Module(parent_module),
|
||||
None => {
|
||||
ident.span.adjust(Mark::root());
|
||||
use_prelude = !module.no_implicit_prelude;
|
||||
match ns {
|
||||
TypeNS => WhereToResolve::ExternPrelude,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue