]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #1290 - RalfJung:rustup, r=RalfJung
authorbors <bors@rust-lang.org>
Wed, 1 Apr 2020 17:59:33 +0000 (17:59 +0000)
committerbors <bors@rust-lang.org>
Wed, 1 Apr 2020 17:59:33 +0000 (17:59 +0000)
Rustup

Also remove ICEing `breakpoint` intrinsic shim.

1  2 
src/helpers.rs

diff --combined src/helpers.rs
index 7d22b85b18ebfd743b2f6e148ccb4543acfe3903,e95b0d850b68f970f9f78f029b9fa6618b8579e6..568e9c925d55a28e6bfc114e82a3ddd395687866
@@@ -73,23 -73,17 +73,23 @@@ pub trait EvalContextExt<'mir, 'tcx: 'm
              .not_undef()
      }
  
 +    /// Helper function to get a `libc` constant as an `i32`.
 +    fn eval_libc_i32(&mut self, name: &str) -> InterpResult<'tcx, i32> {
 +        // TODO: Cache the result.
 +        self.eval_libc(name)?.to_i32()
 +    }
 +
      /// Helper function to get a `windows` constant as a `Scalar`.
 -    fn eval_windows(&mut self, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
 +    fn eval_windows(&mut self, module: &str, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
          self.eval_context_mut()
 -            .eval_path_scalar(&["std", "sys", "windows", "c", name])?
 +            .eval_path_scalar(&["std", "sys", "windows", module, name])?
              .not_undef()
      }
  
 -    /// Helper function to get a `libc` constant as an `i32`.
 -    fn eval_libc_i32(&mut self, name: &str) -> InterpResult<'tcx, i32> {
 +    /// Helper function to get a `windows` constant as an `u64`.
 +    fn eval_windows_u64(&mut self, module: &str, name: &str) -> InterpResult<'tcx, u64> {
          // TODO: Cache the result.
 -        self.eval_libc(name)?.to_i32()
 +        self.eval_windows(module, name)?.to_u64()
      }
  
      /// Helper function to get the `TyAndLayout` of a `libc` type
          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);
 +        this.layout_of(ty)
 +    }
 +
      /// Write a 0 of the appropriate size to `dest`.
      fn write_null(&mut self, dest: PlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
          self.eval_context_mut().write_scalar(Scalar::from_int(0, dest.layout.size), dest)
      fn local_place(&mut self, local: mir::Local) -> InterpResult<'tcx, PlaceTy<'tcx, Tag>> {
          let this = self.eval_context_mut();
          let place = mir::Place { local: local, projection: List::empty() };
-         this.eval_place(&place)
+         this.eval_place(place)
      }
  
      /// Generate some random bytes, and write them to `dest`.
          }
      }
  
 -    // Writes several `ImmTy`s contiguosly into memory. This is useful when you have to pack
 +    // Writes several `ImmTy`s contiguously into memory. This is useful when you have to pack
      // different values into a struct.
      fn write_packed_immediates(
          &mut self,
              })?
          } else if target_os == "windows" {
              // FIXME: we have to finish implementing the Windows equivalent of this.
 -            this.eval_windows(match e.kind() {
 +            this.eval_windows("c", match e.kind() {
                  NotFound => "ERROR_FILE_NOT_FOUND",
                  _ => throw_unsup_format!("io error {} cannot be transformed into a raw os error", e)
              })?