Skip to content

Commit 0da702a

Browse files
committed
Remove an instance of scalar_size in a Debug impl
1 parent ff652b8 commit 0da702a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustc/mir/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,8 +1149,12 @@ impl<'tcx> TerminatorKind<'tcx> {
11491149
Return | Resume | Abort | Unreachable | GeneratorDrop => vec![],
11501150
Goto { .. } => vec!["".into()],
11511151
SwitchInt { ref values, switch_ty, .. } => {
1152-
let size = ty::tls::with(|tcx| switch_ty.scalar_size(tcx));
1153-
let size = size.map_or(0, |size| size.bits()) as u8;
1152+
let size = ty::tls::with(|tcx| {
1153+
let param_env = ty::ParamEnv::empty();
1154+
let tcx = tcx.global_tcx();
1155+
let switch_ty = tcx.lift(&switch_ty).unwrap();
1156+
tcx.layout_of(param_env.and(switch_ty)).unwrap().size.bits() as u8
1157+
});
11541158
values.iter()
11551159
.map(|&u| {
11561160
let mut s = String::new();

0 commit comments

Comments
 (0)