Skip to content

Commit b42d648

Browse files
committed
checkpoint
1 parent 0afce62 commit b42d648

File tree

20 files changed

+902
-677
lines changed

20 files changed

+902
-677
lines changed

library/alloc/src/boxed.rs

+18
Original file line numberDiff line numberDiff line change
@@ -2365,3 +2365,21 @@ impl<'a> From<Cow<'a, str>> for Box<dyn Error> {
23652365
From::from(String::from(err))
23662366
}
23672367
}
2368+
2369+
#[cfg(not(bootstrap))]
2370+
#[stable(feature = "box_error", since = "1.8.0")]
2371+
impl<T: core::error::Error> core::error::Error for Box<T> {
2372+
#[allow(deprecated, deprecated_in_future)]
2373+
fn description(&self) -> &str {
2374+
core::error::Error::description(&**self)
2375+
}
2376+
2377+
#[allow(deprecated)]
2378+
fn cause(&self) -> Option<&dyn core::error::Error> {
2379+
core::error::Error::cause(&**self)
2380+
}
2381+
2382+
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
2383+
core::error::Error::source(&**self)
2384+
}
2385+
}

library/alloc/src/boxed/thin.rs

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs
33
// by matthieu-m
44
use crate::alloc::{self, Layout, LayoutError};
5+
#[cfg(not(bootstrap))]
6+
use core::error::Error;
57
use core::fmt::{self, Debug, Display, Formatter};
68
use core::marker::PhantomData;
79
#[cfg(not(no_global_oom_handling))]
@@ -271,3 +273,11 @@ impl<H> WithHeader<H> {
271273
Layout::new::<H>().extend(value_layout)
272274
}
273275
}
276+
277+
#[cfg(not(bootstrap))]
278+
#[unstable(feature = "thin_box", issue = "92791")]
279+
impl<T: ?Sized + Error> Error for ThinBox<T> {
280+
fn source(&self) -> Option<&(dyn Error + 'static)> {
281+
self.deref().source()
282+
}
283+
}

library/alloc/src/collections/btree/map/entry.rs

+11
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ impl<'a, K: Debug + Ord, V: Debug, A: Allocator + Clone> fmt::Display
133133
}
134134
}
135135

136+
#[cfg(not(bootstrap))]
137+
#[unstable(feature = "map_try_insert", issue = "82766")]
138+
impl<'a, K: core::fmt::Debug + Ord, V: core::fmt::Debug> core::error::Error
139+
for crate::collections::btree_map::OccupiedError<'a, K, V>
140+
{
141+
#[allow(deprecated)]
142+
fn description(&self) -> &str {
143+
"key already exists"
144+
}
145+
}
146+
136147
impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> {
137148
/// Ensures a value is in the entry by inserting the default if empty, and returns
138149
/// a mutable reference to the value in the entry.

library/alloc/src/lib.rs

+54
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
#![feature(const_pin)]
112112
#![feature(cstr_from_bytes_until_nul)]
113113
#![feature(dispatch_from_dyn)]
114+
#![cfg_attr(not(bootstrap), feature(error_generic_member_access))]
114115
#![cfg_attr(not(bootstrap), feature(error_in_core))]
115116
#![feature(exact_size_is_empty)]
116117
#![feature(extend_one)]
@@ -128,6 +129,7 @@
128129
#![feature(nonnull_slice_from_raw_parts)]
129130
#![feature(pattern)]
130131
#![feature(pointer_byte_offsets)]
132+
#![cfg_attr(not(bootstrap), feature(provide_any))]
131133
#![feature(ptr_internals)]
132134
#![feature(ptr_metadata)]
133135
#![feature(ptr_sub_ptr)]
@@ -240,3 +242,55 @@ pub mod vec;
240242
pub mod __export {
241243
pub use core::format_args;
242244
}
245+
246+
#[cfg(not(bootstrap))]
247+
#[stable(feature = "arc_error", since = "1.52.0")]
248+
impl<T: core::error::Error + ?Sized> core::error::Error for crate::sync::Arc<T> {
249+
#[allow(deprecated, deprecated_in_future)]
250+
fn description(&self) -> &str {
251+
core::error::Error::description(&**self)
252+
}
253+
254+
#[allow(deprecated)]
255+
fn cause(&self) -> Option<&dyn core::error::Error> {
256+
core::error::Error::cause(&**self)
257+
}
258+
259+
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
260+
core::error::Error::source(&**self)
261+
}
262+
263+
fn provide<'a>(&'a self, req: &mut core::any::Demand<'a>) {
264+
core::error::Error::provide(&**self, req);
265+
}
266+
}
267+
268+
#[cfg(not(bootstrap))]
269+
#[stable(feature = "try_reserve", since = "1.57.0")]
270+
impl core::error::Error for crate::collections::TryReserveError {}
271+
272+
#[cfg(not(bootstrap))]
273+
#[stable(feature = "rust1", since = "1.0.0")]
274+
impl core::error::Error for crate::ffi::NulError {
275+
#[allow(deprecated)]
276+
fn description(&self) -> &str {
277+
"nul byte found in data"
278+
}
279+
}
280+
281+
#[cfg(not(bootstrap))]
282+
#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")]
283+
impl core::error::Error for crate::ffi::FromVecWithNulError {}
284+
285+
#[cfg(not(bootstrap))]
286+
#[stable(feature = "cstring_into", since = "1.7.0")]
287+
impl core::error::Error for crate::ffi::IntoStringError {
288+
#[allow(deprecated)]
289+
fn description(&self) -> &str {
290+
"C string contained non-utf8 bytes"
291+
}
292+
293+
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
294+
Some(self.__source())
295+
}
296+
}

library/alloc/src/string.rs

+20
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444

4545
#[cfg(not(no_global_oom_handling))]
4646
use core::char::{decode_utf16, REPLACEMENT_CHARACTER};
47+
#[cfg(not(bootstrap))]
48+
use core::error::Error;
4749
use core::fmt;
4850
use core::hash;
4951
use core::iter::FusedIterator;
@@ -1938,6 +1940,24 @@ impl fmt::Display for FromUtf16Error {
19381940
}
19391941
}
19401942

1943+
#[cfg(not(bootstrap))]
1944+
#[stable(feature = "rust1", since = "1.0.0")]
1945+
impl Error for FromUtf8Error {
1946+
#[allow(deprecated)]
1947+
fn description(&self) -> &str {
1948+
"invalid utf-8"
1949+
}
1950+
}
1951+
1952+
#[cfg(not(bootstrap))]
1953+
#[stable(feature = "rust1", since = "1.0.0")]
1954+
impl Error for FromUtf16Error {
1955+
#[allow(deprecated)]
1956+
fn description(&self) -> &str {
1957+
"invalid utf-16"
1958+
}
1959+
}
1960+
19411961
#[cfg(not(no_global_oom_handling))]
19421962
#[stable(feature = "rust1", since = "1.0.0")]
19431963
impl Clone for String {

library/core/src/alloc/layout.rs

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// Your performance intuition is useless. Run perf.
66

77
use crate::cmp;
8+
#[cfg(not(bootstrap))]
9+
use crate::error::Error;
810
use crate::fmt;
911
use crate::mem::{self, ValidAlign};
1012
use crate::ptr::NonNull;
@@ -436,6 +438,10 @@ pub type LayoutErr = LayoutError;
436438
#[derive(Clone, PartialEq, Eq, Debug)]
437439
pub struct LayoutError;
438440

441+
#[cfg(not(bootstrap))]
442+
#[stable(feature = "alloc_layout", since = "1.28.0")]
443+
impl Error for LayoutError {}
444+
439445
// (we need this for downstream impl of trait Error)
440446
#[stable(feature = "alloc_layout", since = "1.28.0")]
441447
impl fmt::Display for LayoutError {

library/core/src/alloc/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub use self::layout::LayoutErr;
2121
#[stable(feature = "alloc_layout_error", since = "1.50.0")]
2222
pub use self::layout::LayoutError;
2323

24+
#[cfg(not(bootstrap))]
25+
use crate::error::Error;
2426
use crate::fmt;
2527
use crate::ptr::{self, NonNull};
2628

@@ -32,6 +34,14 @@ use crate::ptr::{self, NonNull};
3234
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
3335
pub struct AllocError;
3436

37+
#[cfg(not(bootstrap))]
38+
#[unstable(
39+
feature = "allocator_api",
40+
reason = "the precise API and guarantees it provides may be tweaked.",
41+
issue = "32838"
42+
)]
43+
impl Error for AllocError {}
44+
3545
// (we need this for downstream impl of trait Error)
3646
#[unstable(feature = "allocator_api", issue = "32838")]
3747
impl fmt::Display for AllocError {

library/core/src/array/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use crate::borrow::{Borrow, BorrowMut};
88
use crate::cmp::Ordering;
99
use crate::convert::{Infallible, TryFrom};
10+
#[cfg(not(bootstrap))]
11+
use crate::error::Error;
1012
use crate::fmt;
1113
use crate::hash::{self, Hash};
1214
use crate::iter::TrustedLen;
@@ -119,6 +121,15 @@ impl fmt::Display for TryFromSliceError {
119121
}
120122
}
121123

124+
#[cfg(not(bootstrap))]
125+
#[stable(feature = "try_from", since = "1.34.0")]
126+
impl Error for TryFromSliceError {
127+
#[allow(deprecated)]
128+
fn description(&self) -> &str {
129+
self.__description()
130+
}
131+
}
132+
122133
impl TryFromSliceError {
123134
#[unstable(
124135
feature = "array_error_internals",

library/core/src/char/decode.rs

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! UTF-8 and UTF-16 decoding iterators
22
3+
#[cfg(not(bootstrap))]
4+
use crate::error::Error;
35
use crate::fmt;
46

57
use super::from_u32_unchecked;
@@ -121,3 +123,12 @@ impl fmt::Display for DecodeUtf16Error {
121123
write!(f, "unpaired surrogate found: {:x}", self.code)
122124
}
123125
}
126+
127+
#[cfg(not(bootstrap))]
128+
#[stable(feature = "decode_utf16", since = "1.9.0")]
129+
impl Error for DecodeUtf16Error {
130+
#[allow(deprecated)]
131+
fn description(&self) -> &str {
132+
"unpaired surrogate found"
133+
}
134+
}

library/core/src/char/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub use self::methods::encode_utf16_raw;
3636
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
3737
pub use self::methods::encode_utf8_raw;
3838

39+
#[cfg(not(bootstrap))]
40+
use crate::error::Error;
3941
use crate::fmt::{self, Write};
4042
use crate::iter::FusedIterator;
4143

@@ -582,3 +584,7 @@ impl fmt::Display for TryFromCharError {
582584
"unicode code point out of range".fmt(fmt)
583585
}
584586
}
587+
588+
#[cfg(not(bootstrap))]
589+
#[stable(feature = "u8_from_char", since = "1.59.0")]
590+
impl Error for TryFromCharError {}

library/core/src/convert/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
3535
#![stable(feature = "rust1", since = "1.0.0")]
3636

37+
#[cfg(not(bootstrap))]
38+
use crate::error::Error;
3739
use crate::fmt;
3840
use crate::hash::{Hash, Hasher};
3941

@@ -715,6 +717,14 @@ impl fmt::Display for Infallible {
715717
}
716718
}
717719

720+
#[cfg(not(bootstrap))]
721+
#[stable(feature = "str_parse_error2", since = "1.8.0")]
722+
impl Error for Infallible {
723+
fn description(&self) -> &str {
724+
match *self {}
725+
}
726+
}
727+
718728
#[stable(feature = "convert_infallible", since = "1.34.0")]
719729
impl PartialEq for Infallible {
720730
fn eq(&self, _: &Infallible) -> bool {

0 commit comments

Comments
 (0)