Skip to main content

BaseState

Trait BaseState 

Source
pub trait BaseState<'tcx>: Sized {
    // Required method
    fn base(&self) -> Base<'tcx>;

    // Provided methods
    fn tcx(&self) -> TyCtxt<'tcx> { ... }
    fn raise(&self, level: Level<'_>, span: Span, msg: String) { ... }
    fn with_hax_owner(&self, owner: &DefId) -> StateWithOwner<'tcx> { ... }
    fn with_rustc_owner(&self, owner_id: RDefId) -> StateWithOwner<'tcx> { ... }
    fn base_state(&self) -> StateWithBase<'tcx> { ... }
    fn with_global_cache<T>(
        &self,
        f: impl FnOnce(&mut GlobalCache<'tcx>) -> T,
    ) -> T { ... }
    fn with_item_cache<T>(
        &self,
        def_id: &DefId,
        f: impl FnOnce(&mut ItemCache<'tcx>) -> T,
    ) -> T { ... }
}

Required Methods§

Source

fn base(&self) -> Base<'tcx>

Provided Methods§

Source

fn tcx(&self) -> TyCtxt<'tcx>

Source

fn raise(&self, level: Level<'_>, span: Span, msg: String)

Raise an error or warning.

Source

fn with_hax_owner(&self, owner: &DefId) -> StateWithOwner<'tcx>

Create a state with the given owner.

Source

fn with_rustc_owner(&self, owner_id: RDefId) -> StateWithOwner<'tcx>

Create a state with the given owner.

Source

fn base_state(&self) -> StateWithBase<'tcx>

State with only access to the global state.

Source

fn with_global_cache<T>(&self, f: impl FnOnce(&mut GlobalCache<'tcx>) -> T) -> T

Access the global cache. You must not call sinto within this function as this will likely result in BorrowMut panics.

Source

fn with_item_cache<T>( &self, def_id: &DefId, f: impl FnOnce(&mut ItemCache<'tcx>) -> T, ) -> T

Access the cache for a given item. You must not call sinto within this function as this will likely result in BorrowMut panics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'tcx, A: BaseState<'tcx>, B> BaseState<'tcx> for (A, B)

Source§

fn base(&self) -> Base<'tcx>

Implementors§

Source§

impl<'tcx, O> BaseState<'tcx> for State<'tcx, O>