diff options
| author | Makai <m4kai410@gmail.com> | 2025-07-15 13:51:55 +0000 |
|---|---|---|
| committer | Makai <m4kai410@gmail.com> | 2025-07-18 18:49:12 +0000 |
| commit | ad0de062b50e521bd1ea100921d25021ab90b1e5 (patch) | |
| tree | 22b5c1cced37b4561d587489bf35be2d2ac46428 | |
| parent | 7f22e88fab428181401b0c9d3aaf972784a65383 (diff) | |
| download | rust-ad0de062b50e521bd1ea100921d25021ab90b1e5.tar.gz rust-ad0de062b50e521bd1ea100921d25021ab90b1e5.zip | |
use "helper" as a more descriptive name
| -rw-r--r-- | compiler/rustc_public/src/alloc.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_public/src/compiler_interface.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/internal.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/stable/mir.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/internal_cx/helpers.rs (renamed from compiler/rustc_public/src/unstable/internal_cx/traits.rs) | 6 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/internal_cx/mod.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/alloc.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/context/helpers.rs (renamed from compiler/rustc_public_bridge/src/context/traits.rs) | 8 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/context/impls.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_public_bridge/src/context/mod.rs | 4 |
10 files changed, 26 insertions, 26 deletions
diff --git a/compiler/rustc_public/src/alloc.rs b/compiler/rustc_public/src/alloc.rs index f2cb8a900a6..cb6cc37e829 100644 --- a/compiler/rustc_public/src/alloc.rs +++ b/compiler/rustc_public/src/alloc.rs @@ -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)) } } diff --git a/compiler/rustc_public/src/compiler_interface.rs b/compiler/rustc_public/src/compiler_interface.rs index 1e7a4223f3f..043064951d5 100644 --- a/compiler/rustc_public/src/compiler_interface.rs +++ b/compiler/rustc_public/src/compiler_interface.rs @@ -567,7 +567,7 @@ impl<'tcx> CompilerInterface for Container<'tcx, BridgeTys> { DefKind::Fn => ForeignItemKind::Fn(tables.fn_def(def_id)), DefKind::Static { .. } => ForeignItemKind::Static(tables.static_def(def_id)), DefKind::ForeignTy => { - use rustc_public_bridge::context::SmirTy; + use rustc_public_bridge::context::TyHelpers; ForeignItemKind::Type(tables.intern_ty(cx.new_foreign(def_id))) } def_kind => unreachable!("Unexpected kind for a foreign item: {:?}", def_kind), diff --git a/compiler/rustc_public/src/unstable/convert/internal.rs b/compiler/rustc_public/src/unstable/convert/internal.rs index 8a6238413b0..0571a03b62b 100644 --- a/compiler/rustc_public/src/unstable/convert/internal.rs +++ b/compiler/rustc_public/src/unstable/convert/internal.rs @@ -504,7 +504,7 @@ impl RustcInternal for ExistentialProjection { tables: &mut Tables<'_, BridgeTys>, tcx: impl InternalCx<'tcx>, ) -> Self::T<'tcx> { - use crate::unstable::internal_cx::SmirExistentialProjection; + use crate::unstable::internal_cx::ExistentialProjectionHelpers; tcx.new_from_args( self.def_id.0.internal(tables, tcx), self.generic_args.internal(tables, tcx), @@ -536,7 +536,7 @@ impl RustcInternal for ExistentialTraitRef { tables: &mut Tables<'_, BridgeTys>, tcx: impl InternalCx<'tcx>, ) -> Self::T<'tcx> { - use crate::unstable::internal_cx::SmirExistentialTraitRef; + use crate::unstable::internal_cx::ExistentialTraitRefHelpers; tcx.new_from_args( self.def_id.0.internal(tables, tcx), self.generic_args.internal(tables, tcx), @@ -552,7 +552,7 @@ impl RustcInternal for TraitRef { tables: &mut Tables<'_, BridgeTys>, tcx: impl InternalCx<'tcx>, ) -> Self::T<'tcx> { - use crate::unstable::internal_cx::SmirTraitRef; + use crate::unstable::internal_cx::TraitRefHelpers; tcx.new_from_args(self.def_id.0.internal(tables, tcx), self.args().internal(tables, tcx)) } } diff --git a/compiler/rustc_public/src/unstable/convert/stable/mir.rs b/compiler/rustc_public/src/unstable/convert/stable/mir.rs index 433e7a20f01..cb68129c660 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/mir.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/mir.rs @@ -821,7 +821,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation { tables: &mut Tables<'cx, BridgeTys>, cx: &CompilerCtxt<'cx, BridgeTys>, ) -> Self::T { - use rustc_public_bridge::context::SmirAllocRange; + use rustc_public_bridge::context::AllocRangeHelpers; alloc::allocation_filter( self, cx.alloc_range(rustc_abi::Size::ZERO, self.size()), diff --git a/compiler/rustc_public/src/unstable/internal_cx/traits.rs b/compiler/rustc_public/src/unstable/internal_cx/helpers.rs index da443cd78f1..da635c04d74 100644 --- a/compiler/rustc_public/src/unstable/internal_cx/traits.rs +++ b/compiler/rustc_public/src/unstable/internal_cx/helpers.rs @@ -5,7 +5,7 @@ use rustc_middle::ty; -pub(crate) trait SmirExistentialProjection<'tcx> { +pub(crate) trait ExistentialProjectionHelpers<'tcx> { fn new_from_args( &self, def_id: rustc_span::def_id::DefId, @@ -14,7 +14,7 @@ pub(crate) trait SmirExistentialProjection<'tcx> { ) -> ty::ExistentialProjection<'tcx>; } -pub(crate) trait SmirExistentialTraitRef<'tcx> { +pub(crate) trait ExistentialTraitRefHelpers<'tcx> { fn new_from_args( &self, trait_def_id: rustc_span::def_id::DefId, @@ -22,7 +22,7 @@ pub(crate) trait SmirExistentialTraitRef<'tcx> { ) -> ty::ExistentialTraitRef<'tcx>; } -pub(crate) trait SmirTraitRef<'tcx> { +pub(crate) trait TraitRefHelpers<'tcx> { fn new_from_args( &self, trait_def_id: rustc_span::def_id::DefId, diff --git a/compiler/rustc_public/src/unstable/internal_cx/mod.rs b/compiler/rustc_public/src/unstable/internal_cx/mod.rs index 6b0a06e304c..44fbfde8775 100644 --- a/compiler/rustc_public/src/unstable/internal_cx/mod.rs +++ b/compiler/rustc_public/src/unstable/internal_cx/mod.rs @@ -2,13 +2,13 @@ use rustc_middle::ty::{List, Ty, TyCtxt}; use rustc_middle::{mir, ty}; -pub(crate) use traits::*; +pub(crate) use helpers::*; use super::InternalCx; -pub(crate) mod traits; +pub(crate) mod helpers; -impl<'tcx, T: InternalCx<'tcx>> SmirExistentialProjection<'tcx> for T { +impl<'tcx, T: InternalCx<'tcx>> ExistentialProjectionHelpers<'tcx> for T { fn new_from_args( &self, def_id: rustc_span::def_id::DefId, @@ -19,7 +19,7 @@ impl<'tcx, T: InternalCx<'tcx>> SmirExistentialProjection<'tcx> for T { } } -impl<'tcx, T: InternalCx<'tcx>> SmirExistentialTraitRef<'tcx> for T { +impl<'tcx, T: InternalCx<'tcx>> ExistentialTraitRefHelpers<'tcx> for T { fn new_from_args( &self, trait_def_id: rustc_span::def_id::DefId, @@ -29,7 +29,7 @@ impl<'tcx, T: InternalCx<'tcx>> SmirExistentialTraitRef<'tcx> for T { } } -impl<'tcx, T: InternalCx<'tcx>> SmirTraitRef<'tcx> for T { +impl<'tcx, T: InternalCx<'tcx>> TraitRefHelpers<'tcx> for T { fn new_from_args( &self, trait_def_id: rustc_span::def_id::DefId, diff --git a/compiler/rustc_public_bridge/src/alloc.rs b/compiler/rustc_public_bridge/src/alloc.rs index 906e4aae9f2..c866b05e6cf 100644 --- a/compiler/rustc_public_bridge/src/alloc.rs +++ b/compiler/rustc_public_bridge/src/alloc.rs @@ -18,7 +18,7 @@ pub fn create_ty_and_layout<'tcx, B: Bridge>( cx: &CompilerCtxt<'tcx, B>, ty: Ty<'tcx>, ) -> Result<TyAndLayout<'tcx, Ty<'tcx>>, &'tcx layout::LayoutError<'tcx>> { - use crate::context::SmirTypingEnv; + use crate::context::TypingEnvHelpers; cx.tcx.layout_of(cx.fully_monomorphized().as_query_input(ty)) } diff --git a/compiler/rustc_public_bridge/src/context/traits.rs b/compiler/rustc_public_bridge/src/context/helpers.rs index 8483bee4aad..21eef29e5f1 100644 --- a/compiler/rustc_public_bridge/src/context/traits.rs +++ b/compiler/rustc_public_bridge/src/context/helpers.rs @@ -1,6 +1,6 @@ //! A set of traits that define a stable interface to rustc's internals. //! -//! These traits abstract rustc's internal APIs, allowing StableMIR to maintain a stable +//! These traits abstract rustc's internal APIs, allowing rustc_public to maintain a stable //! interface regardless of internal compiler changes. use rustc_middle::mir::interpret::AllocRange; @@ -8,14 +8,14 @@ use rustc_middle::ty; use rustc_middle::ty::Ty; use rustc_span::def_id::DefId; -pub trait SmirTy<'tcx> { +pub trait TyHelpers<'tcx> { fn new_foreign(&self, def_id: DefId) -> Ty<'tcx>; } -pub trait SmirTypingEnv<'tcx> { +pub trait TypingEnvHelpers<'tcx> { fn fully_monomorphized(&self) -> ty::TypingEnv<'tcx>; } -pub trait SmirAllocRange<'tcx> { +pub trait AllocRangeHelpers<'tcx> { fn alloc_range(&self, offset: rustc_abi::Size, size: rustc_abi::Size) -> AllocRange; } diff --git a/compiler/rustc_public_bridge/src/context/impls.rs b/compiler/rustc_public_bridge/src/context/impls.rs index 268aa6927d2..8079fc95f97 100644 --- a/compiler/rustc_public_bridge/src/context/impls.rs +++ b/compiler/rustc_public_bridge/src/context/impls.rs @@ -24,23 +24,23 @@ use rustc_span::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_span::{FileNameDisplayPreference, Span, Symbol}; use rustc_target::callconv::FnAbi; -use super::{SmirAllocRange, CompilerCtxt, SmirTy, SmirTypingEnv}; +use super::{AllocRangeHelpers, CompilerCtxt, TyHelpers, TypingEnvHelpers}; use crate::builder::BodyBuilder; use crate::{Bridge, SmirError, Tables, filter_def_ids}; -impl<'tcx, B: Bridge> SmirTy<'tcx> for CompilerCtxt<'tcx, B> { +impl<'tcx, B: Bridge> TyHelpers<'tcx> for CompilerCtxt<'tcx, B> { fn new_foreign(&self, def_id: DefId) -> ty::Ty<'tcx> { ty::Ty::new_foreign(self.tcx, def_id) } } -impl<'tcx, B: Bridge> SmirTypingEnv<'tcx> for CompilerCtxt<'tcx, B> { +impl<'tcx, B: Bridge> TypingEnvHelpers<'tcx> for CompilerCtxt<'tcx, B> { fn fully_monomorphized(&self) -> ty::TypingEnv<'tcx> { ty::TypingEnv::fully_monomorphized() } } -impl<'tcx, B: Bridge> SmirAllocRange<'tcx> for CompilerCtxt<'tcx, B> { +impl<'tcx, B: Bridge> AllocRangeHelpers<'tcx> for CompilerCtxt<'tcx, B> { fn alloc_range( &self, offset: rustc_abi::Size, @@ -426,7 +426,7 @@ impl<'tcx, B: Bridge> CompilerCtxt<'tcx, B> { /// Evaluate constant as a target usize. pub fn eval_target_usize(&self, cnst: MirConst<'tcx>) -> Result<u64, B::Error> { - use crate::context::SmirTypingEnv; + use crate::context::TypingEnvHelpers; cnst.try_eval_target_usize(self.tcx, self.fully_monomorphized()) .ok_or_else(|| B::Error::new(format!("Const `{cnst:?}` cannot be encoded as u64"))) } diff --git a/compiler/rustc_public_bridge/src/context/mod.rs b/compiler/rustc_public_bridge/src/context/mod.rs index d2fbf976a24..3aa5c33c57d 100644 --- a/compiler/rustc_public_bridge/src/context/mod.rs +++ b/compiler/rustc_public_bridge/src/context/mod.rs @@ -12,9 +12,9 @@ use rustc_middle::ty::{Ty, TyCtxt}; use crate::{Bridge, SmirError}; mod impls; -mod traits; +mod helpers; -pub use traits::*; +pub use helpers::*; /// Provides direct access to rustc's internal queries. /// |
