diff options
| author | Ralf Jung <post@ralfj.de> | 2023-09-11 20:01:48 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-09-14 07:26:24 +0200 |
| commit | 551f481ffb5b510cdb8cdf4d89d71f105b9b29ba (patch) | |
| tree | 305ce8917c7d6e02ea9ae8e24ca3d8df15e7eea4 /compiler/rustc_mir_transform/src | |
| parent | c728bf3963433062b91bd84ffcb37d15416b800e (diff) | |
| download | rust-551f481ffb5b510cdb8cdf4d89d71f105b9b29ba.tar.gz rust-551f481ffb5b510cdb8cdf4d89d71f105b9b29ba.zip | |
use AllocId instead of Allocation in ConstValue::ByRef
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/large_enums.rs | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 0c44bccbb4f..0ffd64904ec 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -535,7 +535,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } trace!("replacing {:?} with {:?}", place, value); - // FIXME> figure out what to do when read_immediate_raw fails + // FIXME: figure out what to do when read_immediate_raw fails let imm = self.ecx.read_immediate_raw(&value).ok()?; let Right(imm) = imm else { return None }; @@ -544,7 +544,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { Some(ConstantKind::from_scalar(self.tcx, scalar, value.layout.ty)) } Immediate::ScalarPair(l, r) if l.try_to_int().is_ok() && r.try_to_int().is_ok() => { - let alloc = self + let alloc_id = self .ecx .intern_with_temp_alloc(value.layout, |ecx, dest| { ecx.write_immediate(*imm, dest) @@ -552,7 +552,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { .ok()?; Some(ConstantKind::Val( - ConstValue::ByRef { alloc, offset: Size::ZERO }, + ConstValue::ByRef { alloc_id, offset: Size::ZERO }, value.layout.ty, )) } diff --git a/compiler/rustc_mir_transform/src/large_enums.rs b/compiler/rustc_mir_transform/src/large_enums.rs index 19108dabdf4..69489565212 100644 --- a/compiler/rustc_mir_transform/src/large_enums.rs +++ b/compiler/rustc_mir_transform/src/large_enums.rs @@ -139,7 +139,6 @@ impl EnumSizeOpt { let (adt_def, num_variants, alloc_id) = self.candidate(tcx, param_env, ty, &mut alloc_cache)?; - let alloc = tcx.global_alloc(alloc_id).unwrap_memory(); let tmp_ty = Ty::new_array(tcx, tcx.types.usize, num_variants as u64); @@ -154,7 +153,7 @@ impl EnumSizeOpt { span, user_ty: None, literal: ConstantKind::Val( - interpret::ConstValue::ByRef { alloc, offset: Size::ZERO }, + interpret::ConstValue::ByRef { alloc_id, offset: Size::ZERO }, tmp_ty, ), }; |
