]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/backtrace.rs
std: use `sync::Mutex` for internal statics
[rust.git] / library / std / src / backtrace.rs
index 34b57c37635cb44384ff7145b588150e1344a1d8..9cb74f951dd3721df31b3e74086bbe7a3f3e9e91 100644 (file)
@@ -325,8 +325,7 @@ pub const fn disabled() -> Backtrace {
     // Capture a backtrace which start just before the function addressed by
     // `ip`
     fn create(ip: usize) -> Backtrace {
-        // SAFETY: We don't attempt to lock this reentrantly.
-        let _lock = unsafe { lock() };
+        let _lock = lock();
         let mut frames = Vec::new();
         let mut actual_start = None;
         unsafe {
@@ -469,8 +468,7 @@ fn resolve(&mut self) {
         // Use the global backtrace lock to synchronize this as it's a
         // requirement of the `backtrace` crate, and then actually resolve
         // everything.
-        // SAFETY: We don't attempt to lock this reentrantly.
-        let _lock = unsafe { lock() };
+        let _lock = lock();
         for frame in self.frames.iter_mut() {
             let symbols = &mut frame.symbols;
             let frame = match &frame.frame {