@@ -23,7 +23,8 @@ use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
23
23
use rustc_middle:: ty:: query:: Providers ;
24
24
use rustc_middle:: ty:: { ParamEnv , TyCtxt } ;
25
25
use rustc_session:: lint:: builtin:: {
26
- CONFLICTING_REPR_HINTS , INVALID_DOC_ATTRIBUTES , UNUSED_ATTRIBUTES ,
26
+ CONFLICTING_REPR_HINTS , INVALID_DOC_ATTRIBUTES , INVALID_MACRO_EXPORT_ARGUMENTS ,
27
+ UNUSED_ATTRIBUTES ,
27
28
} ;
28
29
use rustc_session:: parse:: feature_err;
29
30
use rustc_span:: symbol:: { kw, sym, Symbol } ;
@@ -2102,7 +2103,33 @@ impl CheckAttrVisitor<'_> {
2102
2103
2103
2104
fn check_macro_export ( & self , hir_id : HirId , attr : & Attribute , target : Target ) {
2104
2105
if target != Target :: MacroDef {
2105
- self . tcx . emit_spanned_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: MacroExport ) ;
2106
+ self . tcx . emit_spanned_lint (
2107
+ UNUSED_ATTRIBUTES ,
2108
+ hir_id,
2109
+ attr. span ,
2110
+ errors:: MacroExport :: Normal ,
2111
+ ) ;
2112
+ } else if let Some ( meta_item_list) = attr. meta_item_list ( ) &&
2113
+ !meta_item_list. is_empty ( ) {
2114
+ if meta_item_list. len ( ) > 1 {
2115
+ self . tcx . emit_spanned_lint (
2116
+ INVALID_MACRO_EXPORT_ARGUMENTS ,
2117
+ hir_id,
2118
+ attr. span ,
2119
+ errors:: MacroExport :: TooManyItems ,
2120
+ ) ;
2121
+ } else {
2122
+ if meta_item_list[ 0 ] . name_or_empty ( ) != sym:: local_inner_macros {
2123
+ self . tcx . emit_spanned_lint (
2124
+ INVALID_MACRO_EXPORT_ARGUMENTS ,
2125
+ hir_id,
2126
+ meta_item_list[ 0 ] . span ( ) ,
2127
+ errors:: MacroExport :: UnknownItem {
2128
+ name : meta_item_list[ 0 ] . name_or_empty ( ) ,
2129
+ } ,
2130
+ ) ;
2131
+ }
2132
+ }
2106
2133
}
2107
2134
}
2108
2135
0 commit comments