Struct flux_middle::global_env::GlobalEnv

source ·
pub struct GlobalEnv<'genv, 'tcx> {
    inner: &'genv GlobalEnvInner<'genv, 'tcx>,
}

Fields§

§inner: &'genv GlobalEnvInner<'genv, 'tcx>

Implementations§

source§

impl<'tcx> GlobalEnv<'_, 'tcx>

source

pub fn enter<'a, R>( tcx: TyCtxt<'tcx>, sess: &'a FluxSession, cstore: Box<CrateStoreDyn>, arena: &'a Arena, providers: Providers, f: impl for<'genv> FnOnce(GlobalEnv<'genv, 'tcx>) -> R, ) -> R

source§

impl<'genv, 'tcx> GlobalEnv<'genv, 'tcx>

source

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

source

pub fn hir(&self) -> Map<'tcx>

source

pub fn sess(self) -> &'genv FluxSession

source

pub fn collect_specs(self) -> &'genv Specs

source

pub fn resolve_crate(self) -> &'genv ResolverOutput

source

pub fn desugar(self, def_id: LocalDefId) -> QueryResult<Node<'genv>>

source

pub fn fhir_crate(self) -> &'genv FluxItems<'genv>

source

pub fn map(self) -> Map<'genv, 'tcx>

source

pub fn alloc<T>(&self, val: T) -> &'genv T

source

pub fn alloc_slice<T: Copy>(self, slice: &[T]) -> &'genv [T]

source

pub fn alloc_slice_fill_iter<T, I>(self, it: I) -> &'genv [T]
where I: IntoIterator<Item = T>, I::IntoIter: ExactSizeIterator,

source

pub fn def_kind(&self, def_id: impl IntoQueryParam<DefId>) -> DefKind

source

pub fn alloc_slice_with_capacity<T, I>(self, cap: usize, it: I) -> &'genv [T]
where I: IntoIterator<Item = T>,

Allocates space to store cap elements of type T.

The elements are initialized using the supplied iterator. At most cap elements will be retrieved from the iterator. If the iterator yields fewer than cap elements, the returned slice will be of length less than the allocated capacity.

§Panics

Panics if reserving space for the slice fails.

source

pub fn spec_func_defns(&self) -> QueryResult<&SpecFuncDefns>

source

pub fn qualifiers(self) -> QueryResult<&'genv [Qualifier]>

source

pub fn qualifiers_for( self, did: LocalDefId, ) -> QueryResult<impl Iterator<Item = &'genv Qualifier>>

Return all the qualifiers that apply to an item, including both global and local qualifiers.

source

pub fn func_decl(self, name: Symbol) -> QueryResult<SpecFuncDecl>

source

pub fn variances_of(self, did: DefId) -> &'tcx [Variance]

source

pub fn mir(self, def_id: LocalDefId) -> QueryResult<Rc<Body<'tcx>>>

source

pub fn lower_generics_of(self, def_id: DefId) -> Generics<'tcx>

source

pub fn lower_predicates_of( self, def_id: impl Into<DefId>, ) -> QueryResult<GenericPredicates>

source

pub fn lower_type_of( self, def_id: impl Into<DefId>, ) -> QueryResult<EarlyBinder<Ty>>

source

pub fn lower_fn_sig( self, def_id: impl Into<DefId>, ) -> QueryResult<EarlyBinder<PolyFnSig>>

source

pub fn adt_def(self, def_id: impl IntoQueryParam<DefId>) -> QueryResult<AdtDef>

source

pub fn adt_sort_def_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<AdtSortDef>

source

pub fn check_wf(self, def_id: LocalDefId) -> QueryResult<Rc<WfckResults>>

source

pub fn impl_trait_ref( self, impl_id: DefId, ) -> QueryResult<Option<EarlyBinder<TraitRef>>>

source

pub fn generics_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<Generics>

source

pub fn refinement_generics_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<RefinementGenerics>

source

pub fn predicates_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<EarlyBinder<GenericPredicates>>

source

pub fn assoc_refinements_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<AssocRefinements>

source

pub fn default_assoc_refinement_def( self, trait_id: DefId, name: Symbol, ) -> QueryResult<Option<EarlyBinder<Lambda>>>

source

pub fn assoc_refinement_def( self, impl_id: DefId, name: Symbol, ) -> QueryResult<EarlyBinder<Lambda>>

source

pub fn sort_of_assoc_reft( self, def_id: impl IntoQueryParam<DefId>, name: Symbol, ) -> QueryResult<Option<EarlyBinder<FuncSort>>>

source

pub fn item_bounds( self, def_id: DefId, ) -> QueryResult<EarlyBinder<List<Clause>>>

source

pub fn type_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<EarlyBinder<TyOrCtor>>

source

pub fn fn_sig( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<EarlyBinder<PolyFnSig>>

source

pub fn variants_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<Opaqueness<EarlyBinder<PolyVariants>>>

source

pub fn variant_sig( self, def_id: DefId, variant_idx: VariantIdx, ) -> QueryResult<Opaqueness<EarlyBinder<PolyVariant>>>

source

pub fn lower_late_bound_vars( self, def_id: LocalDefId, ) -> QueryResult<List<BoundVariableKind>>

source

pub fn is_box(&self, res: Res) -> bool

source

pub fn def_id_to_param_index(&self, def_id: DefId) -> u32

source

pub(crate) fn cstore(self) -> &'genv CrateStoreDyn

source

pub fn has_trusted_impl(&self, def_id: DefId) -> bool

source

pub fn is_fn_once_output(&self, def_id: DefId) -> bool

source

pub fn iter_local_def_id( self, ) -> impl Iterator<Item = LocalDefId> + use<'tcx, 'genv>

Iterator over all local def ids that are not a extern spec

source

pub fn iter_extern_def_id( self, ) -> impl Iterator<Item = DefId> + use<'tcx, 'genv>

source

pub fn maybe_extern_id(self, local_id: LocalDefId) -> MaybeExternId

source

pub fn resolve_id(self, def_id: DefId) -> ResolvedDefId

source

pub fn check_overflow(self, def_id: LocalDefId) -> Option<bool>

Transitively follow the parent-chain of def_id to find the first containing item with an explicit #[flux::check_overflow(..)] annotation and return whether that item has an explicitly annotation and whether it requires an overflow check or not. If no explicit annotation is found, return None

Note:

This uses Option since we want to be explicit about whether or not the check_overflow attribute was actually on an item

This is relevant in cases where Flux is configured to check overflows globally but an item is marked check_overflow(no) explicitly.

i.e. in these cases we need to know that

  1. check_overflow was explicitly marked on an item
  2. check_overflow boolean representation is false (check_overflow(no))
source

pub fn trusted(self, def_id: LocalDefId) -> bool

Transitively follow the parent-chain of def_id to find the first containing item with an explicit #[flux::trusted(..)] annotation and return whether that item is trusted or not. If no explicit annotation is found, return false.

source

pub fn trusted_impl(self, def_id: LocalDefId) -> bool

source

pub fn is_dummy(self, def_id: LocalDefId) -> bool

Whether the item is a dummy item created by the extern spec macro.

See crate::Specs::dummy_extern

source

pub fn ignored(self, def_id: LocalDefId) -> bool

Transitively follow the parent-chain of def_id to find the first containing item with an explicit #[flux::ignore(..)] annotation and return whether that item is ignored or not. If no explicit annotation is found, return false.

source

pub fn should_fail(self, def_id: LocalDefId) -> bool

Whether the function is marked with #[flux::should_fail]

source

fn traverse_parents<T>( self, def_id: LocalDefId, f: impl Fn(LocalDefId) -> Option<T>, ) -> Option<T>

Traverse the parent chain of def_id until the first node for which f returns Some.

source

pub fn crate_config(self) -> Option<CrateConfig>

source§

impl<'sess, 'tcx> GlobalEnv<'sess, 'tcx>

Trait Implementations§

source§

impl<'genv, 'tcx> Clone for GlobalEnv<'genv, 'tcx>

source§

fn clone(&self) -> GlobalEnv<'genv, 'tcx>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ErrorEmitter for GlobalEnv<'_, '_>

source§

fn emit<'a>(&'a self, err: impl Diagnostic<'a>) -> ErrorGuaranteed

source§

impl<'genv, 'tcx> Copy for GlobalEnv<'genv, 'tcx>

Auto Trait Implementations§

§

impl<'genv, 'tcx> Freeze for GlobalEnv<'genv, 'tcx>

§

impl<'genv, 'tcx> !RefUnwindSafe for GlobalEnv<'genv, 'tcx>

§

impl<'genv, 'tcx> !Send for GlobalEnv<'genv, 'tcx>

§

impl<'genv, 'tcx> !Sync for GlobalEnv<'genv, 'tcx>

§

impl<'genv, 'tcx> Unpin for GlobalEnv<'genv, 'tcx>

§

impl<'genv, 'tcx> !UnwindSafe for GlobalEnv<'genv, 'tcx>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<P> IntoQueryParam<P> for P

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.