Skip to content

Commit 985c533

Browse files
Apply suggestions from code review
Co-authored-by: Ralf Jung <post@ralfj.de>
1 parent b2d94e3 commit 985c533

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • compiler/rustc_const_eval/src/interpret

compiler/rustc_const_eval/src/interpret/place.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ where
443443
/// `align` information is lost!
444444
/// This is the inverse of `imm_ptr_to_mplace`.
445445
///
446-
/// If `ptr_ty` is provided the resulting pointer will be of that type (instead of `*mut _`).
447-
/// `ptr_ty` must be a type with builtin deref which derefs to the type of `mplace` (`mplace.layout.ty`)
446+
/// If `ptr_ty` is provided, the resulting pointer will be of that type. Otherwise, it defaults to `*mut _`.
447+
/// `ptr_ty` must be a type with builtin deref which derefs to the type of `mplace` (`mplace.layout.ty`).
448448
pub fn mplace_to_imm_ptr(
449449
&self,
450450
mplace: &MPlaceTy<'tcx, M::Provenance>,
@@ -454,7 +454,7 @@ where
454454

455455
let ptr_ty = ptr_ty
456456
.inspect(|t| assert_eq!(t.builtin_deref(true), Some(mplace.layout.ty)))
457-
.unwrap_or(Ty::new_mut_ptr(self.tcx.tcx, mplace.layout.ty));
457+
.unwrap_or_else(|| Ty::new_mut_ptr(self.tcx.tcx, mplace.layout.ty));
458458

459459
let layout = self.layout_of(ptr_ty)?;
460460
interp_ok(ImmTy::from_immediate(imm, layout))

0 commit comments

Comments
 (0)