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: impl IntoQueryParam<DefId>, ) -> Generics<'tcx>
pub fn lower_predicates_of( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<GenericPredicates>
pub fn lower_type_of( self, def_id: impl IntoQueryParam<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 constant_info( self, def_id: impl IntoQueryParam<DefId>, ) -> QueryResult<ConstantInfo>
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<EarlyBinder<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>
Sourcepub fn assoc_refinement_body_for_impl(
self,
trait_assoc_id: AssocReftId,
impl_id: DefId,
) -> QueryResult<EarlyBinder<Lambda>>
pub fn assoc_refinement_body_for_impl( self, trait_assoc_id: AssocReftId, impl_id: DefId, ) -> QueryResult<EarlyBinder<Lambda>>
Given the id of an associated refinement in a trait definition returns the body for the
corresponding associated refinement in the implementation with id impl_id
.
This function returns QueryErr::MissingAssocReft
if the associated refinement is not
found in the implementation and there’s no default body in the trait. This can happen if an
extern spec adds an associated refinement without a default body because we are currently
not checking compare_impl_item
for those definitions.
pub fn default_assoc_refinement_body( self, trait_assoc_id: AssocReftId, ) -> QueryResult<Option<EarlyBinder<Lambda>>>
pub fn assoc_refinement_body( self, impl_assoc_id: AssocReftId, ) -> QueryResult<EarlyBinder<Lambda>>
pub fn sort_of_assoc_reft( self, assoc_id: AssocReftId, ) -> QueryResult<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
pub fn infer_opts(self, def_id: LocalDefId) -> InferOpts
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 FnMut(LocalDefId) -> Option<T>,
) -> Option<T>
fn traverse_parents<T>( self, def_id: LocalDefId, f: impl FnMut(LocalDefId) -> Option<T>, ) -> Option<T>
Traverse the parent chain of def_id
until the first node for which f
returns Some
.
Source§impl GlobalEnv<'_, '_>
impl GlobalEnv<'_, '_>
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>>
pub fn sort_of_def_id(self, def_id: DefId) -> QueryResult<Option<Sort>>
pub 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>
pub fn deep_normalize_weak_alias_sorts<T: TypeFoldable>( self, t: &T, ) -> QueryResult<T>
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