diff options
Diffstat (limited to 'compiler/rustc_public/src/alloc.rs')
| -rw-r--r-- | compiler/rustc_public/src/alloc.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_public/src/alloc.rs b/compiler/rustc_public/src/alloc.rs index d2db6c08bbc..0c35b3b25df 100644 --- a/compiler/rustc_public/src/alloc.rs +++ b/compiler/rustc_public/src/alloc.rs @@ -1,4 +1,4 @@ -//! Memory allocation implementation for StableMIR. +//! Memory allocation implementation for rustc_public. //! //! This module is responsible for constructing stable components. //! All operations requiring rustc queries must be delegated @@ -7,8 +7,8 @@ use rustc_abi::Align; use rustc_middle::mir::ConstValue; use rustc_middle::mir::interpret::AllocRange; -use rustc_public_bridge::bridge::SmirError; -use rustc_public_bridge::context::SmirCtxt; +use rustc_public_bridge::bridge::Error as _; +use rustc_public_bridge::context::CompilerCtxt; use rustc_public_bridge::{Tables, alloc}; use super::Error; @@ -33,9 +33,9 @@ fn new_empty_allocation(align: Align) -> Allocation { #[allow(rustc::usage_of_qualified_ty)] pub(crate) fn new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, - const_value: ConstValue<'tcx>, + const_value: ConstValue, tables: &mut Tables<'tcx, BridgeTys>, - cx: &SmirCtxt<'tcx, BridgeTys>, + cx: &CompilerCtxt<'tcx, BridgeTys>, ) -> Allocation { try_new_allocation(ty, const_value, tables, cx) .unwrap_or_else(|_| panic!("Failed to convert: {const_value:?} to {ty:?}")) @@ -44,9 +44,9 @@ pub(crate) fn new_allocation<'tcx>( #[allow(rustc::usage_of_qualified_ty)] pub(crate) fn try_new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, - const_value: ConstValue<'tcx>, + const_value: ConstValue, tables: &mut Tables<'tcx, BridgeTys>, - cx: &SmirCtxt<'tcx, BridgeTys>, + cx: &CompilerCtxt<'tcx, BridgeTys>, ) -> Result<Allocation, Error> { let layout = alloc::create_ty_and_layout(cx, ty).map_err(|e| Error::from_internal(e))?; match const_value { @@ -54,12 +54,12 @@ pub(crate) fn try_new_allocation<'tcx>( alloc::try_new_scalar(layout, scalar, cx).map(|alloc| alloc.stable(tables, cx)) } ConstValue::ZeroSized => Ok(new_empty_allocation(layout.align.abi)), - ConstValue::Slice { data, meta } => { - alloc::try_new_slice(layout, data, meta, cx).map(|alloc| alloc.stable(tables, cx)) + ConstValue::Slice { alloc_id, meta } => { + alloc::try_new_slice(layout, alloc_id, meta, cx).map(|alloc| alloc.stable(tables, cx)) } ConstValue::Indirect { alloc_id, offset } => { let alloc = alloc::try_new_indirect(alloc_id, cx); - use rustc_public_bridge::context::SmirAllocRange; + use rustc_public_bridge::context::AllocRangeHelpers; Ok(allocation_filter(&alloc.0, cx.alloc_range(offset, layout.size), tables, cx)) } } @@ -70,7 +70,7 @@ pub(super) fn allocation_filter<'tcx>( alloc: &rustc_middle::mir::interpret::Allocation, alloc_range: AllocRange, tables: &mut Tables<'tcx, BridgeTys>, - cx: &SmirCtxt<'tcx, BridgeTys>, + cx: &CompilerCtxt<'tcx, BridgeTys>, ) -> Allocation { alloc::allocation_filter(alloc, alloc_range, tables, cx) } |
