about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src
diff options
context:
space:
mode:
authoroli <github35764891676564198441@oli-obk.de>2020-11-04 13:41:58 +0000
committeroli <github35764891676564198441@oli-obk.de>2020-11-04 13:41:58 +0000
commitabacaf2aef26043ce09e3aee176a9587bb87eaf6 (patch)
tree71dd864eabe7c9078a135beddbdf8853090f021e /compiler/rustc_codegen_cranelift/src
parente67c768110f2cd55d6823defcbfca5651fe1f9f5 (diff)
downloadrust-abacaf2aef26043ce09e3aee176a9587bb87eaf6.tar.gz
rust-abacaf2aef26043ce09e3aee176a9587bb87eaf6.zip
`u128` truncation and sign extension are not just interpreter related
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src')
-rw-r--r--compiler/rustc_codegen_cranelift/src/base.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs
index 2097f9d2887..bfe5514b6d3 100644
--- a/compiler/rustc_codegen_cranelift/src/base.rs
+++ b/compiler/rustc_codegen_cranelift/src/base.rs
@@ -585,10 +585,7 @@ fn codegen_stmt<'tcx>(
                                     .discriminant_for_variant(fx.tcx, *index)
                                     .unwrap();
                                 let discr = if discr.ty.is_signed() {
-                                    rustc_middle::mir::interpret::sign_extend(
-                                        discr.val,
-                                        fx.layout_of(discr.ty).size,
-                                    )
+                                    fx.layout_of(discr.ty).size.sign_extend(discr.val)
                                 } else {
                                     discr.val
                                 };