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>
impl<'tcx> GlobalEnv<'_, 'tcx>
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>
impl<'genv, 'tcx> GlobalEnv<'genv, 'tcx>
pub fn tcx(self) -> TyCtxt<'tcx>
pub fn hir(&self) -> Map<'tcx>
pub fn sess(self) -> &'genv FluxSession
pub fn collect_specs(self) -> &'genv Specs
pub fn resolve_crate(self) -> &'genv ResolverOutput
pub fn desugar(self, def_id: LocalDefId) -> QueryResult<Node<'genv>>
pub fn fhir_crate(self) -> &'genv FluxItems<'genv>
pub fn map(self) -> Map<'genv, 'tcx>
pub fn alloc<T>(&self, val: T) -> &'genv T
pub fn alloc_slice<T: Copy>(self, slice: &[T]) -> &'genv [T]
pub fn alloc_slice_fill_iter<T, I>(self, it: I) -> &'genv [T]
pub fn def_kind(&self, def_id: impl IntoQueryParam<DefId>) -> DefKind
sourcepub fn alloc_slice_with_capacity<T, I>(self, cap: usize, it: I) -> &'genv [T]where
I: IntoIterator<Item = T>,
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.
pub fn spec_func_defns(&self) -> QueryResult<&SpecFuncDefns>
pub fn qualifiers(self) -> QueryResult<&'genv [Qualifier]>
sourcepub fn qualifiers_for(
self,
did: LocalDefId,
) -> QueryResult<impl Iterator<Item = &'genv Qualifier>>
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.
pub fn func_decl(self, name: Symbol) -> QueryResult<SpecFuncDecl>
pub fn variances_of(self, did: DefId) -> &'tcx [Variance]
pub fn mir(self, def_id: LocalDefId) -> QueryResult<Rc<Body<'tcx>>>
pub fn lower_generics_of(self, def_id: DefId) -> Generics<'tcx>
pub fn lower_predicates_of( self, def_id: impl Into<DefId>, ) -> QueryResult<GenericPredicates>
pub fn lower_type_of( self, def_id: impl Into<DefId>, ) -> QueryResult<EarlyBinder<Ty>>
pub fn lower_fn_sig( self, def_id: impl Into<DefId>, ) -> QueryResult<EarlyBinder<PolyFnSig>>
pub fn adt_def(self, def_id: impl IntoQueryParam<DefId>) -> QueryResult<AdtDef>
pub fn adt_sort_def_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<AdtSortDef>
pub fn check_wf(self, def_id: LocalDefId) -> QueryResult<Rc<WfckResults>>
pub fn impl_trait_ref( self, impl_id: DefId, ) -> QueryResult<Option<EarlyBinder<TraitRef>>>
pub fn generics_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<Generics>
pub fn refinement_generics_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<RefinementGenerics>
pub fn predicates_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<EarlyBinder<GenericPredicates>>
pub fn assoc_refinements_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<AssocRefinements>
pub fn default_assoc_refinement_def( self, trait_id: DefId, name: Symbol, ) -> QueryResult<Option<EarlyBinder<Lambda>>>
pub fn assoc_refinement_def( self, impl_id: DefId, name: Symbol, ) -> QueryResult<EarlyBinder<Lambda>>
pub fn sort_of_assoc_reft( self, def_id: impl IntoQueryParam<DefId>, name: Symbol, ) -> QueryResult<Option<EarlyBinder<FuncSort>>>
pub fn item_bounds( self, def_id: DefId, ) -> QueryResult<EarlyBinder<List<Clause>>>
pub fn type_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<EarlyBinder<TyOrCtor>>
pub fn fn_sig( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<EarlyBinder<PolyFnSig>>
pub fn variants_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<Opaqueness<EarlyBinder<PolyVariants>>>
pub fn variant_sig( self, def_id: DefId, variant_idx: VariantIdx, ) -> QueryResult<Opaqueness<EarlyBinder<PolyVariant>>>
pub fn lower_late_bound_vars( self, def_id: LocalDefId, ) -> QueryResult<List<BoundVariableKind>>
pub fn is_box(&self, res: Res) -> bool
pub fn def_id_to_param_index(&self, def_id: DefId) -> u32
pub(crate) fn cstore(self) -> &'genv CrateStoreDyn
pub fn has_trusted_impl(&self, def_id: DefId) -> bool
pub fn is_fn_once_output(&self, def_id: DefId) -> bool
sourcepub fn iter_local_def_id(
self,
) -> impl Iterator<Item = LocalDefId> + use<'tcx, 'genv>
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
pub fn iter_extern_def_id( self, ) -> impl Iterator<Item = DefId> + use<'tcx, 'genv>
pub fn maybe_extern_id(self, local_id: LocalDefId) -> MaybeExternId
pub fn resolve_id(self, def_id: DefId) -> ResolvedDefId
sourcepub fn check_overflow(self, def_id: LocalDefId) -> Option<bool>
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
check_overflow
was explicitly marked on an itemcheck_overflow
boolean representation is false (check_overflow(no)
)
sourcepub fn trusted(self, def_id: LocalDefId) -> bool
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
.
pub fn trusted_impl(self, def_id: LocalDefId) -> bool
sourcepub fn is_dummy(self, def_id: LocalDefId) -> bool
pub fn is_dummy(self, def_id: LocalDefId) -> bool
Whether the item is a dummy item created by the extern spec macro.
sourcepub fn ignored(self, def_id: LocalDefId) -> bool
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
.
sourcepub fn should_fail(self, def_id: LocalDefId) -> bool
pub fn should_fail(self, def_id: LocalDefId) -> bool
Whether the function is marked with #[flux::should_fail]
sourcefn traverse_parents<T>(
self,
def_id: LocalDefId,
f: impl Fn(LocalDefId) -> Option<T>,
) -> Option<T>
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
.
pub fn crate_config(self) -> Option<CrateConfig>
source§impl<'sess, 'tcx> GlobalEnv<'sess, 'tcx>
impl<'sess, 'tcx> GlobalEnv<'sess, 'tcx>
pub fn sort_of_self_ty_alias(self, alias_to: DefId) -> QueryResult<Option<Sort>>
pub fn sort_of_generic_param(self, def_id: DefId) -> QueryResult<Option<Sort>>
fn sort_of_rust_ty(self, def_id: DefId, ty: Ty<'_>) -> QueryResult<Option<Sort>>
pub fn normalize_weak_alias_sort(self, alias_ty: &AliasTy) -> QueryResult<Sort>
Trait Implementations§
source§impl ErrorEmitter for GlobalEnv<'_, '_>
impl ErrorEmitter for GlobalEnv<'_, '_>
fn emit<'a>(&'a self, err: impl Diagnostic<'a>) -> ErrorGuaranteed
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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