@@ -1385,6 +1385,8 @@ pub struct Resolver<'a, 'b: 'a> {
1385
1385
use_injections : Vec < UseError < ' a > > ,
1386
1386
/// `use` injections for proc macros wrongly imported with #[macro_use]
1387
1387
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 ) > ,
1388
1390
1389
1391
gated_errors : FxHashSet < Span > ,
1390
1392
disallowed_shadowing : Vec < & ' a LegacyBinding < ' a > > ,
@@ -1432,9 +1434,6 @@ pub struct Resolver<'a, 'b: 'a> {
1432
1434
1433
1435
/// Only supposed to be used by rustdoc, otherwise should be false.
1434
1436
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 > ,
1438
1437
}
1439
1438
1440
1439
/// 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> {
1706
1705
proc_mac_errors : Vec :: new ( ) ,
1707
1706
gated_errors : FxHashSet ( ) ,
1708
1707
disallowed_shadowing : Vec :: new ( ) ,
1708
+ macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
1709
1709
1710
1710
arenas,
1711
1711
dummy_binding : arenas. alloc_name_binding ( NameBinding {
@@ -1737,7 +1737,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
1737
1737
current_type_ascription : Vec :: new ( ) ,
1738
1738
injected_crate : None ,
1739
1739
ignore_extern_prelude_feature : false ,
1740
- unresolved_invocations_macro_export : FxHashSet ( ) ,
1741
1740
}
1742
1741
}
1743
1742
@@ -4126,6 +4125,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
4126
4125
ns : Namespace ,
4127
4126
module : Module < ' a > ,
4128
4127
found_traits : & mut Vec < TraitCandidate > ) {
4128
+ assert ! ( ns == TypeNS || ns == ValueNS ) ;
4129
4129
let mut traits = module. traits . borrow_mut ( ) ;
4130
4130
if traits. is_none ( ) {
4131
4131
let mut collected_traits = Vec :: new ( ) ;
@@ -4371,6 +4371,14 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
4371
4371
self . report_proc_macro_import ( krate) ;
4372
4372
let mut reported_spans = FxHashSet ( ) ;
4373
4373
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
+
4374
4382
for & AmbiguityError { span, name, b1, b2, lexical } in & self . ambiguity_errors {
4375
4383
if !reported_spans. insert ( span) { continue }
4376
4384
let participle = |binding : & NameBinding | {
0 commit comments