From 6984030f80facdda72dd81c209fa19d1e830988e Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 11 Sep 2023 16:10:27 +0000 Subject: [PATCH] Use write_immediate. --- compiler/rustc_const_eval/src/interpret/intrinsics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index e886fd23ff5dd..3b58f66353b27 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -221,8 +221,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { sym::discriminant_value => { let place = self.deref_pointer(&args[0])?; let variant = self.read_discriminant(&place)?; - let discr = self.discriminant_for_variant(place.layout, variant)?.to_scalar(); - self.write_scalar(discr, dest)?; + let discr = self.discriminant_for_variant(place.layout, variant)?; + self.write_immediate(*discr, dest)?; } sym::exact_div => { let l = self.read_immediate(&args[0])?;