rustc_smir/context/
traits.rs

1//! A set of traits that define a stable interface to rustc's internals.
2//!
3//! These traits abstract rustc's internal APIs, allowing StableMIR to maintain a stable
4//! interface regardless of internal compiler changes.
5
6use rustc_middle::mir::interpret::AllocRange;
7use rustc_middle::ty;
8use rustc_middle::ty::Ty;
9use rustc_span::def_id::DefId;
10
11pub trait SmirTy<'tcx> {
12    fn new_foreign(&self, def_id: DefId) -> Ty<'tcx>;
13}
14
15pub trait SmirTypingEnv<'tcx> {
16    fn fully_monomorphized(&self) -> ty::TypingEnv<'tcx>;
17}
18
19pub trait SmirAllocRange<'tcx> {
20    fn alloc_range(&self, offset: rustc_abi::Size, size: rustc_abi::Size) -> AllocRange;
21}