Stabilize no-std StdError trait

This commit is contained in:
David Tolnay 2024-09-06 11:09:11 -07:00
parent d549f048e1
commit 785c2d9605
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
4 changed files with 12 additions and 5 deletions

View File

@ -15,6 +15,7 @@ fn main() {
if minor >= 77 { if minor >= 77 {
println!("cargo:rustc-check-cfg=cfg(no_core_cstr)"); println!("cargo:rustc-check-cfg=cfg(no_core_cstr)");
println!("cargo:rustc-check-cfg=cfg(no_core_error)");
println!("cargo:rustc-check-cfg=cfg(no_core_net)"); println!("cargo:rustc-check-cfg=cfg(no_core_net)");
println!("cargo:rustc-check-cfg=cfg(no_core_num_saturating)"); println!("cargo:rustc-check-cfg=cfg(no_core_num_saturating)");
println!("cargo:rustc-check-cfg=cfg(no_core_try_from)"); println!("cargo:rustc-check-cfg=cfg(no_core_try_from)");
@ -98,6 +99,12 @@ fn main() {
if minor < 78 { if minor < 78 {
println!("cargo:rustc-cfg=no_diagnostic_namespace"); println!("cargo:rustc-cfg=no_diagnostic_namespace");
} }
// The Error trait became available in core in 1.81.
// https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#coreerrorerror
if minor < 81 {
println!("cargo:rustc-cfg=no_core_error");
}
} }
fn rustc_minor_version() -> Option<u32> { fn rustc_minor_version() -> Option<u32> {

View File

@ -124,10 +124,10 @@ pub(crate) mod size_hint;
pub use self::ignored_any::IgnoredAny; pub use self::ignored_any::IgnoredAny;
#[cfg(not(any(feature = "std", feature = "unstable")))] #[cfg(all(not(feature = "std"), no_core_error))]
#[doc(no_inline)] #[doc(no_inline)]
pub use crate::std_error::Error as StdError; pub use crate::std_error::Error as StdError;
#[cfg(all(feature = "unstable", not(feature = "std")))] #[cfg(not(any(feature = "std", no_core_error)))]
#[doc(no_inline)] #[doc(no_inline)]
pub use core::error::Error as StdError; pub use core::error::Error as StdError;
#[cfg(feature = "std")] #[cfg(feature = "std")]

View File

@ -325,7 +325,7 @@ pub mod __private;
#[path = "de/seed.rs"] #[path = "de/seed.rs"]
mod seed; mod seed;
#[cfg(not(any(feature = "std", feature = "unstable")))] #[cfg(all(not(feature = "std"), no_core_error))]
mod std_error; mod std_error;
// Re-export #[derive(Serialize, Deserialize)]. // Re-export #[derive(Serialize, Deserialize)].

View File

@ -115,10 +115,10 @@ mod impossible;
pub use self::impossible::Impossible; pub use self::impossible::Impossible;
#[cfg(not(any(feature = "std", feature = "unstable")))] #[cfg(all(not(feature = "std"), no_core_error))]
#[doc(no_inline)] #[doc(no_inline)]
pub use crate::std_error::Error as StdError; pub use crate::std_error::Error as StdError;
#[cfg(all(feature = "unstable", not(feature = "std")))] #[cfg(not(any(feature = "std", no_core_error)))]
#[doc(no_inline)] #[doc(no_inline)]
pub use core::error::Error as StdError; pub use core::error::Error as StdError;
#[cfg(feature = "std")] #[cfg(feature = "std")]