@@ -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 } ;
@@ -2087,7 +2088,33 @@ impl CheckAttrVisitor<'_> {
2087
2088
2088
2089
fn check_macro_export ( & self , hir_id : HirId , attr : & Attribute , target : Target ) {
2089
2090
if target != Target :: MacroDef {
2090
- self . tcx . emit_spanned_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: MacroExport ) ;
2091
+ self . tcx . emit_spanned_lint (
2092
+ UNUSED_ATTRIBUTES ,
2093
+ hir_id,
2094
+ attr. span ,
2095
+ errors:: MacroExport :: Normal ,
2096
+ ) ;
2097
+ } else if let Some ( meta_item_list) = attr. meta_item_list ( ) &&
2098
+ !meta_item_list. is_empty ( ) {
2099
+ if meta_item_list. len ( ) > 1 {
2100
+ self . tcx . emit_spanned_lint (
2101
+ INVALID_MACRO_EXPORT_ARGUMENTS ,
2102
+ hir_id,
2103
+ attr. span ,
2104
+ errors:: MacroExport :: TooManyItems ,
2105
+ ) ;
2106
+ } else {
2107
+ if meta_item_list[ 0 ] . name_or_empty ( ) != sym:: local_inner_macros {
2108
+ self . tcx . emit_spanned_lint (
2109
+ INVALID_MACRO_EXPORT_ARGUMENTS ,
2110
+ hir_id,
2111
+ meta_item_list[ 0 ] . span ( ) ,
2112
+ errors:: MacroExport :: UnknownItem {
2113
+ name : meta_item_list[ 0 ] . name_or_empty ( ) ,
2114
+ } ,
2115
+ ) ;
2116
+ }
2117
+ }
2091
2118
}
2092
2119
}
2093
2120
0 commit comments