diff --git a/src/lib.rs b/src/lib.rs
index 19f44188c..72f825d1f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -341,10 +341,6 @@
 #![warn(missing_docs)]
 #![deny(missing_debug_implementations, unconditional_recursion)]
 #![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
-// When compiled for the rustc compiler itself we want to make sure that this is
-// an unstable crate
-#![cfg_attr(rustbuild, feature(staged_api, rustc_private))]
-#![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))]
 
 #[cfg(any(
     all(feature = "max_level_off", feature = "max_level_error"),
@@ -1405,24 +1401,21 @@ fn set_logger_inner<F>(make_logger: F) -> Result<(), SetLoggerError>
 where
     F: FnOnce() -> &'static dyn Log,
 {
-    let old_state = match STATE.compare_exchange(
+    match STATE.compare_exchange(
         UNINITIALIZED,
         INITIALIZING,
-        Ordering::SeqCst,
-        Ordering::SeqCst,
+        Ordering::Acquire,
+        Ordering::Relaxed,
     ) {
-        Ok(s) | Err(s) => s,
-    };
-    match old_state {
-        UNINITIALIZED => {
+        Ok(UNINITIALIZED) => {
             unsafe {
                 LOGGER = make_logger();
             }
-            STATE.store(INITIALIZED, Ordering::SeqCst);
+            STATE.store(INITIALIZED, Ordering::Release);
             Ok(())
         }
-        INITIALIZING => {
-            while STATE.load(Ordering::SeqCst) == INITIALIZING {
+        Err(INITIALIZING) => {
+            while STATE.load(Ordering::Relaxed) == INITIALIZING {
                 std::hint::spin_loop();
             }
             Err(SetLoggerError(()))
@@ -1451,10 +1444,10 @@ where
 ///
 /// [`set_logger`]: fn.set_logger.html
 pub unsafe fn set_logger_racy(logger: &'static dyn Log) -> Result<(), SetLoggerError> {
-    match STATE.load(Ordering::SeqCst) {
+    match STATE.load(Ordering::Acquire) {
         UNINITIALIZED => {
             LOGGER = logger;
-            STATE.store(INITIALIZED, Ordering::SeqCst);
+            STATE.store(INITIALIZED, Ordering::Release);
             Ok(())
         }
         INITIALIZING => {
diff --git a/tests/Cargo.toml b/tests/Cargo.toml
index 8754bb16a..bc8621558 100644
--- a/tests/Cargo.toml
+++ b/tests/Cargo.toml
@@ -5,6 +5,9 @@ edition = "2021"
 publish = false
 build = "src/build.rs"
 
+[lints.rust]
+unexpected_cfgs = { level = "allow", check-cfg = ['cfg(lib_build)'] }
+
 [features]
 std = ["log/std"]
 kv = ["log/kv"]