From 966fc577894c283a1285c8554c10fc56ba67e58c Mon Sep 17 00:00:00 2001 From: Makai Date: Tue, 15 Jul 2025 13:13:03 +0000 Subject: `SmirCtxt` to `CompilerCtxt`, `SmirInterface` to `CompilerInterface` aaa --- compiler/rustc_public/src/compiler_interface.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'compiler/rustc_public/src/compiler_interface.rs') diff --git a/compiler/rustc_public/src/compiler_interface.rs b/compiler/rustc_public/src/compiler_interface.rs index d15438c2b80..84c0ea973b7 100644 --- a/compiler/rustc_public/src/compiler_interface.rs +++ b/compiler/rustc_public/src/compiler_interface.rs @@ -6,7 +6,7 @@ use std::cell::Cell; use rustc_hir::def::DefKind; -use rustc_public_bridge::context::SmirCtxt; +use rustc_public_bridge::context::CompilerCtxt; use rustc_public_bridge::{Bridge, SmirContainer}; use tracing::debug; @@ -66,13 +66,13 @@ impl Bridge for BridgeTys { type Allocation = crate::ty::Allocation; } -/// Stable public API for querying compiler information. +/// Public API for querying compiler information. /// -/// All queries are delegated to [`rustc_public_bridge::context::SmirCtxt`] that provides +/// All queries are delegated to [`rustc_public_bridge::context::CompilerCtxt`] that provides /// similar APIs but based on internal rustc constructs. /// /// Do not use this directly. This is currently used in the macro expansion. -pub(crate) trait SmirInterface { +pub(crate) trait CompilerInterface { fn entry_fn(&self) -> Option; /// Retrieve all items of the local crate that have a MIR associated with them. fn all_local_items(&self) -> CrateItems; @@ -316,7 +316,7 @@ pub(crate) trait SmirInterface { fn associated_items(&self, def_id: DefId) -> AssocItems; } -impl<'tcx> SmirInterface for SmirContainer<'tcx, BridgeTys> { +impl<'tcx> CompilerInterface for SmirContainer<'tcx, BridgeTys> { fn entry_fn(&self) -> Option { let mut tables = self.tables.borrow_mut(); let cx = &*self.cx.borrow(); @@ -1059,10 +1059,10 @@ impl<'tcx> SmirInterface for SmirContainer<'tcx, BridgeTys> { } } -// A thread local variable that stores a pointer to [`SmirInterface`]. +// A thread local variable that stores a pointer to [`CompilerInterface`]. scoped_tls::scoped_thread_local!(static TLV: Cell<*const ()>); -pub(crate) fn run(interface: &dyn SmirInterface, f: F) -> Result +pub(crate) fn run(interface: &dyn CompilerInterface, f: F) -> Result where F: FnOnce() -> T, { @@ -1074,21 +1074,21 @@ where } } -/// Execute the given function with access the [`SmirInterface`]. +/// Execute the given function with access the [`CompilerInterface`]. /// /// I.e., This function will load the current interface and calls a function with it. /// Do not nest these, as that will ICE. -pub(crate) fn with(f: impl FnOnce(&dyn SmirInterface) -> R) -> R { +pub(crate) fn with(f: impl FnOnce(&dyn CompilerInterface) -> R) -> R { assert!(TLV.is_set()); TLV.with(|tlv| { let ptr = tlv.get(); assert!(!ptr.is_null()); - f(unsafe { *(ptr as *const &dyn SmirInterface) }) + f(unsafe { *(ptr as *const &dyn CompilerInterface) }) }) } fn smir_crate<'tcx>( - cx: &SmirCtxt<'tcx, BridgeTys>, + cx: &CompilerCtxt<'tcx, BridgeTys>, crate_num: rustc_span::def_id::CrateNum, ) -> Crate { let name = cx.crate_name(crate_num); -- cgit 1.4.1-3-g733a5 From 7f22e88fab428181401b0c9d3aaf972784a65383 Mon Sep 17 00:00:00 2001 From: Makai Date: Tue, 15 Jul 2025 13:21:41 +0000 Subject: `SmirContainer` to `Container` --- compiler/rustc_public/src/compiler_interface.rs | 4 ++-- compiler/rustc_public/src/rustc_internal/mod.rs | 8 ++++---- compiler/rustc_public_bridge/src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_public/src/compiler_interface.rs') diff --git a/compiler/rustc_public/src/compiler_interface.rs b/compiler/rustc_public/src/compiler_interface.rs index 84c0ea973b7..1e7a4223f3f 100644 --- a/compiler/rustc_public/src/compiler_interface.rs +++ b/compiler/rustc_public/src/compiler_interface.rs @@ -7,7 +7,7 @@ use std::cell::Cell; use rustc_hir::def::DefKind; use rustc_public_bridge::context::CompilerCtxt; -use rustc_public_bridge::{Bridge, SmirContainer}; +use rustc_public_bridge::{Bridge, Container}; use tracing::debug; use crate::abi::{FnAbi, Layout, LayoutShape, ReprOptions}; @@ -316,7 +316,7 @@ pub(crate) trait CompilerInterface { fn associated_items(&self, def_id: DefId) -> AssocItems; } -impl<'tcx> CompilerInterface for SmirContainer<'tcx, BridgeTys> { +impl<'tcx> CompilerInterface for Container<'tcx, BridgeTys> { fn entry_fn(&self) -> Option { let mut tables = self.tables.borrow_mut(); let cx = &*self.cx.borrow(); diff --git a/compiler/rustc_public/src/rustc_internal/mod.rs b/compiler/rustc_public/src/rustc_internal/mod.rs index 0e1c857e8b1..ca999b62f80 100644 --- a/compiler/rustc_public/src/rustc_internal/mod.rs +++ b/compiler/rustc_public/src/rustc_internal/mod.rs @@ -7,7 +7,7 @@ use std::cell::{Cell, RefCell}; use rustc_middle::ty::TyCtxt; use rustc_public_bridge::context::CompilerCtxt; -use rustc_public_bridge::{Bridge, SmirContainer, Tables}; +use rustc_public_bridge::{Bridge, Container, Tables}; use rustc_span::def_id::CrateNum; use scoped_tls::scoped_thread_local; @@ -60,7 +60,7 @@ pub fn crate_num(item: &crate::Crate) -> CrateNum { // datastructures and stable MIR datastructures scoped_thread_local! (static TLV: Cell<*const ()>); -pub(crate) fn init<'tcx, F, T, B: Bridge>(container: &SmirContainer<'tcx, B>, f: F) -> T +pub(crate) fn init<'tcx, F, T, B: Bridge>(container: &Container<'tcx, B>, f: F) -> T where F: FnOnce() -> T, { @@ -78,7 +78,7 @@ pub(crate) fn with_container( TLV.with(|tlv| { let ptr = tlv.get(); assert!(!ptr.is_null()); - let container = ptr as *const SmirContainer<'_, B>; + let container = ptr as *const Container<'_, B>; let mut tables = unsafe { (*container).tables.borrow_mut() }; let cx = unsafe { (*container).cx.borrow() }; f(&mut *tables, &*cx) @@ -90,7 +90,7 @@ where F: FnOnce() -> T, { let compiler_cx = RefCell::new(CompilerCtxt::new(tcx)); - let container = SmirContainer { tables: RefCell::new(Tables::default()), cx: compiler_cx }; + let container = Container { tables: RefCell::new(Tables::default()), cx: compiler_cx }; crate::compiler_interface::run(&container, || init(&container, f)) } diff --git a/compiler/rustc_public_bridge/src/lib.rs b/compiler/rustc_public_bridge/src/lib.rs index 7f58430ea49..2bb259a857c 100644 --- a/compiler/rustc_public_bridge/src/lib.rs +++ b/compiler/rustc_public_bridge/src/lib.rs @@ -46,7 +46,7 @@ pub mod context; pub mod rustc_internal {} /// A container which is used for TLS. -pub struct SmirContainer<'tcx, B: Bridge> { +pub struct Container<'tcx, B: Bridge> { pub tables: RefCell>, pub cx: RefCell>, } -- cgit 1.4.1-3-g733a5 From ad0de062b50e521bd1ea100921d25021ab90b1e5 Mon Sep 17 00:00:00 2001 From: Makai Date: Tue, 15 Jul 2025 13:51:55 +0000 Subject: use "helper" as a more descriptive name --- compiler/rustc_public/src/alloc.rs | 2 +- compiler/rustc_public/src/compiler_interface.rs | 2 +- .../rustc_public/src/unstable/convert/internal.rs | 6 ++--- .../src/unstable/convert/stable/mir.rs | 2 +- .../src/unstable/internal_cx/helpers.rs | 31 ++++++++++++++++++++++ .../rustc_public/src/unstable/internal_cx/mod.rs | 10 +++---- .../src/unstable/internal_cx/traits.rs | 31 ---------------------- compiler/rustc_public_bridge/src/alloc.rs | 2 +- .../rustc_public_bridge/src/context/helpers.rs | 21 +++++++++++++++ compiler/rustc_public_bridge/src/context/impls.rs | 10 +++---- compiler/rustc_public_bridge/src/context/mod.rs | 4 +-- compiler/rustc_public_bridge/src/context/traits.rs | 21 --------------- 12 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 compiler/rustc_public/src/unstable/internal_cx/helpers.rs delete mode 100644 compiler/rustc_public/src/unstable/internal_cx/traits.rs create mode 100644 compiler/rustc_public_bridge/src/context/helpers.rs delete mode 100644 compiler/rustc_public_bridge/src/context/traits.rs (limited to 'compiler/rustc_public/src/compiler_interface.rs') 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/helpers.rs b/compiler/rustc_public/src/unstable/internal_cx/helpers.rs new file mode 100644 index 00000000000..da635c04d74 --- /dev/null +++ b/compiler/rustc_public/src/unstable/internal_cx/helpers.rs @@ -0,0 +1,31 @@ +//! A set of traits that define a stable interface to rustc's internals. +//! +//! These traits are primarily used to clarify the behavior of different +//! functions that share the same name across various contexts. + +use rustc_middle::ty; + +pub(crate) trait ExistentialProjectionHelpers<'tcx> { + fn new_from_args( + &self, + def_id: rustc_span::def_id::DefId, + args: ty::GenericArgsRef<'tcx>, + term: ty::Term<'tcx>, + ) -> ty::ExistentialProjection<'tcx>; +} + +pub(crate) trait ExistentialTraitRefHelpers<'tcx> { + fn new_from_args( + &self, + trait_def_id: rustc_span::def_id::DefId, + args: ty::GenericArgsRef<'tcx>, + ) -> ty::ExistentialTraitRef<'tcx>; +} + +pub(crate) trait TraitRefHelpers<'tcx> { + fn new_from_args( + &self, + trait_def_id: rustc_span::def_id::DefId, + args: ty::GenericArgsRef<'tcx>, + ) -> ty::TraitRef<'tcx>; +} 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/src/unstable/internal_cx/traits.rs b/compiler/rustc_public/src/unstable/internal_cx/traits.rs deleted file mode 100644 index da443cd78f1..00000000000 --- a/compiler/rustc_public/src/unstable/internal_cx/traits.rs +++ /dev/null @@ -1,31 +0,0 @@ -//! A set of traits that define a stable interface to rustc's internals. -//! -//! These traits are primarily used to clarify the behavior of different -//! functions that share the same name across various contexts. - -use rustc_middle::ty; - -pub(crate) trait SmirExistentialProjection<'tcx> { - fn new_from_args( - &self, - def_id: rustc_span::def_id::DefId, - args: ty::GenericArgsRef<'tcx>, - term: ty::Term<'tcx>, - ) -> ty::ExistentialProjection<'tcx>; -} - -pub(crate) trait SmirExistentialTraitRef<'tcx> { - fn new_from_args( - &self, - trait_def_id: rustc_span::def_id::DefId, - args: ty::GenericArgsRef<'tcx>, - ) -> ty::ExistentialTraitRef<'tcx>; -} - -pub(crate) trait SmirTraitRef<'tcx> { - fn new_from_args( - &self, - trait_def_id: rustc_span::def_id::DefId, - args: ty::GenericArgsRef<'tcx>, - ) -> ty::TraitRef<'tcx>; -} 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>, &'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/helpers.rs b/compiler/rustc_public_bridge/src/context/helpers.rs new file mode 100644 index 00000000000..21eef29e5f1 --- /dev/null +++ b/compiler/rustc_public_bridge/src/context/helpers.rs @@ -0,0 +1,21 @@ +//! A set of traits that define a stable interface to rustc's internals. +//! +//! 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; +use rustc_middle::ty; +use rustc_middle::ty::Ty; +use rustc_span::def_id::DefId; + +pub trait TyHelpers<'tcx> { + fn new_foreign(&self, def_id: DefId) -> Ty<'tcx>; +} + +pub trait TypingEnvHelpers<'tcx> { + fn fully_monomorphized(&self) -> ty::TypingEnv<'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 { - 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. /// diff --git a/compiler/rustc_public_bridge/src/context/traits.rs b/compiler/rustc_public_bridge/src/context/traits.rs deleted file mode 100644 index 8483bee4aad..00000000000 --- a/compiler/rustc_public_bridge/src/context/traits.rs +++ /dev/null @@ -1,21 +0,0 @@ -//! 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 -//! interface regardless of internal compiler changes. - -use rustc_middle::mir::interpret::AllocRange; -use rustc_middle::ty; -use rustc_middle::ty::Ty; -use rustc_span::def_id::DefId; - -pub trait SmirTy<'tcx> { - fn new_foreign(&self, def_id: DefId) -> Ty<'tcx>; -} - -pub trait SmirTypingEnv<'tcx> { - fn fully_monomorphized(&self) -> ty::TypingEnv<'tcx>; -} - -pub trait SmirAllocRange<'tcx> { - fn alloc_range(&self, offset: rustc_abi::Size, size: rustc_abi::Size) -> AllocRange; -} -- cgit 1.4.1-3-g733a5 From 483877a9b2140065df08e15a27c20c9431028ec5 Mon Sep 17 00:00:00 2001 From: Makai Date: Tue, 15 Jul 2025 16:22:33 +0000 Subject: Update docs in `rustc_public` --- compiler/rustc_public/src/alloc.rs | 2 +- compiler/rustc_public/src/compiler_interface.rs | 4 ++-- compiler/rustc_public/src/error.rs | 2 +- compiler/rustc_public/src/mir/alloc.rs | 2 +- compiler/rustc_public/src/mir/body.rs | 6 +++--- compiler/rustc_public/src/mir/mono.rs | 4 ++-- compiler/rustc_public/src/mir/pretty.rs | 2 +- compiler/rustc_public/src/mir/visit.rs | 2 +- compiler/rustc_public/src/rustc_internal/mod.rs | 12 ++++++------ compiler/rustc_public/src/rustc_internal/pretty.rs | 2 +- .../rustc_public/src/unstable/convert/internal.rs | 2 +- compiler/rustc_public/src/unstable/convert/mod.rs | 2 +- compiler/rustc_public/src/unstable/mod.rs | 19 ++++++++++--------- 13 files changed, 31 insertions(+), 30 deletions(-) (limited to 'compiler/rustc_public/src/compiler_interface.rs') diff --git a/compiler/rustc_public/src/alloc.rs b/compiler/rustc_public/src/alloc.rs index dcb3cc0e75f..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 diff --git a/compiler/rustc_public/src/compiler_interface.rs b/compiler/rustc_public/src/compiler_interface.rs index 043064951d5..5a09c3b24f0 100644 --- a/compiler/rustc_public/src/compiler_interface.rs +++ b/compiler/rustc_public/src/compiler_interface.rs @@ -1,6 +1,6 @@ //! Define the interface with the Rust compiler. //! -//! StableMIR users should not use any of the items in this module directly. +//! rustc_public users should not use any of the items in this module directly. //! These APIs have no stability guarantee. use std::cell::Cell; @@ -1067,7 +1067,7 @@ where F: FnOnce() -> T, { if TLV.is_set() { - Err(Error::from("StableMIR already running")) + Err(Error::from("rustc_public already running")) } else { let ptr: *const () = (&raw const interface) as _; TLV.set(&Cell::new(ptr), || Ok(f())) diff --git a/compiler/rustc_public/src/error.rs b/compiler/rustc_public/src/error.rs index 70a74eaa9fb..3d75a4bd315 100644 --- a/compiler/rustc_public/src/error.rs +++ b/compiler/rustc_public/src/error.rs @@ -1,5 +1,5 @@ //! When things go wrong, we need some error handling. -//! There are a few different types of errors in StableMIR: +//! There are a few different types of errors in rustc_public: //! //! - [CompilerError]: This represents errors that can be raised when invoking the compiler. //! - [Error]: Generic error that represents the reason why a request that could not be fulfilled. diff --git a/compiler/rustc_public/src/mir/alloc.rs b/compiler/rustc_public/src/mir/alloc.rs index 9a94551f3ec..07a979f3811 100644 --- a/compiler/rustc_public/src/mir/alloc.rs +++ b/compiler/rustc_public/src/mir/alloc.rs @@ -9,7 +9,7 @@ use crate::target::{Endian, MachineInfo}; use crate::ty::{Allocation, Binder, ExistentialTraitRef, Ty}; use crate::{Error, IndexedVal, with}; -/// An allocation in the SMIR global memory can be either a function pointer, +/// An allocation in the rustc_public's IR global memory can be either a function pointer, /// a static, or a "real" allocation with some data in it. #[derive(Debug, Clone, Eq, PartialEq, Serialize)] pub enum GlobalAlloc { diff --git a/compiler/rustc_public/src/mir/body.rs b/compiler/rustc_public/src/mir/body.rs index 28a7aa6e758..3320b98cd61 100644 --- a/compiler/rustc_public/src/mir/body.rs +++ b/compiler/rustc_public/src/mir/body.rs @@ -10,7 +10,7 @@ use crate::ty::{ }; use crate::{Error, Opaque, Span, Symbol}; -/// The SMIR representation of a single function. +/// The rustc_public's IR representation of a single function. #[derive(Clone, Debug, Serialize)] pub struct Body { pub blocks: Vec, @@ -771,8 +771,8 @@ pub enum VarDebugInfoContents { // In MIR ProjectionElem is parameterized on the second Field argument and the Index argument. This // is so it can be used for both Places (for which the projection elements are of type // ProjectionElem) and user-provided type annotations (for which the projection elements -// are of type ProjectionElem<(), ()>). In SMIR we don't need this generality, so we just use -// ProjectionElem for Places. +// are of type ProjectionElem<(), ()>). +// In rustc_public's IR we don't need this generality, so we just use ProjectionElem for Places. #[derive(Clone, Debug, Eq, PartialEq, Serialize)] pub enum ProjectionElem { /// Dereference projections (e.g. `*_1`) project to the address referenced by the base place. diff --git a/compiler/rustc_public/src/mir/mono.rs b/compiler/rustc_public/src/mir/mono.rs index 06f6ac17e7b..d488f5a25c7 100644 --- a/compiler/rustc_public/src/mir/mono.rs +++ b/compiler/rustc_public/src/mir/mono.rs @@ -62,7 +62,7 @@ impl Instance { /// For more information on fallback body, see . /// /// This call is much cheaper than `instance.body().is_some()`, since it doesn't try to build - /// the StableMIR body. + /// the rustc_public's IR body. pub fn has_body(&self) -> bool { with(|cx| cx.has_body(self.def.def_id())) } @@ -157,7 +157,7 @@ impl Instance { /// /// Allow users to check if this shim can be ignored when called directly. /// - /// We have decided not to export different types of Shims to StableMIR users, however, this + /// We have decided not to export different types of Shims to rustc_public users, however, this /// is a query that can be very helpful for users when processing DropGlue. /// /// When generating code for a Drop terminator, users can ignore an empty drop glue. diff --git a/compiler/rustc_public/src/mir/pretty.rs b/compiler/rustc_public/src/mir/pretty.rs index f496d80053e..a433df2dba1 100644 --- a/compiler/rustc_public/src/mir/pretty.rs +++ b/compiler/rustc_public/src/mir/pretty.rs @@ -1,4 +1,4 @@ -//! Implement methods to pretty print stable MIR body. +//! Implement methods to pretty print rustc_public's IR body. use std::fmt::Debug; use std::io::Write; use std::{fmt, io, iter}; diff --git a/compiler/rustc_public/src/mir/visit.rs b/compiler/rustc_public/src/mir/visit.rs index 7dc99d1d1e1..04c4d4d2a82 100644 --- a/compiler/rustc_public/src/mir/visit.rs +++ b/compiler/rustc_public/src/mir/visit.rs @@ -1,4 +1,4 @@ -//! # The Stable MIR Visitor +//! # The rustc_public's IR Visitor //! //! ## Overview //! diff --git a/compiler/rustc_public/src/rustc_internal/mod.rs b/compiler/rustc_public/src/rustc_internal/mod.rs index ca999b62f80..a119958974e 100644 --- a/compiler/rustc_public/src/rustc_internal/mod.rs +++ b/compiler/rustc_public/src/rustc_internal/mod.rs @@ -1,7 +1,7 @@ -//! Module that implements the bridge between Stable MIR and internal compiler MIR. +//! Module that implements the bridge between rustc_public's IR and internal compiler MIR. //! //! For that, we define APIs that will temporarily be public to 3P that exposes rustc internal APIs -//! until stable MIR is complete. +//! until rustc_public's IR is complete. use std::cell::{Cell, RefCell}; @@ -26,7 +26,7 @@ pub mod pretty; /// /// # Panics /// -/// This function will panic if StableMIR has not been properly initialized. +/// This function will panic if rustc_public has not been properly initialized. pub fn stable<'tcx, S: Stable<'tcx>>(item: S) -> S::T { with_container(|tables, cx| item.stable(tables, cx)) } @@ -41,7 +41,7 @@ pub fn stable<'tcx, S: Stable<'tcx>>(item: S) -> S::T { /// /// # Panics /// -/// This function will panic if StableMIR has not been properly initialized. +/// This function will panic if rustc_public has not been properly initialized. pub fn internal<'tcx, S>(tcx: TyCtxt<'tcx>, item: S) -> S::T<'tcx> where S: RustcInternal, @@ -57,7 +57,7 @@ pub fn crate_num(item: &crate::Crate) -> CrateNum { } // A thread local variable that stores a pointer to the tables mapping between TyCtxt -// datastructures and stable MIR datastructures +// datastructures and rustc_public's IR datastructures scoped_thread_local! (static TLV: Cell<*const ()>); pub(crate) fn init<'tcx, F, T, B: Bridge>(container: &Container<'tcx, B>, f: F) -> T @@ -176,7 +176,7 @@ macro_rules! optional { /// Prefer using [run!] and [run_with_tcx] instead. /// -/// This macro implements the instantiation of a StableMIR driver, and it will invoke +/// This macro implements the instantiation of a rustc_public driver, and it will invoke /// the given callback after the compiler analyses. /// /// The third argument determines whether the callback requires `tcx` as an argument. diff --git a/compiler/rustc_public/src/rustc_internal/pretty.rs b/compiler/rustc_public/src/rustc_internal/pretty.rs index 28c5280fe04..83522e51977 100644 --- a/compiler/rustc_public/src/rustc_internal/pretty.rs +++ b/compiler/rustc_public/src/rustc_internal/pretty.rs @@ -7,7 +7,7 @@ use super::run; pub fn write_smir_pretty<'tcx, W: io::Write>(tcx: TyCtxt<'tcx>, w: &mut W) -> io::Result<()> { writeln!( w, - "// WARNING: This is highly experimental output it's intended for stable-mir developers only." + "// WARNING: This is highly experimental output it's intended for rustc_public developers only." )?; writeln!( w, diff --git a/compiler/rustc_public/src/unstable/convert/internal.rs b/compiler/rustc_public/src/unstable/convert/internal.rs index 0571a03b62b..b2d38e497bc 100644 --- a/compiler/rustc_public/src/unstable/convert/internal.rs +++ b/compiler/rustc_public/src/unstable/convert/internal.rs @@ -1,4 +1,4 @@ -//! Module containing the translation from stable mir constructs to the rustc counterpart. +//! Module containing the translation from rustc_public constructs to the rustc counterpart. //! //! This module will only include a few constructs to allow users to invoke internal rustc APIs //! due to incomplete stable coverage. diff --git a/compiler/rustc_public/src/unstable/convert/mod.rs b/compiler/rustc_public/src/unstable/convert/mod.rs index a2e83c6e239..f20406631e3 100644 --- a/compiler/rustc_public/src/unstable/convert/mod.rs +++ b/compiler/rustc_public/src/unstable/convert/mod.rs @@ -1,4 +1,4 @@ -//! This module holds the logic to convert rustc internal ADTs into stable mir ADTs. +//! This module holds the logic to convert rustc internal ADTs into rustc_public ADTs. //! //! The conversion from stable to internal is not meant to be complete, //! and it should be added as when needed to be passed as input to rustc_public_bridge functions. diff --git a/compiler/rustc_public/src/unstable/mod.rs b/compiler/rustc_public/src/unstable/mod.rs index ca154a3378a..72b14cfa072 100644 --- a/compiler/rustc_public/src/unstable/mod.rs +++ b/compiler/rustc_public/src/unstable/mod.rs @@ -1,6 +1,6 @@ //! Module that collects the things that have no stability guarantees. //! -//! We want to keep StableMIR definitions and logic separate from +//! We want to keep rustc_public's IR definitions and logic separate from //! any sort of conversion and usage of internal rustc code. So we //! restrict the usage of internal items to be inside this module. @@ -53,16 +53,16 @@ pub trait InternalCx<'tcx>: Copy + Clone { fn adt_def(self, def_id: rustc_hir::def_id::DefId) -> ty::AdtDef<'tcx>; } -/// Trait used to convert between an internal MIR type to a Stable MIR type. +/// Trait used to convert between an internal MIR type to a rustc_public's IR type. /// -/// This trait is currently exposed to users so they can have interoperability between internal MIR -/// and StableMIR constructs. However, they should be used seldom and they have no influence -/// in this crate semver. +/// This trait is currently exposed to users so they can have interoperability +/// between internal MIR and rustc_public's IR constructs. +/// However, they should be used seldom and they have no influence in this crate semver. #[doc(hidden)] pub trait Stable<'tcx>: PointeeSized { /// The stable representation of the type implementing Stable. type T; - /// Converts an object to the equivalent Stable MIR representation. + /// Converts an object to the equivalent rustc_public's IR representation. fn stable<'cx>( &self, tables: &mut Tables<'cx, BridgeTys>, @@ -70,12 +70,13 @@ pub trait Stable<'tcx>: PointeeSized { ) -> Self::T; } -/// Trait used to translate a stable construct to its rustc counterpart. +/// Trait used to translate a rustc_public's IR construct to its rustc counterpart. /// /// This is basically a mirror of [Stable]. /// -/// This trait is currently exposed to users so they can have interoperability between internal MIR -/// and StableMIR constructs. They should be used seldom as they have no stability guarantees. +/// This trait is currently exposed to users so they can have interoperability +/// between internal MIR and rustc_public's IR constructs. +/// They should be used seldom as they have no stability guarantees. #[doc(hidden)] pub trait RustcInternal { type T<'tcx>; -- cgit 1.4.1-3-g733a5