Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#![allow(internal_features)]
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(bootstrap, feature(allocator_api))]
#![cfg_attr(not(bootstrap), feature(allocator_ext))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(allocator_api)]
#![feature(ascii_char)]
#![feature(ascii_char_variants)]
#![feature(auto_traits)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![cfg_attr(bootstrap, feature(allocator_api))]
#![cfg_attr(doc, feature(intra_doc_pointers))]
#![feature(allocator_api)]
#![cfg_attr(not(bootstrap), feature(allocator_ext))]
#![feature(associated_type_defaults)]
#![feature(box_as_ptr)]
#![feature(closure_track_caller)]
Expand Down
10 changes: 8 additions & 2 deletions library/alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ unsafe extern "Rust" {
///
/// Note: while this type is unstable, the functionality it provides can be
/// accessed through the [free functions in `alloc`](self#functions).
#[unstable(feature = "allocator_api", issue = "32838")]
#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")]
#[derive(Copy, Clone, Default, Debug)]
// the compiler needs to know when a Box uses the global allocator vs a custom one
#[lang = "global_alloc_ty"]
pub struct Global;

#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")]
unsafe impl core::alloc::AllocatorClone for Global {}

#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")]
unsafe impl core::alloc::PinSafeAllocator for Global {}

/// Allocates memory with the global allocator.
///
/// This function forwards calls to the [`GlobalAlloc::alloc`] method
Expand Down Expand Up @@ -440,7 +446,7 @@ impl Global {
}
}

#[unstable(feature = "allocator_api", issue = "32838")]
#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
unsafe impl const Allocator for Global {
#[inline]
Expand Down
Loading
Loading