@@ -1385,6 +1385,8 @@ pub struct Resolver<'a, 'b: 'a> {
13851385 use_injections : Vec < UseError < ' a > > ,
13861386 /// `use` injections for proc macros wrongly imported with #[macro_use]
13871387 proc_mac_errors : Vec < macros:: ProcMacError > ,
1388+ /// crate-local macro expanded `macro_export` referred to by a module-relative path
1389+ macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > ,
13881390
13891391 gated_errors : FxHashSet < Span > ,
13901392 disallowed_shadowing : Vec < & ' a LegacyBinding < ' a > > ,
@@ -1432,9 +1434,6 @@ pub struct Resolver<'a, 'b: 'a> {
14321434
14331435 /// Only supposed to be used by rustdoc, otherwise should be false.
14341436 pub ignore_extern_prelude_feature : bool ,
1435-
1436- /// Macro invocations in the whole crate that can expand into a `#[macro_export] macro_rules`.
1437- unresolved_invocations_macro_export : FxHashSet < Mark > ,
14381437}
14391438
14401439/// Nothing really interesting here, it just provides memory for the rest of the crate.
@@ -1706,6 +1705,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
17061705 proc_mac_errors : Vec :: new ( ) ,
17071706 gated_errors : FxHashSet ( ) ,
17081707 disallowed_shadowing : Vec :: new ( ) ,
1708+ macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
17091709
17101710 arenas,
17111711 dummy_binding : arenas. alloc_name_binding ( NameBinding {
@@ -1737,7 +1737,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
17371737 current_type_ascription : Vec :: new ( ) ,
17381738 injected_crate : None ,
17391739 ignore_extern_prelude_feature : false ,
1740- unresolved_invocations_macro_export : FxHashSet ( ) ,
17411740 }
17421741 }
17431742
@@ -4126,6 +4125,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
41264125 ns : Namespace ,
41274126 module : Module < ' a > ,
41284127 found_traits : & mut Vec < TraitCandidate > ) {
4128+ assert ! ( ns == TypeNS || ns == ValueNS ) ;
41294129 let mut traits = module. traits . borrow_mut ( ) ;
41304130 if traits. is_none ( ) {
41314131 let mut collected_traits = Vec :: new ( ) ;
@@ -4371,6 +4371,14 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
43714371 self . report_proc_macro_import ( krate) ;
43724372 let mut reported_spans = FxHashSet ( ) ;
43734373
4374+ for & ( span_use, span_def) in & self . macro_expanded_macro_export_errors {
4375+ let msg = "macro-expanded `macro_export` macros from the current crate \
4376+ cannot be referred to by absolute paths";
4377+ self . session . struct_span_err ( span_use, msg)
4378+ . span_note ( span_def, "the macro is defined here" )
4379+ . emit ( ) ;
4380+ }
4381+
43744382 for & AmbiguityError { span, name, b1, b2, lexical } in & self . ambiguity_errors {
43754383 if !reported_spans. insert ( span) { continue }
43764384 let participle = |binding : & NameBinding | {
0 commit comments