diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-07-22 00:54:27 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-22 00:54:27 +0800 |
| commit | 2e0748b1858079062284e116d0730a8156a1dab7 (patch) | |
| tree | f2b876b2b5cfe346eb7a73f9ded4e8d92edefb4a /compiler/rustc_public/src/alloc.rs | |
| parent | 38efe3875aac14e282e64623e241acdf973d0f63 (diff) | |
| parent | 20a7f722d824ebc4e733ec848d797088363624e9 (diff) | |
| download | rust-2e0748b1858079062284e116d0730a8156a1dab7.tar.gz rust-2e0748b1858079062284e116d0730a8156a1dab7.zip | |
Rollup merge of #143985 - makai410:rp-rename, r=oli-obk
rustc_public: de-StableMIR-ize This PR updates relevant docs about StableMIR, basically just rewording StableMIR/SMIR to rustc_public/rustc_public's IR. The README.md in the `rustc_public` crate is out-dated. I plan to rewrite it after we fork rustc_public into its own repository. This PR doesn't change the fact that we still use `-Z unpretty=stable-mir` as a rustc parameter for printing the IR, since I feel it's a bit verbose and weird if we use `-Z unpretty=rustc-public-ir`. I was wondering if we can have a short and easy alias for rustc_public's IR.
Diffstat (limited to 'compiler/rustc_public/src/alloc.rs')
| -rw-r--r-- | compiler/rustc_public/src/alloc.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_public/src/alloc.rs b/compiler/rustc_public/src/alloc.rs index d2db6c08bbc..75ad31022ff 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; @@ -35,7 +35,7 @@ pub(crate) fn new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, const_value: ConstValue<'tcx>, 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:?}")) @@ -46,7 +46,7 @@ pub(crate) fn try_new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, const_value: ConstValue<'tcx>, 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 { @@ -59,7 +59,7 @@ pub(crate) fn try_new_allocation<'tcx>( } 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) } |
