Update docs in rustc_public
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<BasicBlock>,
|
||||
@@ -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<Local, Ty>) 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.
|
||||
|
||||
@@ -62,7 +62,7 @@ impl Instance {
|
||||
/// For more information on fallback body, see <https://github.com/rust-lang/rust/issues/93145>.
|
||||
///
|
||||
/// 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.
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! # The Stable MIR Visitor
|
||||
//! # The rustc_public's IR Visitor
|
||||
//!
|
||||
//! ## Overview
|
||||
//!
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user