Skip to content

Commit bdf4b1e

Browse files
committed
always use a ref ty to do transformation
1 parent 94e15a6 commit bdf4b1e

File tree

1 file changed

+3
-7
lines changed
  • compiler/rustc_symbol_mangling/src

1 file changed

+3
-7
lines changed

compiler/rustc_symbol_mangling/src/v0.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,9 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
596596
// Handle `str` as partial support for unsized constants
597597
ty::Str => {
598598
let tcx = self.tcx();
599-
let ref_ty = if matches!(ct_ty.kind(), ty::Str) {
600-
// HACK(jaic1): hide the `str` type behind a reference
601-
// for the following transformation from valtree to raw bytes
602-
Ty::new_imm_ref(tcx, tcx.lifetimes.re_static, ct_ty)
603-
} else {
604-
ct_ty
605-
};
599+
// HACK(jaic1): hide the `str` type behind a reference
600+
// for the following transformation from valtree to raw bytes
601+
let ref_ty = Ty::new_imm_ref(tcx, tcx.lifetimes.re_static, ct_ty);
606602
let slice = valtree.try_to_raw_bytes(tcx, ref_ty).unwrap_or_else(|| {
607603
bug!("expected to get raw bytes from valtree {:?} for type {:}", valtree, ct_ty)
608604
});

0 commit comments

Comments
 (0)