From 2034697617b8e663fc95be4ac51308424ef0c874 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 14 Jun 2024 10:42:44 -0700 Subject: [PATCH] Invert core error cfg, until stable --- build.rs | 6 +++--- src/exception.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index 3e5c29abd..3903b287c 100644 --- a/build.rs +++ b/build.rs @@ -32,7 +32,7 @@ fn main() { println!("cargo:rustc-check-cfg=cfg(compile_error_if_alloc)"); println!("cargo:rustc-check-cfg=cfg(compile_error_if_std)"); println!("cargo:rustc-check-cfg=cfg(cxx_experimental_no_alloc)"); - println!("cargo:rustc-check-cfg=cfg(no_core_error)"); + println!("cargo:rustc-check-cfg=cfg(error_in_core)"); println!("cargo:rustc-check-cfg=cfg(no_core_ffi_c_char)"); println!("cargo:rustc-check-cfg=cfg(skip_ui_tests)"); } @@ -50,9 +50,9 @@ fn main() { println!("cargo:rustc-cfg=no_core_ffi_c_char"); } - if rustc.minor < 81 { + if rustc.minor >= 81 { // core::error::Error - println!("cargo:rustc-cfg=no_core_error"); + println!("cargo:rustc-cfg=error_in_core"); } } } diff --git a/src/exception.rs b/src/exception.rs index 182aa624d..9831f997f 100644 --- a/src/exception.rs +++ b/src/exception.rs @@ -3,9 +3,9 @@ use alloc::boxed::Box; use core::fmt::{self, Display}; -#[cfg(not(no_core_error))] +#[cfg(error_in_core)] use core::error::Error as StdError; -#[cfg(all(feature = "std", no_core_error))] +#[cfg(all(feature = "std", not(error_in_core)))] use std::error::Error as StdError; /// Exception thrown from an `extern "C++"` function. @@ -21,7 +21,7 @@ impl Display for Exception { } } -#[cfg(any(not(no_core_error), feature = "std"))] +#[cfg(any(error_in_core, feature = "std"))] impl StdError for Exception {} impl Exception {