SmirCtxt to CompilerCtxt, SmirInterface to CompilerInterface

aaa
This commit is contained in:
Makai
2025-07-15 13:13:03 +00:00
parent 82310651b9
commit 966fc57789
15 changed files with 186 additions and 186 deletions

View File

@@ -8,7 +8,7 @@ use rustc_abi::Align;
use rustc_middle::mir::ConstValue;
use rustc_middle::mir::interpret::AllocRange;
use rustc_public_bridge::bridge::SmirError;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use rustc_public_bridge::{Tables, alloc};
use super::Error;
@@ -35,7 +35,7 @@ pub(crate) fn new_allocation<'tcx>(
ty: rustc_middle::ty::Ty<'tcx>,
const_value: ConstValue<'tcx>,
tables: &mut Tables<'tcx, BridgeTys>,
cx: &SmirCtxt<'tcx, BridgeTys>,
cx: &CompilerCtxt<'tcx, BridgeTys>,
) -> Allocation {
try_new_allocation(ty, const_value, tables, cx)
.unwrap_or_else(|_| panic!("Failed to convert: {const_value:?} to {ty:?}"))
@@ -46,7 +46,7 @@ pub(crate) fn try_new_allocation<'tcx>(
ty: rustc_middle::ty::Ty<'tcx>,
const_value: ConstValue<'tcx>,
tables: &mut Tables<'tcx, BridgeTys>,
cx: &SmirCtxt<'tcx, BridgeTys>,
cx: &CompilerCtxt<'tcx, BridgeTys>,
) -> Result<Allocation, Error> {
let layout = alloc::create_ty_and_layout(cx, ty).map_err(|e| Error::from_internal(e))?;
match const_value {
@@ -70,7 +70,7 @@ pub(super) fn allocation_filter<'tcx>(
alloc: &rustc_middle::mir::interpret::Allocation,
alloc_range: AllocRange,
tables: &mut Tables<'tcx, BridgeTys>,
cx: &SmirCtxt<'tcx, BridgeTys>,
cx: &CompilerCtxt<'tcx, BridgeTys>,
) -> Allocation {
alloc::allocation_filter(alloc, alloc_range, tables, cx)
}

View File

@@ -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<CrateItem>;
/// 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<CrateItem> {
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<F, T>(interface: &dyn SmirInterface, f: F) -> Result<T, Error>
pub(crate) fn run<F, T>(interface: &dyn CompilerInterface, f: F) -> Result<T, Error>
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<R>(f: impl FnOnce(&dyn SmirInterface) -> R) -> R {
pub(crate) fn with<R>(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);

View File

@@ -24,7 +24,7 @@ use std::{fmt, io};
pub(crate) use rustc_public_bridge::IndexedVal;
use rustc_public_bridge::Tables;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
/// Export the rustc_internal APIs. Note that this module has no stability
/// guarantees and it is not taken into account for semver.
#[cfg(feature = "rustc_internal")]
@@ -288,7 +288,7 @@ impl rustc_public_bridge::bridge::Allocation<compiler_interface::BridgeTys>
align: u64,
mutability: rustc_middle::mir::Mutability,
tables: &mut Tables<'tcx, compiler_interface::BridgeTys>,
cx: &SmirCtxt<'tcx, compiler_interface::BridgeTys>,
cx: &CompilerCtxt<'tcx, compiler_interface::BridgeTys>,
) -> Self {
Self {
bytes,

View File

@@ -6,7 +6,7 @@
use std::cell::{Cell, RefCell};
use rustc_middle::ty::TyCtxt;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use rustc_public_bridge::{Bridge, SmirContainer, Tables};
use rustc_span::def_id::CrateNum;
use scoped_tls::scoped_thread_local;
@@ -72,7 +72,7 @@ where
/// Loads the current context and calls a function with it.
/// Do not nest these, as that will ICE.
pub(crate) fn with_container<R, B: Bridge>(
f: impl for<'tcx> FnOnce(&mut Tables<'tcx, B>, &SmirCtxt<'tcx, B>) -> R,
f: impl for<'tcx> FnOnce(&mut Tables<'tcx, B>, &CompilerCtxt<'tcx, B>) -> R,
) -> R {
assert!(TLV.is_set());
TLV.with(|tlv| {
@@ -89,8 +89,8 @@ pub fn run<F, T>(tcx: TyCtxt<'_>, f: F) -> Result<T, Error>
where
F: FnOnce() -> T,
{
let smir_cx = RefCell::new(SmirCtxt::new(tcx));
let container = SmirContainer { tables: RefCell::new(Tables::default()), cx: smir_cx };
let compiler_cx = RefCell::new(CompilerCtxt::new(tcx));
let container = SmirContainer { tables: RefCell::new(Tables::default()), cx: compiler_cx };
crate::compiler_interface::run(&container, || init(&container, f))
}

View File

@@ -9,7 +9,7 @@
use std::ops::RangeInclusive;
use rustc_public_bridge::Tables;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use super::Stable;
use crate::compiler_interface::BridgeTys;
@@ -26,7 +26,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
(*self).stable(tables, cx)
}
@@ -41,7 +41,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
self.as_ref().map(|value| value.stable(tables, cx))
}
@@ -57,7 +57,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
Ok(val) => Ok(val.stable(tables, cx)),
@@ -74,7 +74,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
self.iter().map(|e| e.stable(tables, cx)).collect()
}
@@ -89,7 +89,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
(self.0.stable(tables, cx), self.1.stable(tables, cx))
}
@@ -103,7 +103,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
RangeInclusive::new(self.start().stable(tables, cx), self.end().stable(tables, cx))
}

View File

@@ -5,7 +5,7 @@
use rustc_abi::{ArmCall, CanonAbi, InterruptKind, X86Call};
use rustc_middle::ty;
use rustc_public_bridge::Tables;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use rustc_target::callconv;
use crate::abi::{
@@ -21,7 +21,7 @@ use crate::{IndexedVal, opaque};
impl<'tcx> Stable<'tcx> for rustc_abi::VariantIdx {
type T = VariantIdx;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
VariantIdx::to_val(self.as_usize())
}
}
@@ -29,7 +29,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::VariantIdx {
impl<'tcx> Stable<'tcx> for rustc_abi::Endian {
type T = crate::target::Endian;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
rustc_abi::Endian::Little => crate::target::Endian::Little,
rustc_abi::Endian::Big => crate::target::Endian::Big,
@@ -43,7 +43,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::TyAndLayout<'tcx, ty::Ty<'tcx>> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
TyAndLayout { ty: self.ty.stable(tables, cx), layout: self.layout.stable(tables, cx) }
}
@@ -55,7 +55,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Layout<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
tables.layout_id(cx.lift(*self).unwrap())
}
@@ -67,7 +67,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::LayoutData<rustc_abi::FieldIdx, rustc_abi
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
LayoutShape {
fields: self.fields.stable(tables, cx),
@@ -85,7 +85,7 @@ impl<'tcx> Stable<'tcx> for callconv::FnAbi<'tcx, ty::Ty<'tcx>> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
assert!(self.args.len() >= self.fixed_count as usize);
assert!(!self.c_variadic || matches!(self.conv, CanonAbi::C));
@@ -105,7 +105,7 @@ impl<'tcx> Stable<'tcx> for callconv::ArgAbi<'tcx, ty::Ty<'tcx>> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
ArgAbi {
ty: self.layout.ty.stable(tables, cx),
@@ -118,7 +118,7 @@ impl<'tcx> Stable<'tcx> for callconv::ArgAbi<'tcx, ty::Ty<'tcx>> {
impl<'tcx> Stable<'tcx> for CanonAbi {
type T = CallConvention;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
CanonAbi::C => CallConvention::C,
CanonAbi::Rust => CallConvention::Rust,
@@ -154,7 +154,7 @@ impl<'tcx> Stable<'tcx> for CanonAbi {
impl<'tcx> Stable<'tcx> for callconv::PassMode {
type T = PassMode;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
callconv::PassMode::Ignore => PassMode::Ignore,
callconv::PassMode::Direct(attr) => PassMode::Direct(opaque(attr)),
@@ -179,7 +179,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::FieldsShape<rustc_abi::FieldIdx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
rustc_abi::FieldsShape::Primitive => FieldsShape::Primitive,
@@ -200,7 +200,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Variants<rustc_abi::FieldIdx, rustc_abi::
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
rustc_abi::Variants::Single { index } => {
@@ -225,7 +225,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::TagEncoding<rustc_abi::VariantIdx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
rustc_abi::TagEncoding::Direct => TagEncoding::Direct,
@@ -246,7 +246,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::BackendRepr {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match *self {
rustc_abi::BackendRepr::Scalar(scalar) => ValueAbi::Scalar(scalar.stable(tables, cx)),
@@ -264,7 +264,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::BackendRepr {
impl<'tcx> Stable<'tcx> for rustc_abi::Size {
type T = Size;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
Size::from_bits(self.bits_usize())
}
}
@@ -272,7 +272,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Size {
impl<'tcx> Stable<'tcx> for rustc_abi::Align {
type T = Align;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
self.bytes()
}
}
@@ -283,7 +283,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Scalar {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
rustc_abi::Scalar::Initialized { value, valid_range } => Scalar::Initialized {
@@ -301,7 +301,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Primitive {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
rustc_abi::Primitive::Int(length, signed) => {
@@ -318,7 +318,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Primitive {
impl<'tcx> Stable<'tcx> for rustc_abi::AddressSpace {
type T = AddressSpace;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
AddressSpace(self.0)
}
}
@@ -326,7 +326,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::AddressSpace {
impl<'tcx> Stable<'tcx> for rustc_abi::Integer {
type T = IntegerLength;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
rustc_abi::Integer::I8 => IntegerLength::I8,
rustc_abi::Integer::I16 => IntegerLength::I16,
@@ -340,7 +340,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Integer {
impl<'tcx> Stable<'tcx> for rustc_abi::Float {
type T = FloatLength;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
rustc_abi::Float::F16 => FloatLength::F16,
rustc_abi::Float::F32 => FloatLength::F32,
@@ -353,7 +353,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Float {
impl<'tcx> Stable<'tcx> for rustc_abi::WrappingRange {
type T = WrappingRange;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
WrappingRange { start: self.start, end: self.end }
}
}
@@ -364,7 +364,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::ReprFlags {
fn stable<'cx>(
&self,
_tables: &mut Tables<'cx, BridgeTys>,
_cx: &SmirCtxt<'cx, BridgeTys>,
_cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
ReprFlags {
is_simd: self.intersects(Self::IS_SIMD),
@@ -381,7 +381,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::IntegerType {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
rustc_abi::IntegerType::Pointer(signed) => IntegerType::Pointer { is_signed: *signed },
@@ -398,7 +398,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::ReprOptions {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
ReprOptions {
int: self.int.map(|int| int.stable(tables, cx)),

View File

@@ -4,7 +4,7 @@ use rustc_middle::mir::mono::MonoItem;
use rustc_middle::{bug, mir};
use rustc_public_bridge::Tables;
use rustc_public_bridge::bridge::SmirError;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use crate::compiler_interface::BridgeTys;
use crate::mir::alloc::GlobalAlloc;
@@ -19,7 +19,7 @@ impl<'tcx> Stable<'tcx> for mir::Body<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::mir::Body::new(
self.basic_blocks
@@ -54,7 +54,7 @@ impl<'tcx> Stable<'tcx> for mir::VarDebugInfo<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::mir::VarDebugInfo {
name: self.name.to_string(),
@@ -71,7 +71,7 @@ impl<'tcx> Stable<'tcx> for mir::Statement<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
Statement {
kind: self.kind.stable(tables, cx),
@@ -85,7 +85,7 @@ impl<'tcx> Stable<'tcx> for mir::SourceInfo {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::mir::SourceInfo { span: self.span.stable(tables, cx), scope: self.scope.into() }
}
@@ -96,7 +96,7 @@ impl<'tcx> Stable<'tcx> for mir::VarDebugInfoFragment<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
VarDebugInfoFragment {
ty: self.ty.stable(tables, cx),
@@ -110,7 +110,7 @@ impl<'tcx> Stable<'tcx> for mir::VarDebugInfoContents<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
mir::VarDebugInfoContents::Place(place) => {
@@ -133,7 +133,7 @@ impl<'tcx> Stable<'tcx> for mir::StatementKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
mir::StatementKind::Assign(assign) => crate::mir::StatementKind::Assign(
@@ -195,7 +195,7 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::Rvalue::*;
match self {
@@ -259,7 +259,7 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
impl<'tcx> Stable<'tcx> for mir::Mutability {
type T = crate::mir::Mutability;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_hir::Mutability::*;
match *self {
Not => crate::mir::Mutability::Not,
@@ -270,7 +270,7 @@ impl<'tcx> Stable<'tcx> for mir::Mutability {
impl<'tcx> Stable<'tcx> for mir::RawPtrKind {
type T = crate::mir::RawPtrKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use mir::RawPtrKind::*;
match *self {
Const => crate::mir::RawPtrKind::Const,
@@ -285,7 +285,7 @@ impl<'tcx> Stable<'tcx> for mir::BorrowKind {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::BorrowKind::*;
match *self {
@@ -298,7 +298,7 @@ impl<'tcx> Stable<'tcx> for mir::BorrowKind {
impl<'tcx> Stable<'tcx> for mir::MutBorrowKind {
type T = crate::mir::MutBorrowKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::mir::MutBorrowKind::*;
match *self {
Default => crate::mir::MutBorrowKind::Default,
@@ -310,7 +310,7 @@ impl<'tcx> Stable<'tcx> for mir::MutBorrowKind {
impl<'tcx> Stable<'tcx> for mir::FakeBorrowKind {
type T = crate::mir::FakeBorrowKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::mir::FakeBorrowKind::*;
match *self {
Deep => crate::mir::FakeBorrowKind::Deep,
@@ -324,7 +324,7 @@ impl<'tcx> Stable<'tcx> for mir::NullOp<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::NullOp::*;
match self {
@@ -344,7 +344,7 @@ impl<'tcx> Stable<'tcx> for mir::CastKind {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::CastKind::*;
match self {
@@ -364,7 +364,7 @@ impl<'tcx> Stable<'tcx> for mir::CastKind {
impl<'tcx> Stable<'tcx> for mir::FakeReadCause {
type T = crate::mir::FakeReadCause;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::mir::FakeReadCause::*;
match self {
ForMatchGuard => crate::mir::FakeReadCause::ForMatchGuard,
@@ -383,7 +383,7 @@ impl<'tcx> Stable<'tcx> for mir::Operand<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::Operand::*;
match self {
@@ -400,7 +400,7 @@ impl<'tcx> Stable<'tcx> for mir::ConstOperand<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::mir::ConstOperand {
span: self.span.stable(tables, cx),
@@ -415,7 +415,7 @@ impl<'tcx> Stable<'tcx> for mir::Place<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::mir::Place {
local: self.local.as_usize(),
@@ -429,7 +429,7 @@ impl<'tcx> Stable<'tcx> for mir::PlaceElem<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::ProjectionElem::*;
match self {
@@ -464,21 +464,21 @@ impl<'tcx> Stable<'tcx> for mir::PlaceElem<'tcx> {
impl<'tcx> Stable<'tcx> for mir::UserTypeProjection {
type T = crate::mir::UserTypeProjection;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
UserTypeProjection { base: self.base.as_usize(), projection: opaque(&self.projs) }
}
}
impl<'tcx> Stable<'tcx> for mir::Local {
type T = crate::mir::Local;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
self.as_usize()
}
}
impl<'tcx> Stable<'tcx> for mir::RetagKind {
type T = crate::mir::RetagKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::mir::RetagKind;
match self {
RetagKind::FnEntry => crate::mir::RetagKind::FnEntry,
@@ -491,7 +491,7 @@ impl<'tcx> Stable<'tcx> for mir::RetagKind {
impl<'tcx> Stable<'tcx> for mir::UnwindAction {
type T = crate::mir::UnwindAction;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::mir::UnwindAction;
match self {
UnwindAction::Continue => crate::mir::UnwindAction::Continue,
@@ -508,7 +508,7 @@ impl<'tcx> Stable<'tcx> for mir::NonDivergingIntrinsic<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::NonDivergingIntrinsic;
@@ -533,7 +533,7 @@ impl<'tcx> Stable<'tcx> for mir::AssertMessage<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::AssertKind;
match self {
@@ -580,7 +580,7 @@ impl<'tcx> Stable<'tcx> for mir::AssertMessage<'tcx> {
impl<'tcx> Stable<'tcx> for mir::BinOp {
type T = crate::mir::BinOp;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::mir::BinOp;
match self {
BinOp::Add => crate::mir::BinOp::Add,
@@ -615,7 +615,7 @@ impl<'tcx> Stable<'tcx> for mir::BinOp {
impl<'tcx> Stable<'tcx> for mir::UnOp {
type T = crate::mir::UnOp;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::mir::UnOp;
match self {
UnOp::Not => crate::mir::UnOp::Not,
@@ -630,7 +630,7 @@ impl<'tcx> Stable<'tcx> for mir::AggregateKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
mir::AggregateKind::Array(ty) => {
@@ -676,7 +676,7 @@ impl<'tcx> Stable<'tcx> for mir::InlineAsmOperand<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::mir::InlineAsmOperand;
@@ -703,7 +703,7 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::mir::Terminator;
Terminator {
@@ -718,7 +718,7 @@ impl<'tcx> Stable<'tcx> for mir::TerminatorKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::mir::TerminatorKind;
match self {
@@ -807,7 +807,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::ConstAllocation<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
self.inner().stable(tables, cx)
}
@@ -819,7 +819,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_public_bridge::context::SmirAllocRange;
alloc::allocation_filter(
@@ -836,7 +836,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::AllocId {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
_: &SmirCtxt<'cx, BridgeTys>,
_: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
tables.create_alloc_id(*self)
}
@@ -848,7 +848,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::GlobalAlloc<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
mir::interpret::GlobalAlloc::Function { instance, .. } => {
@@ -877,7 +877,7 @@ impl<'tcx> Stable<'tcx> for rustc_middle::mir::Const<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let id = tables.intern_mir_const(cx.lift(*self).unwrap());
match *self {
@@ -913,7 +913,7 @@ impl<'tcx> Stable<'tcx> for rustc_middle::mir::Const<'tcx> {
impl<'tcx> Stable<'tcx> for mir::interpret::ErrorHandled {
type T = Error;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
Error::new(format!("{self:?}"))
}
}
@@ -924,7 +924,7 @@ impl<'tcx> Stable<'tcx> for MonoItem<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::mir::mono::MonoItem as StableMonoItem;
match self {

View File

@@ -2,7 +2,7 @@
use rustc_abi::FieldIdx;
use rustc_public_bridge::Tables;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use super::Stable;
use crate::compiler_interface::BridgeTys;
@@ -13,7 +13,7 @@ mod ty;
impl<'tcx> Stable<'tcx> for rustc_hir::Safety {
type T = crate::mir::Safety;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
rustc_hir::Safety::Unsafe => crate::mir::Safety::Unsafe,
rustc_hir::Safety::Safe => crate::mir::Safety::Safe,
@@ -23,14 +23,14 @@ impl<'tcx> Stable<'tcx> for rustc_hir::Safety {
impl<'tcx> Stable<'tcx> for FieldIdx {
type T = usize;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
self.as_usize()
}
}
impl<'tcx> Stable<'tcx> for rustc_hir::CoroutineSource {
type T = crate::mir::CoroutineSource;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_hir::CoroutineSource;
match self {
CoroutineSource::Block => crate::mir::CoroutineSource::Block,
@@ -45,7 +45,7 @@ impl<'tcx> Stable<'tcx> for rustc_hir::CoroutineKind {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_hir::{CoroutineDesugaring, CoroutineKind};
match *self {
@@ -77,7 +77,7 @@ impl<'tcx> Stable<'tcx> for rustc_hir::CoroutineKind {
impl<'tcx> Stable<'tcx> for rustc_span::Symbol {
type T = crate::Symbol;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
self.to_string()
}
}
@@ -88,7 +88,7 @@ impl<'tcx> Stable<'tcx> for rustc_span::Span {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
_: &SmirCtxt<'cx, BridgeTys>,
_: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
tables.create_span(*self)
}

View File

@@ -3,7 +3,7 @@
use rustc_middle::ty::Ty;
use rustc_middle::{bug, mir, ty};
use rustc_public_bridge::Tables;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use crate::alloc;
use crate::compiler_interface::BridgeTys;
@@ -14,7 +14,7 @@ use crate::unstable::Stable;
impl<'tcx> Stable<'tcx> for ty::AliasTyKind {
type T = crate::ty::AliasKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::Projection => crate::ty::AliasKind::Projection,
ty::Inherent => crate::ty::AliasKind::Inherent,
@@ -29,7 +29,7 @@ impl<'tcx> Stable<'tcx> for ty::AliasTy<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::AliasTy { args, def_id, .. } = self;
crate::ty::AliasTy { def_id: tables.alias_def(*def_id), args: args.stable(tables, cx) }
@@ -41,7 +41,7 @@ impl<'tcx> Stable<'tcx> for ty::AliasTerm<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::AliasTerm { args, def_id, .. } = self;
crate::ty::AliasTerm { def_id: tables.alias_def(*def_id), args: args.stable(tables, cx) }
@@ -51,7 +51,7 @@ impl<'tcx> Stable<'tcx> for ty::AliasTerm<'tcx> {
impl<'tcx> Stable<'tcx> for ty::DynKind {
type T = crate::ty::DynKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::Dyn => crate::ty::DynKind::Dyn,
}
@@ -64,7 +64,7 @@ impl<'tcx> Stable<'tcx> for ty::ExistentialPredicate<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::ExistentialPredicate::*;
match self {
@@ -85,7 +85,7 @@ impl<'tcx> Stable<'tcx> for ty::ExistentialTraitRef<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::ExistentialTraitRef { def_id, args, .. } = self;
crate::ty::ExistentialTraitRef {
@@ -101,7 +101,7 @@ impl<'tcx> Stable<'tcx> for ty::TermKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::TermKind;
match self {
@@ -120,7 +120,7 @@ impl<'tcx> Stable<'tcx> for ty::ExistentialProjection<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::ExistentialProjection { def_id, args, term, .. } = self;
crate::ty::ExistentialProjection {
@@ -136,7 +136,7 @@ impl<'tcx> Stable<'tcx> for ty::adjustment::PointerCoercion {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::ty::adjustment::PointerCoercion;
match self {
@@ -154,7 +154,7 @@ impl<'tcx> Stable<'tcx> for ty::adjustment::PointerCoercion {
impl<'tcx> Stable<'tcx> for ty::UserTypeAnnotationIndex {
type T = usize;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
self.as_usize()
}
}
@@ -162,7 +162,7 @@ impl<'tcx> Stable<'tcx> for ty::UserTypeAnnotationIndex {
impl<'tcx> Stable<'tcx> for ty::AdtKind {
type T = AdtKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::AdtKind::Struct => AdtKind::Struct,
ty::AdtKind::Union => AdtKind::Union,
@@ -177,7 +177,7 @@ impl<'tcx> Stable<'tcx> for ty::FieldDef {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::ty::FieldDef {
def: tables.create_def_id(self.did),
@@ -191,7 +191,7 @@ impl<'tcx> Stable<'tcx> for ty::GenericArgs<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
GenericArgs(self.iter().map(|arg| arg.kind().stable(tables, cx)).collect())
}
@@ -203,7 +203,7 @@ impl<'tcx> Stable<'tcx> for ty::GenericArgKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::GenericArgKind;
match self {
@@ -225,7 +225,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::Binder;
@@ -249,7 +249,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::EarlyBinder;
@@ -262,7 +262,7 @@ impl<'tcx> Stable<'tcx> for ty::FnSig<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::FnSig;
@@ -285,7 +285,7 @@ impl<'tcx> Stable<'tcx> for ty::BoundTyKind {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::BoundTyKind;
@@ -304,7 +304,7 @@ impl<'tcx> Stable<'tcx> for ty::BoundRegionKind {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::BoundRegionKind;
@@ -326,7 +326,7 @@ impl<'tcx> Stable<'tcx> for ty::BoundVariableKind {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::BoundVariableKind;
@@ -345,7 +345,7 @@ impl<'tcx> Stable<'tcx> for ty::BoundVariableKind {
impl<'tcx> Stable<'tcx> for ty::IntTy {
type T = IntTy;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::IntTy::Isize => IntTy::Isize,
ty::IntTy::I8 => IntTy::I8,
@@ -360,7 +360,7 @@ impl<'tcx> Stable<'tcx> for ty::IntTy {
impl<'tcx> Stable<'tcx> for ty::UintTy {
type T = UintTy;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::UintTy::Usize => UintTy::Usize,
ty::UintTy::U8 => UintTy::U8,
@@ -375,7 +375,7 @@ impl<'tcx> Stable<'tcx> for ty::UintTy {
impl<'tcx> Stable<'tcx> for ty::FloatTy {
type T = FloatTy;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::FloatTy::F16 => FloatTy::F16,
ty::FloatTy::F32 => FloatTy::F32,
@@ -390,7 +390,7 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
tables.intern_ty(cx.lift(*self).unwrap())
}
@@ -401,7 +401,7 @@ impl<'tcx> Stable<'tcx> for ty::TyKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match self {
ty::Bool => TyKind::RigidTy(RigidTy::Bool),
@@ -487,7 +487,7 @@ impl<'tcx> Stable<'tcx> for ty::Pattern<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
match **self {
ty::PatternKind::Range { start, end } => crate::ty::Pattern::Range {
@@ -507,7 +507,7 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ct = cx.lift(*self).unwrap();
let kind = match ct.kind() {
@@ -540,7 +540,7 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
impl<'tcx> Stable<'tcx> for ty::ParamConst {
type T = crate::ty::ParamConst;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use crate::ty::ParamConst;
ParamConst { index: self.index, name: self.name.to_string() }
}
@@ -548,7 +548,7 @@ impl<'tcx> Stable<'tcx> for ty::ParamConst {
impl<'tcx> Stable<'tcx> for ty::ParamTy {
type T = crate::ty::ParamTy;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use crate::ty::ParamTy;
ParamTy { index: self.index, name: self.name.to_string() }
}
@@ -559,7 +559,7 @@ impl<'tcx> Stable<'tcx> for ty::BoundTy {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::BoundTy;
BoundTy { var: self.var.as_usize(), kind: self.kind.stable(tables, cx) }
@@ -568,7 +568,7 @@ impl<'tcx> Stable<'tcx> for ty::BoundTy {
impl<'tcx> Stable<'tcx> for ty::trait_def::TraitSpecializationKind {
type T = crate::ty::TraitSpecializationKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use crate::ty::TraitSpecializationKind;
match self {
@@ -586,7 +586,7 @@ impl<'tcx> Stable<'tcx> for ty::TraitDef {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::opaque;
use crate::ty::TraitDecl;
@@ -616,7 +616,7 @@ impl<'tcx> Stable<'tcx> for ty::TraitRef<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::TraitRef;
@@ -630,7 +630,7 @@ impl<'tcx> Stable<'tcx> for ty::Generics {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::Generics;
@@ -655,7 +655,7 @@ impl<'tcx> Stable<'tcx> for ty::Generics {
impl<'tcx> Stable<'tcx> for rustc_middle::ty::GenericParamDefKind {
type T = crate::ty::GenericParamDefKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use crate::ty::GenericParamDefKind;
match self {
ty::GenericParamDefKind::Lifetime => GenericParamDefKind::Lifetime,
@@ -675,7 +675,7 @@ impl<'tcx> Stable<'tcx> for rustc_middle::ty::GenericParamDef {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
GenericParamDef {
name: self.name.to_string(),
@@ -693,7 +693,7 @@ impl<'tcx> Stable<'tcx> for ty::PredicateKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::ty::PredicateKind;
match self {
@@ -731,7 +731,7 @@ impl<'tcx> Stable<'tcx> for ty::ClauseKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use rustc_middle::ty::ClauseKind;
match *self {
@@ -774,7 +774,7 @@ impl<'tcx> Stable<'tcx> for ty::ClauseKind<'tcx> {
impl<'tcx> Stable<'tcx> for ty::ClosureKind {
type T = crate::ty::ClosureKind;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::ty::ClosureKind::*;
match self {
Fn => crate::ty::ClosureKind::Fn,
@@ -790,7 +790,7 @@ impl<'tcx> Stable<'tcx> for ty::SubtypePredicate<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::SubtypePredicate { a, b, a_is_expected: _ } = self;
crate::ty::SubtypePredicate { a: a.stable(tables, cx), b: b.stable(tables, cx) }
@@ -803,7 +803,7 @@ impl<'tcx> Stable<'tcx> for ty::CoercePredicate<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::CoercePredicate { a, b } = self;
crate::ty::CoercePredicate { a: a.stable(tables, cx), b: b.stable(tables, cx) }
@@ -813,7 +813,7 @@ impl<'tcx> Stable<'tcx> for ty::CoercePredicate<'tcx> {
impl<'tcx> Stable<'tcx> for ty::AliasRelationDirection {
type T = crate::ty::AliasRelationDirection;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::ty::AliasRelationDirection::*;
match self {
Equate => crate::ty::AliasRelationDirection::Equate,
@@ -828,7 +828,7 @@ impl<'tcx> Stable<'tcx> for ty::TraitPredicate<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::TraitPredicate { trait_ref, polarity } = self;
crate::ty::TraitPredicate {
@@ -847,7 +847,7 @@ where
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::OutlivesPredicate(a, b) = self;
crate::ty::OutlivesPredicate(a.stable(tables, cx), b.stable(tables, cx))
@@ -860,7 +860,7 @@ impl<'tcx> Stable<'tcx> for ty::ProjectionPredicate<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let ty::ProjectionPredicate { projection_term, term } = self;
crate::ty::ProjectionPredicate {
@@ -873,7 +873,7 @@ impl<'tcx> Stable<'tcx> for ty::ProjectionPredicate<'tcx> {
impl<'tcx> Stable<'tcx> for ty::ImplPolarity {
type T = crate::ty::ImplPolarity;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::ty::ImplPolarity::*;
match self {
Positive => crate::ty::ImplPolarity::Positive,
@@ -886,7 +886,7 @@ impl<'tcx> Stable<'tcx> for ty::ImplPolarity {
impl<'tcx> Stable<'tcx> for ty::PredicatePolarity {
type T = crate::ty::PredicatePolarity;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_middle::ty::PredicatePolarity::*;
match self {
Positive => crate::ty::PredicatePolarity::Positive,
@@ -901,7 +901,7 @@ impl<'tcx> Stable<'tcx> for ty::Region<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
Region { kind: self.kind().stable(tables, cx) }
}
@@ -913,7 +913,7 @@ impl<'tcx> Stable<'tcx> for ty::RegionKind<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::{BoundRegion, EarlyParamRegion, RegionKind};
match self {
@@ -948,7 +948,7 @@ impl<'tcx> Stable<'tcx> for ty::Instance<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
let def = tables.instance_def(cx.lift(*self).unwrap());
let kind = match self.def {
@@ -976,7 +976,7 @@ impl<'tcx> Stable<'tcx> for ty::Instance<'tcx> {
impl<'tcx> Stable<'tcx> for ty::Variance {
type T = crate::mir::Variance;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::Bivariant => crate::mir::Variance::Bivariant,
ty::Contravariant => crate::mir::Variance::Contravariant,
@@ -989,7 +989,7 @@ impl<'tcx> Stable<'tcx> for ty::Variance {
impl<'tcx> Stable<'tcx> for ty::Movability {
type T = crate::ty::Movability;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
match self {
ty::Movability::Static => crate::ty::Movability::Static,
ty::Movability::Movable => crate::ty::Movability::Movable,
@@ -1000,7 +1000,7 @@ impl<'tcx> Stable<'tcx> for ty::Movability {
impl<'tcx> Stable<'tcx> for rustc_abi::ExternAbi {
type T = crate::ty::Abi;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use rustc_abi::ExternAbi;
use crate::ty::Abi;
@@ -1042,7 +1042,7 @@ impl<'tcx> Stable<'tcx> for rustc_session::cstore::ForeignModule {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::ty::ForeignModule {
def_id: tables.foreign_module_def(self.def_id),
@@ -1057,7 +1057,7 @@ impl<'tcx> Stable<'tcx> for ty::AssocKind {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::{AssocKind, AssocTypeData};
match *self {
@@ -1080,7 +1080,7 @@ impl<'tcx> Stable<'tcx> for ty::AssocKind {
impl<'tcx> Stable<'tcx> for ty::AssocItemContainer {
type T = crate::ty::AssocItemContainer;
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &SmirCtxt<'_, BridgeTys>) -> Self::T {
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
use crate::ty::AssocItemContainer;
match self {
ty::AssocItemContainer::Trait => AssocItemContainer::Trait,
@@ -1095,7 +1095,7 @@ impl<'tcx> Stable<'tcx> for ty::AssocItem {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::ty::AssocItem {
def_id: tables.assoc_def(self.def_id),
@@ -1112,7 +1112,7 @@ impl<'tcx> Stable<'tcx> for ty::ImplTraitInTraitData {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
_: &SmirCtxt<'cx, BridgeTys>,
_: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
use crate::ty::ImplTraitInTraitData;
match self {
@@ -1135,7 +1135,7 @@ impl<'tcx> Stable<'tcx> for rustc_middle::ty::util::Discr<'tcx> {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T {
crate::ty::Discr { val: self.val, ty: self.ty.stable(tables, cx) }
}

View File

@@ -10,7 +10,7 @@ use rustc_hir::def::DefKind;
use rustc_middle::ty::{List, Ty, TyCtxt};
use rustc_middle::{mir, ty};
use rustc_public_bridge::Tables;
use rustc_public_bridge::context::SmirCtxt;
use rustc_public_bridge::context::CompilerCtxt;
use super::compiler_interface::BridgeTys;
use crate::{CtorKind, ItemKind};
@@ -21,7 +21,7 @@ mod internal_cx;
/// Trait that defines the methods that are fine to call from [`RustcInternal`].
///
/// This trait is only for [`RustcInternal`]. Any other other access to rustc's internals
/// should go through [`rustc_public_bridge::context::SmirCtxt`].
/// should go through [`rustc_public_bridge::context::CompilerCtxt`].
pub trait InternalCx<'tcx>: Copy + Clone {
fn tcx(self) -> TyCtxt<'tcx>;
@@ -66,7 +66,7 @@ pub trait Stable<'tcx>: PointeeSized {
fn stable<'cx>(
&self,
tables: &mut Tables<'cx, BridgeTys>,
cx: &SmirCtxt<'cx, BridgeTys>,
cx: &CompilerCtxt<'cx, BridgeTys>,
) -> Self::T;
}