]> git.lizzy.rs Git - rust.git/blobdiff - src/helpers.rs
fix diagnostics printing when triggered during TLS dtor scheduling
[rust.git] / src / helpers.rs
index c1eaf4eb4865dddd381ca01468fc8b112675209c..d271b845c21511c14ca85ebffdb2d8dd676c0e32 100644 (file)
@@ -67,7 +67,7 @@ fn eval_path_scalar(
     fn eval_libc(&mut self, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
         self.eval_context_mut()
             .eval_path_scalar(&["libc", name])?
-            .not_undef()
+            .check_init()
     }
 
     /// Helper function to get a `libc` constant as an `i32`.
@@ -80,7 +80,7 @@ fn eval_libc_i32(&mut self, name: &str) -> InterpResult<'tcx, i32> {
     fn eval_windows(&mut self, module: &str, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
         self.eval_context_mut()
             .eval_path_scalar(&["std", "sys", "windows", module, name])?
-            .not_undef()
+            .check_init()
     }
 
     /// Helper function to get a `windows` constant as an `u64`.
@@ -92,14 +92,14 @@ fn eval_windows_u64(&mut self, module: &str, name: &str) -> InterpResult<'tcx, u
     /// Helper function to get the `TyAndLayout` of a `libc` type
     fn libc_ty_layout(&mut self, name: &str) -> InterpResult<'tcx, TyAndLayout<'tcx>> {
         let this = self.eval_context_mut();
-        let ty = this.resolve_path(&["libc", name]).monomorphic_ty(*this.tcx);
+        let ty = this.resolve_path(&["libc", name]).ty(*this.tcx, ty::ParamEnv::reveal_all());
         this.layout_of(ty)
     }
 
     /// Helper function to get the `TyAndLayout` of a `windows` type
     fn windows_ty_layout(&mut self, name: &str) -> InterpResult<'tcx, TyAndLayout<'tcx>> {
         let this = self.eval_context_mut();
-        let ty = this.resolve_path(&["std", "sys", "windows", "c", name]).monomorphic_ty(*this.tcx);
+        let ty = this.resolve_path(&["std", "sys", "windows", "c", name]).ty(*this.tcx, ty::ParamEnv::reveal_all());
         this.layout_of(ty)
     }
 
@@ -407,7 +407,7 @@ fn set_last_error(&mut self, scalar: Scalar<Tag>) -> InterpResult<'tcx> {
     fn get_last_error(&self) -> InterpResult<'tcx, Scalar<Tag>> {
         let this = self.eval_context_ref();
         let errno_place = this.machine.last_error.unwrap();
-        this.read_scalar(errno_place.into())?.not_undef()
+        this.read_scalar(errno_place.into())?.check_init()
     }
 
     /// Sets the last OS error using a `std::io::Error`. This function tries to produce the most
@@ -467,7 +467,7 @@ fn try_unwrap_io_result<T: From<i32>>(
             }
         }
     }
-    
+
     fn read_scalar_at_offset(
         &self,
         op: OpTy<'tcx, Tag>,