Skip to content

Commit 26eca4c

Browse files
committed
use "helper" as a more descriptive name
1 parent ea3bb05 commit 26eca4c

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

compiler/rustc_public/src/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(crate) fn try_new_allocation<'tcx>(
5959
}
6060
ConstValue::Indirect { alloc_id, offset } => {
6161
let alloc = alloc::try_new_indirect(alloc_id, cx);
62-
use rustc_public_bridge::context::SmirAllocRange;
62+
use rustc_public_bridge::context::AllocRangeHelpers;
6363
Ok(allocation_filter(&alloc.0, cx.alloc_range(offset, layout.size), tables, cx))
6464
}
6565
}

compiler/rustc_public/src/compiler_interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ impl<'tcx> CompilerInterface for Container<'tcx, BridgeTys> {
567567
DefKind::Fn => ForeignItemKind::Fn(tables.fn_def(def_id)),
568568
DefKind::Static { .. } => ForeignItemKind::Static(tables.static_def(def_id)),
569569
DefKind::ForeignTy => {
570-
use rustc_public_bridge::context::SmirTy;
570+
use rustc_public_bridge::context::TyHelpers;
571571
ForeignItemKind::Type(tables.intern_ty(cx.new_foreign(def_id)))
572572
}
573573
def_kind => unreachable!("Unexpected kind for a foreign item: {:?}", def_kind),

compiler/rustc_public/src/unstable/convert/internal.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl RustcInternal for ExistentialProjection {
504504
tables: &mut Tables<'_, BridgeTys>,
505505
tcx: impl InternalCx<'tcx>,
506506
) -> Self::T<'tcx> {
507-
use crate::unstable::internal_cx::SmirExistentialProjection;
507+
use crate::unstable::internal_cx::ExistentialProjectionHelpers;
508508
tcx.new_from_args(
509509
self.def_id.0.internal(tables, tcx),
510510
self.generic_args.internal(tables, tcx),
@@ -536,7 +536,7 @@ impl RustcInternal for ExistentialTraitRef {
536536
tables: &mut Tables<'_, BridgeTys>,
537537
tcx: impl InternalCx<'tcx>,
538538
) -> Self::T<'tcx> {
539-
use crate::unstable::internal_cx::SmirExistentialTraitRef;
539+
use crate::unstable::internal_cx::ExistentialTraitRefHelpers;
540540
tcx.new_from_args(
541541
self.def_id.0.internal(tables, tcx),
542542
self.generic_args.internal(tables, tcx),
@@ -552,7 +552,7 @@ impl RustcInternal for TraitRef {
552552
tables: &mut Tables<'_, BridgeTys>,
553553
tcx: impl InternalCx<'tcx>,
554554
) -> Self::T<'tcx> {
555-
use crate::unstable::internal_cx::SmirTraitRef;
555+
use crate::unstable::internal_cx::TraitRefHelpers;
556556
tcx.new_from_args(self.def_id.0.internal(tables, tcx), self.args().internal(tables, tcx))
557557
}
558558
}

compiler/rustc_public/src/unstable/convert/stable/mir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation {
821821
tables: &mut Tables<'cx, BridgeTys>,
822822
cx: &CompilerCtxt<'cx, BridgeTys>,
823823
) -> Self::T {
824-
use rustc_public_bridge::context::SmirAllocRange;
824+
use rustc_public_bridge::context::AllocRangeHelpers;
825825
alloc::allocation_filter(
826826
self,
827827
cx.alloc_range(rustc_abi::Size::ZERO, self.size()),

compiler/rustc_public/src/unstable/internal_cx/traits.rs renamed to compiler/rustc_public/src/unstable/internal_cx/helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use rustc_middle::ty;
77

8-
pub(crate) trait SmirExistentialProjection<'tcx> {
8+
pub(crate) trait ExistentialProjectionHelpers<'tcx> {
99
fn new_from_args(
1010
&self,
1111
def_id: rustc_span::def_id::DefId,
@@ -14,15 +14,15 @@ pub(crate) trait SmirExistentialProjection<'tcx> {
1414
) -> ty::ExistentialProjection<'tcx>;
1515
}
1616

17-
pub(crate) trait SmirExistentialTraitRef<'tcx> {
17+
pub(crate) trait ExistentialTraitRefHelpers<'tcx> {
1818
fn new_from_args(
1919
&self,
2020
trait_def_id: rustc_span::def_id::DefId,
2121
args: ty::GenericArgsRef<'tcx>,
2222
) -> ty::ExistentialTraitRef<'tcx>;
2323
}
2424

25-
pub(crate) trait SmirTraitRef<'tcx> {
25+
pub(crate) trait TraitRefHelpers<'tcx> {
2626
fn new_from_args(
2727
&self,
2828
trait_def_id: rustc_span::def_id::DefId,

compiler/rustc_public/src/unstable/internal_cx/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
33
use rustc_middle::ty::{List, Ty, TyCtxt};
44
use rustc_middle::{mir, ty};
5-
pub(crate) use traits::*;
5+
pub(crate) use helpers::*;
66

77
use super::InternalCx;
88

9-
pub(crate) mod traits;
9+
pub(crate) mod helpers;
1010

11-
impl<'tcx, T: InternalCx<'tcx>> SmirExistentialProjection<'tcx> for T {
11+
impl<'tcx, T: InternalCx<'tcx>> ExistentialProjectionHelpers<'tcx> for T {
1212
fn new_from_args(
1313
&self,
1414
def_id: rustc_span::def_id::DefId,
@@ -19,7 +19,7 @@ impl<'tcx, T: InternalCx<'tcx>> SmirExistentialProjection<'tcx> for T {
1919
}
2020
}
2121

22-
impl<'tcx, T: InternalCx<'tcx>> SmirExistentialTraitRef<'tcx> for T {
22+
impl<'tcx, T: InternalCx<'tcx>> ExistentialTraitRefHelpers<'tcx> for T {
2323
fn new_from_args(
2424
&self,
2525
trait_def_id: rustc_span::def_id::DefId,
@@ -29,7 +29,7 @@ impl<'tcx, T: InternalCx<'tcx>> SmirExistentialTraitRef<'tcx> for T {
2929
}
3030
}
3131

32-
impl<'tcx, T: InternalCx<'tcx>> SmirTraitRef<'tcx> for T {
32+
impl<'tcx, T: InternalCx<'tcx>> TraitRefHelpers<'tcx> for T {
3333
fn new_from_args(
3434
&self,
3535
trait_def_id: rustc_span::def_id::DefId,

compiler/rustc_public_bridge/src/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn create_ty_and_layout<'tcx, B: Bridge>(
1818
cx: &CompilerCtxt<'tcx, B>,
1919
ty: Ty<'tcx>,
2020
) -> Result<TyAndLayout<'tcx, Ty<'tcx>>, &'tcx layout::LayoutError<'tcx>> {
21-
use crate::context::SmirTypingEnv;
21+
use crate::context::TypingEnvHelpers;
2222
cx.tcx.layout_of(cx.fully_monomorphized().as_query_input(ty))
2323
}
2424

Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
//! A set of traits that define a stable interface to rustc's internals.
22
//!
3-
//! These traits abstract rustc's internal APIs, allowing StableMIR to maintain a stable
3+
//! These traits abstract rustc's internal APIs, allowing rustc_public to maintain a stable
44
//! interface regardless of internal compiler changes.
55
66
use rustc_middle::mir::interpret::AllocRange;
77
use rustc_middle::ty;
88
use rustc_middle::ty::Ty;
99
use rustc_span::def_id::DefId;
1010

11-
pub trait SmirTy<'tcx> {
11+
pub trait TyHelpers<'tcx> {
1212
fn new_foreign(&self, def_id: DefId) -> Ty<'tcx>;
1313
}
1414

15-
pub trait SmirTypingEnv<'tcx> {
15+
pub trait TypingEnvHelpers<'tcx> {
1616
fn fully_monomorphized(&self) -> ty::TypingEnv<'tcx>;
1717
}
1818

19-
pub trait SmirAllocRange<'tcx> {
19+
pub trait AllocRangeHelpers<'tcx> {
2020
fn alloc_range(&self, offset: rustc_abi::Size, size: rustc_abi::Size) -> AllocRange;
2121
}

compiler/rustc_public_bridge/src/context/impls.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ use rustc_span::def_id::{CrateNum, DefId, LOCAL_CRATE};
2424
use rustc_span::{FileNameDisplayPreference, Span, Symbol};
2525
use rustc_target::callconv::FnAbi;
2626

27-
use super::{SmirAllocRange, CompilerCtxt, SmirTy, SmirTypingEnv};
27+
use super::{AllocRangeHelpers, CompilerCtxt, TyHelpers, TypingEnvHelpers};
2828
use crate::builder::BodyBuilder;
2929
use crate::{Bridge, SmirError, Tables, filter_def_ids};
3030

31-
impl<'tcx, B: Bridge> SmirTy<'tcx> for CompilerCtxt<'tcx, B> {
31+
impl<'tcx, B: Bridge> TyHelpers<'tcx> for CompilerCtxt<'tcx, B> {
3232
fn new_foreign(&self, def_id: DefId) -> ty::Ty<'tcx> {
3333
ty::Ty::new_foreign(self.tcx, def_id)
3434
}
3535
}
3636

37-
impl<'tcx, B: Bridge> SmirTypingEnv<'tcx> for CompilerCtxt<'tcx, B> {
37+
impl<'tcx, B: Bridge> TypingEnvHelpers<'tcx> for CompilerCtxt<'tcx, B> {
3838
fn fully_monomorphized(&self) -> ty::TypingEnv<'tcx> {
3939
ty::TypingEnv::fully_monomorphized()
4040
}
4141
}
4242

43-
impl<'tcx, B: Bridge> SmirAllocRange<'tcx> for CompilerCtxt<'tcx, B> {
43+
impl<'tcx, B: Bridge> AllocRangeHelpers<'tcx> for CompilerCtxt<'tcx, B> {
4444
fn alloc_range(
4545
&self,
4646
offset: rustc_abi::Size,
@@ -426,7 +426,7 @@ impl<'tcx, B: Bridge> CompilerCtxt<'tcx, B> {
426426

427427
/// Evaluate constant as a target usize.
428428
pub fn eval_target_usize(&self, cnst: MirConst<'tcx>) -> Result<u64, B::Error> {
429-
use crate::context::SmirTypingEnv;
429+
use crate::context::TypingEnvHelpers;
430430
cnst.try_eval_target_usize(self.tcx, self.fully_monomorphized())
431431
.ok_or_else(|| B::Error::new(format!("Const `{cnst:?}` cannot be encoded as u64")))
432432
}

compiler/rustc_public_bridge/src/context/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use rustc_middle::ty::{Ty, TyCtxt};
1212
use crate::{Bridge, SmirError};
1313

1414
mod impls;
15-
mod traits;
15+
mod helpers;
1616

17-
pub use traits::*;
17+
pub use helpers::*;
1818

1919
/// Provides direct access to rustc's internal queries.
2020
///

0 commit comments

Comments
 (0)