File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1211,3 +1211,12 @@ impl<S: Stage> SingleAttributeParser<S> for RustcReservationImplParser {
12111211 Some ( AttributeKind :: RustcReservationImpl ( cx. attr_span , value_str) )
12121212 }
12131213}
1214+
1215+ pub ( crate ) struct PreludeImportParser ;
1216+
1217+ impl < S : Stage > NoArgsAttributeParser < S > for PreludeImportParser {
1218+ const PATH : & [ Symbol ] = & [ sym:: prelude_import] ;
1219+ const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Warn ;
1220+ const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [ Allow ( Target :: Use ) ] ) ;
1221+ const CREATE : fn ( Span ) -> AttributeKind = |_| AttributeKind :: PreludeImport ;
1222+ }
Original file line number Diff line number Diff line change @@ -258,6 +258,7 @@ attribute_parsers!(
258258 Single <WithoutArgs <PassByValueParser >>,
259259 Single <WithoutArgs <PinV2Parser >>,
260260 Single <WithoutArgs <PointeeParser >>,
261+ Single <WithoutArgs <PreludeImportParser >>,
261262 Single <WithoutArgs <ProcMacroAttributeParser >>,
262263 Single <WithoutArgs <ProcMacroParser >>,
263264 Single <WithoutArgs <ProfilerRuntimeParser >>,
Original file line number Diff line number Diff line change @@ -1053,6 +1053,9 @@ pub enum AttributeKind {
10531053 /// Represents `#[pointee]`
10541054 Pointee ( Span ) ,
10551055
1056+ /// Represents `#[prelude_import]`
1057+ PreludeImport ,
1058+
10561059 /// Represents `#[proc_macro]`
10571060 ProcMacro ( Span ) ,
10581061
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ impl AttributeKind {
8282 PatternComplexityLimit { .. } => No ,
8383 PinV2 ( ..) => Yes ,
8484 Pointee ( ..) => No ,
85+ PreludeImport => No ,
8586 ProcMacro ( ..) => No ,
8687 ProcMacroAttribute ( ..) => No ,
8788 ProcMacroDerive { .. } => No ,
Original file line number Diff line number Diff line change @@ -282,6 +282,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
282282 | AttributeKind :: PatternComplexityLimit { .. }
283283 | AttributeKind :: PinV2 ( ..)
284284 | AttributeKind :: Pointee ( ..)
285+ | AttributeKind :: PreludeImport
285286 | AttributeKind :: ProfilerRuntime
286287 | AttributeKind :: RecursionLimit { .. }
287288 | AttributeKind :: ReexportTestHarnessMain ( ..)
@@ -394,7 +395,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
394395 // need to be fixed
395396 | sym:: deprecated_safe // FIXME(deprecated_safe)
396397 // internal
397- | sym:: prelude_import
398398 | sym:: panic_handler
399399 | sym:: lang
400400 | sym:: default_lib_allocator
You can’t perform that action at this time.
0 commit comments