We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
#[rustc_allocator_zeroed]
1 parent 9a7614d commit 21c9bd7Copy full SHA for 21c9bd7
6 files changed
compiler/rustc_attr_parsing/src/attributes/rustc_allocator.rs
@@ -10,6 +10,16 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcAllocatorParser {
10
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocator;
11
}
12
13
+pub(crate) struct RustcAllocatorZeroedParser;
14
+
15
+impl<S: Stage> NoArgsAttributeParser<S> for RustcAllocatorZeroedParser {
16
+ const PATH: &[Symbol] = &[sym::rustc_allocator_zeroed];
17
+ const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
18
+ const ALLOWED_TARGETS: AllowedTargets =
19
+ AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
20
+ const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocatorZeroed;
21
+}
22
23
pub(crate) struct RustcDeallocatorParser;
24
25
impl<S: Stage> NoArgsAttributeParser<S> for RustcDeallocatorParser {
compiler/rustc_attr_parsing/src/context.rs
@@ -65,7 +65,8 @@ use crate::attributes::proc_macro_attrs::{
65
use crate::attributes::prototype::CustomMirParser;
66
use crate::attributes::repr::{AlignParser, AlignStaticParser, ReprParser};
67
use crate::attributes::rustc_allocator::{
68
- RustcAllocatorParser, RustcDeallocatorParser, RustcReallocatorParser,
+ RustcAllocatorParser, RustcAllocatorZeroedParser, RustcDeallocatorParser,
69
+ RustcReallocatorParser,
70
};
71
use crate::attributes::rustc_dump::{
72
RustcDumpDefParents, RustcDumpItemBounds, RustcDumpPredicates, RustcDumpUserArgs,
@@ -277,6 +278,7 @@ attribute_parsers!(
277
278
Single<WithoutArgs<ProcMacroParser>>,
279
Single<WithoutArgs<PubTransparentParser>>,
280
Single<WithoutArgs<RustcAllocatorParser>>,
281
+ Single<WithoutArgs<RustcAllocatorZeroedParser>>,
282
Single<WithoutArgs<RustcCoherenceIsCoreParser>>,
283
Single<WithoutArgs<RustcDeallocatorParser>>,
284
Single<WithoutArgs<RustcDumpDefParents>>,
compiler/rustc_codegen_ssa/src/codegen_attrs.rs
@@ -344,6 +344,9 @@ fn process_builtin_attrs(
344
AttributeKind::RustcReallocator => {
345
codegen_fn_attrs.flags |= CodegenFnAttrFlags::REALLOCATOR
346
347
+ AttributeKind::RustcAllocatorZeroed => {
348
+ codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR_ZEROED
349
+ }
350
_ => {}
351
352
@@ -354,9 +357,6 @@ fn process_builtin_attrs(
354
357
355
358
match name {
356
359
sym::rustc_nounwind => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND,
- sym::rustc_allocator_zeroed => {
- codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR_ZEROED
- }
360
sym::patchable_function_entry => {
361
codegen_fn_attrs.patchable_function_entry =
362
parse_patchable_function_entry(tcx, attr);
compiler/rustc_hir/src/attrs/data_structures.rs
@@ -909,6 +909,9 @@ pub enum AttributeKind {
909
/// Represents `#[rustc_allocator]`
910
RustcAllocator,
911
912
+ /// Represents `#[rustc_allocator_zeroed]`
913
+ RustcAllocatorZeroed,
914
915
/// Represents `#[rustc_builtin_macro]`.
916
RustcBuiltinMacro { builtin_name: Option<Symbol>, helper_attrs: ThinVec<Symbol>, span: Span },
917
compiler/rustc_hir/src/attrs/encode_cross_crate.rs
@@ -98,6 +98,7 @@ impl AttributeKind {
98
RecursionLimit { .. } => No,
99
Repr { .. } => No,
100
RustcAllocator => No,
101
+ RustcAllocatorZeroed => No,
102
RustcBuiltinMacro { .. } => Yes,
103
RustcCoherenceIsCore(..) => No,
104
RustcDeallocator => No,
compiler/rustc_passes/src/check_attr.rs
@@ -317,6 +317,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
317
| AttributeKind::RustcDumpVtable(..)
318
| AttributeKind::NeedsAllocator
319
| AttributeKind::RustcAllocator
320
+ | AttributeKind::RustcAllocatorZeroed
321
| AttributeKind::RustcDeallocator
322
| AttributeKind::RustcReallocator
323
) => { /* do nothing */ }
@@ -364,7 +365,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
364
365
| sym::rustc_reservation_impl
366
| sym::rustc_doc_primitive
367
| sym::rustc_conversion_suggestion
- | sym::rustc_allocator_zeroed
368
| sym::rustc_allocator_zeroed_variant
369
| sym::rustc_deprecated_safe_2024
370
| sym::rustc_test_marker
0 commit comments