Rollup merge of #103760 - petrochenkov:macimp, r=cjgillot
resolve: Turn the binding from `#[macro_export]` into a proper `Import` Continuation of https://github.com/rust-lang/rust/pull/91795. ```rust #[macro_export] macro_rules! m { /*...*/ } ``` is desugared to something like ```rust macro_rules! m { /*...*/ } // Non-modularized macro_rules item pub use m; // It's modularized reexport ``` This PR adjusts the internal representation to better match this model.
This commit is contained in:
commit
68afa32985
11 changed files with 238 additions and 165 deletions
|
@ -17,7 +17,7 @@ use crate::late::{
|
|||
};
|
||||
use crate::macros::{sub_namespace_match, MacroRulesScope};
|
||||
use crate::{AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, Determinacy, Finalize};
|
||||
use crate::{ImportKind, LexicalScopeBinding, Module, ModuleKind, ModuleOrUniformRoot};
|
||||
use crate::{Import, ImportKind, LexicalScopeBinding, Module, ModuleKind, ModuleOrUniformRoot};
|
||||
use crate::{NameBinding, NameBindingKind, ParentScope, PathResult, PrivacyError, Res};
|
||||
use crate::{ResolutionError, Resolver, Scope, ScopeSet, Segment, ToNameBinding, Weak};
|
||||
|
||||
|
@ -860,7 +860,11 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
|
||||
if !restricted_shadowing && binding.expansion != LocalExpnId::ROOT {
|
||||
if let NameBindingKind::Res(_, true) = binding.kind {
|
||||
if let NameBindingKind::Import {
|
||||
import: Import { kind: ImportKind::MacroExport, .. },
|
||||
..
|
||||
} = binding.kind
|
||||
{
|
||||
self.macro_expanded_macro_export_errors.insert((path_span, binding.span));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue