diff options
| author | Ralf Jung <post@ralfj.de> | 2023-11-18 08:24:02 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-11-18 08:24:02 +0100 |
| commit | b4f3f2aeacfc629e57eca6cabc27a00cf4cf2375 (patch) | |
| tree | b666799ef256be6a2d716afc8ff5e91ad243ef25 /compiler/rustc_const_eval/src/interpret | |
| parent | e6dade96f4f16b2c0f621d657130b90b4bb519a2 (diff) | |
| download | rust-b4f3f2aeacfc629e57eca6cabc27a00cf4cf2375.tar.gz rust-b4f3f2aeacfc629e57eca6cabc27a00cf4cf2375.zip | |
guarantee that char and u32 are ABI-compatible
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/terminator.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index b54c6681456..e85ee437fad 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -384,10 +384,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } // Compatible integer types (in particular, usize vs ptr-sized-u32/u64). + // `char` counts as `u32.` let int_ty = |ty: Ty<'tcx>| { Some(match ty.kind() { ty::Int(ity) => (Integer::from_int_ty(&self.tcx, *ity), /* signed */ true), ty::Uint(uty) => (Integer::from_uint_ty(&self.tcx, *uty), /* signed */ false), + ty::Char => (Integer::I32, /* signed */ false), _ => return None, }) }; |
