diff options
Diffstat (limited to 'compiler/rustc_public_bridge/src/context/helpers.rs')
| -rw-r--r-- | compiler/rustc_public_bridge/src/context/helpers.rs | 21 | 
1 files changed, 21 insertions, 0 deletions
| 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; +} | 
