Skip to content

Commit

Permalink
always use a ref ty to do transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaic1 committed Sep 18, 2024
1 parent 94e15a6 commit bdf4b1e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,9 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
// Handle `str` as partial support for unsized constants
ty::Str => {
let tcx = self.tcx();
let ref_ty = if matches!(ct_ty.kind(), ty::Str) {
// HACK(jaic1): hide the `str` type behind a reference
// for the following transformation from valtree to raw bytes
Ty::new_imm_ref(tcx, tcx.lifetimes.re_static, ct_ty)
} else {
ct_ty
};
// HACK(jaic1): hide the `str` type behind a reference
// for the following transformation from valtree to raw bytes
let ref_ty = Ty::new_imm_ref(tcx, tcx.lifetimes.re_static, ct_ty);
let slice = valtree.try_to_raw_bytes(tcx, ref_ty).unwrap_or_else(|| {
bug!("expected to get raw bytes from valtree {:?} for type {:}", valtree, ct_ty)
});
Expand Down

0 comments on commit bdf4b1e

Please sign in to comment.