Skip to content

Commit

Permalink
Use AtomicU8 instead of AtomicUsize in backtrace.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Dec 10, 2023
1 parent c1a3919 commit 17edbe7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/std/src/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ use crate::env;
use crate::ffi::c_void;
use crate::fmt;
use crate::panic::UnwindSafe;
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
use crate::sync::atomic::{AtomicU8, Ordering::Relaxed};
use crate::sync::LazyLock;
use crate::sys_common::backtrace::{lock, output_filename, set_image_base};
use crate::vec::Vec;
Expand Down Expand Up @@ -255,7 +255,7 @@ impl Backtrace {
// Cache the result of reading the environment variables to make
// backtrace captures speedy, because otherwise reading environment
// variables every time can be somewhat slow.
static ENABLED: AtomicUsize = AtomicUsize::new(0);
static ENABLED: AtomicU8 = AtomicU8::new(0);
match ENABLED.load(Relaxed) {
0 => {}
1 => return false,
Expand All @@ -268,7 +268,7 @@ impl Backtrace {
Err(_) => false,
},
};
ENABLED.store(enabled as usize + 1, Relaxed);
ENABLED.store(enabled as u8 + 1, Relaxed);
enabled
}

Expand Down

0 comments on commit 17edbe7

Please sign in to comment.