diff options
| author | Jane Losare-Lusby <jlusby@yaah.dev> | 2022-07-29 18:54:47 +0000 |
|---|---|---|
| committer | Jane Lusby <jlusby@yaah.dev> | 2022-08-22 13:28:25 -0700 |
| commit | bf7611d55ee6e24647aefc4d1c82b1dba0164536 (patch) | |
| tree | ca210f013c939a839c776ca63dcbcbfebbc4f564 /library/core/src/alloc | |
| parent | e0dc8d78019ca924203fe153ff0af7f64f68cb5d (diff) | |
| download | rust-bf7611d55ee6e24647aefc4d1c82b1dba0164536.tar.gz rust-bf7611d55ee6e24647aefc4d1c82b1dba0164536.zip | |
Move error trait into core
Diffstat (limited to 'library/core/src/alloc')
| -rw-r--r-- | library/core/src/alloc/layout.rs | 6 | ||||
| -rw-r--r-- | library/core/src/alloc/mod.rs | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 3473ac09e95..f03502429ab 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -5,6 +5,8 @@ // Your performance intuition is useless. Run perf. use crate::cmp; +#[cfg(not(bootstrap))] +use crate::error::Error; use crate::fmt; use crate::mem::{self, ValidAlign}; use crate::ptr::NonNull; @@ -461,6 +463,10 @@ pub type LayoutErr = LayoutError; #[derive(Clone, PartialEq, Eq, Debug)] pub struct LayoutError; +#[cfg(not(bootstrap))] +#[stable(feature = "alloc_layout", since = "1.28.0")] +impl Error for LayoutError {} + // (we need this for downstream impl of trait Error) #[stable(feature = "alloc_layout", since = "1.28.0")] impl fmt::Display for LayoutError { diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs index 6cc6e359e65..94efa76664f 100644 --- a/library/core/src/alloc/mod.rs +++ b/library/core/src/alloc/mod.rs @@ -21,6 +21,8 @@ pub use self::layout::LayoutErr; #[stable(feature = "alloc_layout_error", since = "1.50.0")] pub use self::layout::LayoutError; +#[cfg(not(bootstrap))] +use crate::error::Error; use crate::fmt; use crate::ptr::{self, NonNull}; @@ -32,6 +34,14 @@ use crate::ptr::{self, NonNull}; #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct AllocError; +#[cfg(not(bootstrap))] +#[unstable( + feature = "allocator_api", + reason = "the precise API and guarantees it provides may be tweaked.", + issue = "32838" +)] +impl Error for AllocError {} + // (we need this for downstream impl of trait Error) #[unstable(feature = "allocator_api", issue = "32838")] impl fmt::Display for AllocError { |
