@@ -27,10 +27,8 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
2727use rustc_span:: { BytePos , Span , SyntaxContext } ;
2828use thin_vec:: { thin_vec, ThinVec } ;
2929
30- use crate :: errors:: {
31- AddedMacroUse , ChangeImportBinding , ChangeImportBindingSuggestion , ConsiderAddingADerive ,
32- ExplicitUnsafeTraits ,
33- } ;
30+ use crate :: errors:: { AddedMacroUse , ChangeImportBinding , ChangeImportBindingSuggestion } ;
31+ use crate :: errors:: { ConsiderAddingADerive , ExplicitUnsafeTraits , MaybeMissingMacroRulesName } ;
3432use crate :: imports:: { Import , ImportKind } ;
3533use crate :: late:: { PatternSource , Rib } ;
3634use crate :: path_names_to_string;
@@ -1421,14 +1419,26 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
14211419 "" ,
14221420 ) ;
14231421
1422+ if macro_kind == MacroKind :: Bang
1423+ && ident. name == sym:: macro_rules
1424+ && let source_map = self . tcx . sess . source_map ( )
1425+ && let Ok ( next_source) = source_map. span_to_next_source ( ident. span )
1426+ && next_source. starts_with ( "!" )
1427+ {
1428+ err. subdiagnostic ( MaybeMissingMacroRulesName { span : ident. span } ) ;
1429+ return ;
1430+ }
1431+
14241432 if macro_kind == MacroKind :: Derive && ( ident. name == sym:: Send || ident. name == sym:: Sync ) {
14251433 err. subdiagnostic ( ExplicitUnsafeTraits { span : ident. span , ident } ) ;
14261434 return ;
14271435 }
1436+
14281437 if self . macro_names . contains ( & ident. normalize_to_macros_2_0 ( ) ) {
14291438 err. subdiagnostic ( AddedMacroUse ) ;
14301439 return ;
14311440 }
1441+
14321442 if ident. name == kw:: Default
14331443 && let ModuleKind :: Def ( DefKind :: Enum , def_id, _) = parent_scope. module . kind
14341444 {
0 commit comments