]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/interpret/validity.rs
Rollup merge of #71508 - oli-obk:alloc_map_unlock, r=RalfJung
[rust.git] / src / librustc_mir / interpret / validity.rs
index eb743675d91d3eceb843ff89d54fc3f42332bf9c..4f90f83b735d1e8c50adf02415ed26c17ecf6b0e 100644 (file)
@@ -366,7 +366,7 @@ fn check_safe_pointer(
         let place = try_validation!(
             self.ecx.ref_to_mplace(value),
             self.path,
-            err_ub!(InvalidUndefBytes(..)) => { "uninitialized {}", kind },
+            err_ub!(InvalidUninitBytes(..)) => { "uninitialized {}", kind },
         );
         if place.layout.is_unsized() {
             self.check_wide_ptr_meta(place.meta, place.layout)?;
@@ -416,7 +416,7 @@ fn check_safe_pointer(
             if let Some(ptr) = ptr {
                 // not a ZST
                 // Skip validation entirely for some external statics
-                let alloc_kind = self.ecx.tcx.alloc_map.lock().get(ptr.alloc_id);
+                let alloc_kind = self.ecx.tcx.get_global_alloc(ptr.alloc_id);
                 if let Some(GlobalAlloc::Static(did)) = alloc_kind {
                     // See const_eval::machine::MemoryExtra::can_access_statics for why
                     // this check is so important.
@@ -514,7 +514,7 @@ fn try_visit_primitive(
                 let place = try_validation!(
                     self.ecx.ref_to_mplace(self.ecx.read_immediate(value)?),
                     self.path,
-                    err_ub!(InvalidUndefBytes(..)) => { "uninitialized raw pointer" },
+                    err_ub!(InvalidUninitBytes(..)) => { "uninitialized raw pointer" },
                 );
                 if place.layout.is_unsized() {
                     self.check_wide_ptr_meta(place.meta, place.layout)?;
@@ -593,7 +593,7 @@ fn visit_scalar(
         let value = try_validation!(
             value.not_undef(),
             self.path,
-            err_ub!(InvalidUndefBytes(..)) => { "{}", value }
+            err_ub!(InvalidUninitBytes(..)) => { "{}", value }
                 expected { "something {}", wrapping_range_format(valid_range, max_hi) },
         );
         let bits = match value.to_bits_or_ptr(op.layout.size, self.ecx) {
@@ -803,7 +803,7 @@ fn visit_aggregate(
                         // For some errors we might be able to provide extra information.
                         // (This custom logic does not fit the `try_validation!` macro.)
                         match err.kind {
-                            err_ub!(InvalidUndefBytes(Some(ptr))) => {
+                            err_ub!(InvalidUninitBytes(Some(ptr))) => {
                                 // Some byte was uninitialized, determine which
                                 // element that byte belongs to so we can
                                 // provide an index.