]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/interpret/intrinsics.rs
Return Ok(false) instead of throwing when handling a diverging intrinsic
[rust.git] / src / librustc_mir / interpret / intrinsics.rs
index ce16b89d6ea8757f5b3b2a85e6d443e51df32c61..66b6d4ac12c402c38381c942a3d39df43ef52f30 100644 (file)
@@ -95,13 +95,12 @@ pub fn emulate_intrinsic(
     ) -> InterpResult<'tcx, bool> {
         let substs = instance.substs;
 
-        // The intrinsic itself cannot diverge, so if we got here without a return
-        // place... (can happen e.g., for transmute returning `!`)
+        // We currently do not handle any diverging intrinsics.
         let dest = match dest {
             Some(dest) => dest,
-            None => throw_ub!(Unreachable)
+            None => return Ok(false)
         };
-        let intrinsic_name = &self.tcx.item_name(instance.def_id()).as_str();
+        let intrinsic_name = &*self.tcx.item_name(instance.def_id()).as_str();
 
         match intrinsic_name {
             "caller_location" => {