File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,3 +206,12 @@ impl<S: Stage> SingleAttributeParser<S> for CollapseDebugInfoParser {
206206 Some ( AttributeKind :: CollapseDebugInfo ( info) )
207207 }
208208}
209+
210+ pub ( crate ) struct RustcProcMacroDeclsParser ;
211+
212+ impl < S : Stage > NoArgsAttributeParser < S > for RustcProcMacroDeclsParser {
213+ const PATH : & [ Symbol ] = & [ sym:: rustc_proc_macro_decls] ;
214+ const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Warn ;
215+ const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [ Allow ( Target :: Static ) ] ) ;
216+ const CREATE : fn ( Span ) -> AttributeKind = |_| AttributeKind :: RustcProcMacroDecls ;
217+ }
Original file line number Diff line number Diff line change @@ -297,6 +297,7 @@ attribute_parsers!(
297297 Single <WithoutArgs <RustcOutlivesParser >>,
298298 Single <WithoutArgs <RustcPassIndirectlyInNonRusticAbisParser >>,
299299 Single <WithoutArgs <RustcPreserveUbChecksParser >>,
300+ Single <WithoutArgs <RustcProcMacroDeclsParser >>,
300301 Single <WithoutArgs <RustcReallocatorParser >>,
301302 Single <WithoutArgs <RustcRegionsParser >>,
302303 Single <WithoutArgs <RustcShouldNotBeCalledOnConstItems >>,
Original file line number Diff line number Diff line change @@ -1288,6 +1288,9 @@ pub enum AttributeKind {
12881288 /// Represents `#[rustc_preserve_ub_checks]`
12891289 RustcPreserveUbChecks ,
12901290
1291+ /// Represents `#[rustc_proc_macro_decls]`
1292+ RustcProcMacroDecls ,
1293+
12911294 /// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
12921295 RustcPubTransparent ( Span ) ,
12931296
Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ impl AttributeKind {
156156 RustcPassByValue ( ..) => Yes ,
157157 RustcPassIndirectlyInNonRusticAbis ( ..) => No ,
158158 RustcPreserveUbChecks => No ,
159+ RustcProcMacroDecls => No ,
159160 RustcPubTransparent ( ..) => Yes ,
160161 RustcReallocator => No ,
161162 RustcRegions => No ,
Original file line number Diff line number Diff line change 1- use rustc_ast :: attr ;
1+ use rustc_hir :: attrs :: AttributeKind ;
22use rustc_hir:: def_id:: LocalDefId ;
3+ use rustc_hir:: find_attr;
34use rustc_middle:: query:: Providers ;
45use rustc_middle:: ty:: TyCtxt ;
5- use rustc_span:: sym;
66
77fn proc_macro_decls_static ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> Option < LocalDefId > {
88 let mut decls = None ;
99
1010 for id in tcx. hir_free_items ( ) {
11- let attrs = tcx. hir_attrs ( id. hir_id ( ) ) ;
12- if attr:: contains_name ( attrs, sym:: rustc_proc_macro_decls) {
11+ if find_attr ! ( tcx. hir_attrs( id. hir_id( ) ) , AttributeKind :: RustcProcMacroDecls ) {
1312 decls = Some ( id. owner_id . def_id ) ;
1413 }
1514 }
Original file line number Diff line number Diff line change @@ -348,6 +348,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
348348 | AttributeKind :: RustcPassByValue ( ..)
349349 | AttributeKind :: RustcPassIndirectlyInNonRusticAbis ( ..)
350350 | AttributeKind :: RustcPreserveUbChecks
351+ | AttributeKind :: RustcProcMacroDecls
351352 | AttributeKind :: RustcReallocator
352353 | AttributeKind :: RustcRegions
353354 | AttributeKind :: RustcReservationImpl ( ..)
@@ -406,7 +407,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
406407 | sym:: rustc_doc_primitive
407408 | sym:: rustc_test_marker
408409 | sym:: rustc_layout
409- | sym:: rustc_proc_macro_decls
410410 | sym:: rustc_autodiff
411411 | sym:: rustc_capture_analysis
412412 | sym:: rustc_mir
You can’t perform that action at this time.
0 commit comments