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 @@ -300,6 +300,7 @@ attribute_parsers!(
300300 Single <WithoutArgs <RustcOutlivesParser >>,
301301 Single <WithoutArgs <RustcPassIndirectlyInNonRusticAbisParser >>,
302302 Single <WithoutArgs <RustcPreserveUbChecksParser >>,
303+ Single <WithoutArgs <RustcProcMacroDeclsParser >>,
303304 Single <WithoutArgs <RustcReallocatorParser >>,
304305 Single <WithoutArgs <RustcRegionsParser >>,
305306 Single <WithoutArgs <RustcShouldNotBeCalledOnConstItems >>,
Original file line number Diff line number Diff line change @@ -1295,6 +1295,9 @@ pub enum AttributeKind {
12951295 /// Represents `#[rustc_preserve_ub_checks]`
12961296 RustcPreserveUbChecks ,
12971297
1298+ /// Represents `#[rustc_proc_macro_decls]`
1299+ RustcProcMacroDecls ,
1300+
12981301 /// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
12991302 RustcPubTransparent ( Span ) ,
13001303
Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ impl AttributeKind {
158158 RustcPassByValue ( ..) => Yes ,
159159 RustcPassIndirectlyInNonRusticAbis ( ..) => No ,
160160 RustcPreserveUbChecks => No ,
161+ RustcProcMacroDecls => No ,
161162 RustcPubTransparent ( ..) => Yes ,
162163 RustcReallocator => No ,
163164 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 @@ -350,6 +350,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
350350 | AttributeKind :: RustcPassByValue ( ..)
351351 | AttributeKind :: RustcPassIndirectlyInNonRusticAbis ( ..)
352352 | AttributeKind :: RustcPreserveUbChecks
353+ | AttributeKind :: RustcProcMacroDecls
353354 | AttributeKind :: RustcReallocator
354355 | AttributeKind :: RustcRegions
355356 | AttributeKind :: RustcReservationImpl ( ..)
@@ -403,7 +404,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
403404 | sym:: rustc_doc_primitive
404405 | sym:: rustc_test_marker
405406 | sym:: rustc_layout
406- | sym:: rustc_proc_macro_decls
407407 | sym:: rustc_autodiff
408408 | sym:: rustc_capture_analysis
409409 | sym:: rustc_mir
You can’t perform that action at this time.
0 commit comments