Update docs in rustc_public_bridge

This commit is contained in:
Makai
2025-07-15 16:02:24 +00:00
parent a1deaa7097
commit 95338717f1
5 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
//! Internal memory allocator implementation for StableMIR.
//! Internal memory allocator implementation for rustc_public.
//!
//! This module handles all direct interactions with rustc queries and performs
//! the actual memory allocations. The stable interface in `rustc_public::alloc`
+3 -4
View File
@@ -1,8 +1,7 @@
//! Logic required to produce a monomorphic stable body.
//! Logic required to produce a monomorphic body.
//!
//! We first retrieve and monomorphize the rustc body representation, i.e., we generate a
//! We retrieve and monomorphize the rustc body representation, i.e., we generate a
//! monomorphic body using internal representation.
//! After that, we convert the internal representation into a stable one.
use rustc_hir::def::DefKind;
use rustc_middle::mir;
@@ -25,7 +24,7 @@ pub(crate) fn new(tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>) -> Self {
BodyBuilder { tcx, instance }
}
/// Build a stable monomorphic body for a given instance based on the MIR body.
/// Build a monomorphic body for a given instance based on the MIR body.
///
/// All constants are also evaluated.
pub(crate) fn build(mut self) -> mir::Body<'tcx> {
@@ -1,4 +1,4 @@
//! Implementation of StableMIR Context.
//! Implementation of CompilerCtxt.
#![allow(rustc::usage_of_qualified_ty)]
@@ -85,7 +85,7 @@ pub(crate) fn instance_has_body(&self, instance: Instance<'tcx>) -> bool {
/// Return whether the item has a body defined by the user.
///
/// Note that intrinsics may have a placeholder body that shouldn't be used in practice.
/// In StableMIR, we handle this case as if the body is not available.
/// In rustc_public, we handle this case as if the body is not available.
pub(crate) fn item_has_body(&self, def_id: DefId) -> bool {
let must_override = if let Some(intrinsic) = self.tcx.intrinsic(def_id) {
intrinsic.must_be_overridden
@@ -1,4 +1,4 @@
//! Implementation of StableMIR Context.
//! Implementation of CompilerCtxt.
#![allow(rustc::usage_of_qualified_ty)]
@@ -19,7 +19,7 @@
/// Provides direct access to rustc's internal queries.
///
/// `CompilerInterface` must go through
/// this context to obtain rustc-level information.
/// this context to obtain internal information.
pub struct CompilerCtxt<'tcx, B: Bridge> {
pub tcx: TyCtxt<'tcx>,
_marker: PhantomData<B>,
+3 -3
View File
@@ -1,6 +1,6 @@
//! Crate that implements what will become the rustc side of Stable MIR.
//! Crate that implements what will become the rustc side of rustc_public.
//!
//! This crate is responsible for building Stable MIR components from internal components.
//! This crate serves as a proxy for making calls to rustc queries.
//!
//! This crate is not intended to be invoked directly by users.
//! This crate is the public API of rustc that will be invoked by the `rustc_public` crate.
@@ -210,7 +210,7 @@ pub fn static_def(&mut self, did: rustc_span::def_id::DefId) -> B::StaticDef {
}
}
/// A trait defining types that are used to emulate StableMIR components, which is really
/// A trait defining types that are used to emulate rustc_public components, which is really
/// useful when programming in rustc_public-agnostic settings.
pub trait Bridge: Sized {
type DefId: Copy + Debug + PartialEq + IndexedVal;