Skip to content

Commit 31f259c

Browse files
committed
Add const_trait to Allocator
1 parent f937a10 commit 31f259c

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

library/core/src/alloc/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ impl fmt::Display for AllocError {
107107
///
108108
/// [*currently allocated*]: #currently-allocated-memory
109109
#[unstable(feature = "allocator_api", issue = "32838")]
110+
#[const_trait]
110111
pub unsafe trait Allocator {
111112
/// Attempts to allocate a block of memory.
112113
///

library/core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
#![feature(const_str_from_utf8_unchecked_mut)]
141141
#![feature(const_swap)]
142142
#![feature(const_trait_impl)]
143+
#![feature(const_try)]
143144
#![feature(const_type_id)]
144145
#![feature(const_type_name)]
145146
#![feature(const_default_impls)]

library/core/src/ops/function.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
)]
7272
#[fundamental] // so that regex can rely that `&str: !FnMut`
7373
#[must_use = "closures are lazy and do nothing unless called"]
74+
#[cfg_attr(not(bootstrap), const_trait)]
7475
pub trait Fn<Args>: FnMut<Args> {
7576
/// Performs the call operation.
7677
#[unstable(feature = "fn_traits", issue = "29625")]
@@ -158,6 +159,7 @@ pub trait Fn<Args>: FnMut<Args> {
158159
)]
159160
#[fundamental] // so that regex can rely that `&str: !FnMut`
160161
#[must_use = "closures are lazy and do nothing unless called"]
162+
#[cfg_attr(not(bootstrap), const_trait)]
161163
pub trait FnMut<Args>: FnOnce<Args> {
162164
/// Performs the call operation.
163165
#[unstable(feature = "fn_traits", issue = "29625")]
@@ -237,6 +239,7 @@ pub trait FnMut<Args>: FnOnce<Args> {
237239
)]
238240
#[fundamental] // so that regex can rely that `&str: !FnMut`
239241
#[must_use = "closures are lazy and do nothing unless called"]
242+
#[cfg_attr(not(bootstrap), const_trait)]
240243
pub trait FnOnce<Args> {
241244
/// The returned type after the call operator is used.
242245
#[lang = "fn_once_output"]

0 commit comments

Comments
 (0)