## TyCtxtEnsureDone

# Struct TyCtxtEnsureDone

Source

    pub struct TyCtxtEnsureDone<'tcx> {
        pub tcx: TyCtxt<'tcx>,
    }

## Fields§

§`tcx: TyCtxt<'tcx>`

## Implementations§

Source§

### impl<'tcx> TyCtxtEnsureDone<'tcx>

Source

#### pub fn trigger_delayed_bug(self, key: impl IntoQueryParam<DefId>)

This exists purely for testing the interactions between delayed bugs and incremental.

Source

#### pub fn registered_tools(self, key: ())

Collects the list of all tools registered using `#![register_tool]`.

Source

#### pub fn early_lint_checks(self, key: ())

[query description - consider adding a doc-comment!] perform lints prior to AST lowering

Source

#### pub fn env_var_os(self, key: &'tcx OsStr)

Tracked access to environment variables.

Useful for the implementation of `std::env!`, `proc-macro`s change detection and other changes in the compiler’s behaviour that is easier to control with an environment variable than a flag.

NOTE: This currently does not work with dependency info in the analysis, codegen and linking passes, place extra code at the top of `rustc_interface::passes::write_dep_info` to make that work.

Source

#### pub fn resolutions(self, key: ())

[query description - consider adding a doc-comment!] getting the resolver outputs

Source

#### pub fn resolver_for_lowering_raw(self, key: ())

[query description - consider adding a doc-comment!] getting the resolver for lowering

Source

#### pub fn source_span(self, key: impl IntoQueryParam<LocalDefId>)

Return the span for a definition.

Contrary to `def_span` below, this query returns the full absolute span of the definition. This span is meant for dep-tracking rather than diagnostics. It should not be used outside of rustc_middle::hir::source_map.

Source

#### pub fn hir_crate(self, key: ())

Represents crate as a whole (as distinct from the top-level crate module).

If you call `tcx.hir_crate(())` we will have to assume that any change means that you need to be recompiled. This is because the `hir_crate` query gives you access to all other items. To avoid this fate, do not call `tcx.hir_crate(())`; instead, prefer wrappers like `TyCtxt::hir_visit_all_item_likes_in_crate`.

Source

#### pub fn hir_crate_items(self, key: ())

All items in the crate.

Source

#### pub fn hir_module_items(self, key: LocalModDefId)

The items in a module.

This can be conveniently accessed by `tcx.hir_visit_item_likes_in_module`. Avoid calling this query directly.

Source

#### pub fn local_def_id_to_hir_id(self, key: impl IntoQueryParam<LocalDefId>)

Returns HIR ID for the given `LocalDefId`.

Source

#### pub fn hir_owner_parent(self, key: OwnerId)

Gives access to the HIR node’s parent for the HIR owner `key`.

This can be conveniently accessed by `tcx.hir_*` methods. Avoid calling this query directly.

Source

#### pub fn opt_hir_owner_nodes(self, key: impl IntoQueryParam<LocalDefId>)

Gives access to the HIR nodes and bodies inside `key` if it’s a HIR owner.

This can be conveniently accessed by `tcx.hir_*` methods. Avoid calling this query directly.

Source

#### pub fn hir_attr_map(self, key: OwnerId)

Gives access to the HIR attributes inside the HIR owner `key`.

This can be conveniently accessed by `tcx.hir_*` methods. Avoid calling this query directly.

Source

#### pub fn opt_ast_lowering_delayed_lints(self, key: OwnerId)

Gives access to lints emitted during ast lowering.

This can be conveniently accessed by `tcx.hir_*` methods. Avoid calling this query directly.

Source

#### pub fn const_param_default(self, key: impl IntoQueryParam<DefId>)

Returns the default of the const pararameter given by `DefId`.

E.g., given `struct Ty<const N: usize = 3>;` this returns `3` for `N`.

Source

#### pub fn type_of(self, key: impl IntoQueryParam<DefId>)

Returns the type of the definition given by `DefId`.

For type aliases (whether eager or lazy) and associated types, this returns the underlying aliased type (not the corresponding alias type).

For opaque types, this returns and thus reveals the hidden type! If you want to detect cycle errors use `type_of_opaque` instead.

To clarify, for type definitions, this does not return the “type of a type” (aka kind or sort) in the type-theoretical sense! It merely returns the type primarily associated with it.

##### §Panics

This query will panic if the given definition doesn’t (and can’t conceptually) have an (underlying) type.

Source

#### pub fn type_of_opaque(self, key: impl IntoQueryParam<DefId>)

Returns the hidden type of the opaque type given by `DefId` unless a cycle occurred.

This is a specialized instance of `Self::type_of` that detects query cycles. Unless `CyclePlaceholder` needs to be handled separately, call `Self::type_of` instead. This is used to improve the error message in cases where revealing the hidden type for auto-trait leakage cycles.

##### §Panics

This query will panic if the given definition is not an opaque type.

Source

#### pub fn type_of_opaque_hir_typeck(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] computing type of opaque `{path}` via HIR typeck

Source

#### pub fn type_alias_is_lazy(self, key: impl IntoQueryParam<DefId>)

Returns whether the type alias given by `DefId` is lazy.

I.e., if the type alias expands / ought to expand to a free alias type instead of the underlying aliased type.

Relevant for features `lazy_type_alias` and `type_alias_impl_trait`.

##### §Panics

This query may panic if the given definition is not a type alias.

Source

#### pub fn collect_return_position_impl_trait_in_trait_tys( self, key: impl IntoQueryParam<DefId>, )

[query description - consider adding a doc-comment!] comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process

Source

#### pub fn opaque_ty_origin(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] determine where the opaque originates from

Source

#### pub fn unsizing_params_for_adt(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] determining what parameters of `tcx.def_path_str(key)` can participate in unsizing

Source

#### pub fn analysis(self, key: ())

The root query triggering all analysis passes like typeck or borrowck.

Source

#### pub fn check_expectations(self, key: Option<Symbol>)

This query checks the fulfillment of collected lint expectations. All lint emitting queries have to be done before this is executed to ensure that all expectations can be fulfilled.

This is an extra query to enable other drivers (like rustdoc) to only execute a small subset of the `analysis` query, while allowing lints to be expected. In rustc, this query will be executed as part of the `analysis` query and doesn’t have to be called a second time.

Tools can additionally pass in a tool filter. That will restrict the expectations to only trigger for lints starting with the listed tool name. This is useful for cases were not all linting code from rustc was called. With the default `None` all registered lints will also be checked for expectation fulfillment.

Source

#### pub fn generics_of(self, key: impl IntoQueryParam<DefId>)

Returns the generics of the definition given by `DefId`.

Source

#### pub fn predicates_of(self, key: impl IntoQueryParam<DefId>)

Returns the (elaborated) predicates of the definition given by `DefId` that must be proven true at usage sites (and which can be assumed at definition site).

This is almost always the “predicates query” that you want.

Tip: You can use `#[rustc_dump_predicates]` on an item to basically print the result of this query for use in UI tests or for debugging purposes.

Source

#### pub fn opaque_types_defined_by(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] computing the opaque types defined by `tcx.def_path_str(key.to_def_id())`

Source

#### pub fn nested_bodies_within(self, key: impl IntoQueryParam<LocalDefId>)

A list of all bodies inside of `key`, nested bodies are always stored before their parent.

Source

#### pub fn explicit_item_bounds(self, key: impl IntoQueryParam<DefId>)

Returns the explicitly user-written bounds on the associated or opaque type given by `DefId` that must be proven true at definition site (and which can be assumed at usage sites).

For associated types, these must be satisfied for an implementation to be well-formed, and for opaque types, these are required to be satisfied by the hidden type of the opaque.

Bounds from the parent (e.g. with nested `impl Trait`) are not included.

Syntactially, these are the bounds written on associated types in trait definitions, or those after the `impl` keyword for an opaque:

ⓘ

    trait Trait { type X: Bound + 'lt; }
    //                    ^^^^^^^^^^^
    fn function() -> impl Debug + Display { /*...*/ }
    //                    ^^^^^^^^^^^^^^^

Source

#### pub fn explicit_item_self_bounds(self, key: impl IntoQueryParam<DefId>)

Returns the explicitly user-written bounds that share the `Self` type of the item.

These are a subset of the explicit item bounds that may explicitly be used for things like closure signature deduction.

Source

#### pub fn item_bounds(self, key: impl IntoQueryParam<DefId>)

Returns the (elaborated) bounds on the associated or opaque type given by `DefId` that must be proven true at definition site (and which can be assumed at usage sites).

Bounds from the parent (e.g. with nested `impl Trait`) are not included.

Tip: You can use `#[rustc_dump_item_bounds]` on an item to basically print the result of this query for use in UI tests or for debugging purposes.

##### §Examples

    trait Trait { type Assoc: Eq + ?Sized; }

While `Self::explicit_item_bounds` returns `[<Self as Trait>::Assoc: Eq]` here, `item_bounds` returns:

    [
        <Self as Trait>::Assoc: Eq,
        <Self as Trait>::Assoc: PartialEq<<Self as Trait>::Assoc>
    ]

Source

#### pub fn item_self_bounds(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] elaborating item assumptions for `tcx.def_path_str(key)`

Source

#### pub fn item_non_self_bounds(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] elaborating item assumptions for `tcx.def_path_str(key)`

Source

#### pub fn impl_super_outlives(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] elaborating supertrait outlives for trait of `tcx.def_path_str(key)`

Source

#### pub fn native_libraries(self, key: CrateNum)

Look up all native libraries this crate depends on. These are assembled from the following places:

- `extern` blocks (depending on their `link` attributes)
- the `libs` (`-l`) option

Source

#### pub fn shallow_lint_levels_on(self, key: OwnerId)

[query description - consider adding a doc-comment!] looking up lint levels for `tcx.def_path_str(key)`

Source

#### pub fn lint_expectations(self, key: ())

[query description - consider adding a doc-comment!] computing `#[expect]`ed lints in this crate

Source

#### pub fn lints_that_dont_need_to_run(self, key: ())

[query description - consider adding a doc-comment!] Computing all lints that are explicitly enabled or with a default level greater than Allow

Source

#### pub fn expn_that_defined(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] getting the expansion that defined `tcx.def_path_str(key)`

Source

#### pub fn is_panic_runtime(self, key: CrateNum)

[query description - consider adding a doc-comment!] checking if the crate is_panic_runtime

Source

#### pub fn representability(self, key: impl IntoQueryParam<LocalDefId>)

Checks whether a type is representable or infinitely sized

Source

#### pub fn representability_adt_ty(self, key: Ty<'tcx>)

An implementation detail for the `representability` query

Source

#### pub fn params_in_repr(self, key: impl IntoQueryParam<DefId>)

Set of param indexes for type params that are in the type’s representation

Source

#### pub fn thir_body(self, key: impl IntoQueryParam<LocalDefId>)

Fetch the THIR for a given body. The THIR body gets stolen by unsafety checking unless `-Zno-steal-thir` is on.

Source

#### pub fn mir_keys(self, key: ())

Set of all the `DefId`s in this crate that have MIR associated with them. This includes all the body owners, but also things like struct constructors.

Source

#### pub fn mir_const_qualif(self, key: impl IntoQueryParam<DefId>)

Maps DefId’s that have an associated `mir::Body` to the result of the MIR const-checking pass. This is the set of qualifs in the final value of a `const`.

Source

#### pub fn mir_built(self, key: impl IntoQueryParam<LocalDefId>)

Build the MIR for a given `DefId` and prepare it for const qualification.

See the rustc dev guide for more info.

Source

#### pub fn thir_abstract_const(self, key: impl IntoQueryParam<DefId>)

Try to build an abstract representation of the given constant.

Source

#### pub fn mir_drops_elaborated_and_const_checked( self, key: impl IntoQueryParam<LocalDefId>, )

[query description - consider adding a doc-comment!] elaborating drops for `tcx.def_path_str(key)`

Source

#### pub fn mir_for_ctfe(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] caching mir of `tcx.def_path_str(key)` for CTFE

Source

#### pub fn mir_promoted(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] promoting constants in MIR for `tcx.def_path_str(key)`

Source

#### pub fn closure_typeinfo(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] finding symbols for captures of closure `tcx.def_path_str(key)`

Source

#### pub fn closure_saved_names_of_captured_variables( self, key: impl IntoQueryParam<DefId>, )

Returns names of captured upvars for closures and coroutines.

Here are some examples:

- `name__field1__field2` when the upvar is captured by value.
- `_ref__name__field` when the upvar is captured by reference.

For coroutines this only contains upvars that are shared by all states.

Source

#### pub fn mir_coroutine_witnesses(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] coroutine witness types for `tcx.def_path_str(key)`

Source

#### pub fn check_coroutine_obligations(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] verify auto trait bounds for coroutine interior type `tcx.def_path_str(key)`

Source

#### pub fn check_potentially_region_dependent_goals( self, key: impl IntoQueryParam<LocalDefId>, )

Used in case `mir_borrowck` fails to prove an obligation. We generally assume that all goals we prove in MIR type check hold as we’ve already checked them in HIR typeck.

However, we replace each free region in the MIR body with a unique region inference variable. As we may rely on structural identity when proving goals this may cause a goal to no longer hold. We store obligations for which this may happen during HIR typeck in the `TypeckResults`. We then uniquify and reprove them in case MIR typeck encounters an unexpected error. We expect this to result in an error when used and delay a bug if it does not.

Source

#### pub fn optimized_mir(self, key: impl IntoQueryParam<DefId>)

MIR after our optimization passes have run. This is MIR that is ready for codegen. This is also the only query that can fetch non-local MIR, at present.

Source

#### pub fn coverage_attr_on(self, key: impl IntoQueryParam<LocalDefId>)

Checks for the nearest `#[coverage(off)]` or `#[coverage(on)]` on this def and any enclosing defs, up to the crate root.

Returns `false` if `#[coverage(off)]` was found, or `true` if either `#[coverage(on)]` or no coverage attribute was found.

Source

#### pub fn coverage_ids_info(self, key: InstanceKind<'tcx>)

Scans through a function’s MIR after MIR optimizations, to prepare the information needed by codegen when `-Cinstrument-coverage` is active.

This includes the details of where to insert `llvm.instrprof.increment` intrinsics, and the expression tables to be embedded in the function’s coverage metadata.

FIXME(Zalathar): This query’s purpose has drifted a bit and should probably be renamed, but that can wait until after the potential follow-ups to #136053 have settled down.

Returns `None` for functions that were not instrumented.

Source

#### pub fn promoted_mir(self, key: impl IntoQueryParam<DefId>)

The `DefId` is the `DefId` of the containing MIR body. Promoteds do not have their own `DefId`. This function returns all promoteds in the specified body. The body references promoteds by the `DefId` and the `mir::Promoted` index. This is necessary, because after inlining a body may refer to promoteds from other bodies. In that case you still need to use the `DefId` of the original body.

Source

#### pub fn erase_and_anonymize_regions_ty(self, key: Ty<'tcx>)

Erases regions from `ty` to yield a new type. Normally you would just use `tcx.erase_and_anonymize_regions(value)`, however, which uses this query as a kind of cache.

Source

#### pub fn wasm_import_module_map(self, key: CrateNum)

[query description - consider adding a doc-comment!] getting wasm import module map

Source

#### pub fn trait_explicit_predicates_and_bounds( self, key: impl IntoQueryParam<LocalDefId>, )

Returns the explicitly user-written predicates and bounds of the trait given by `DefId`.

Traits are unusual, because predicates on associated types are converted into bounds on that type for backwards compatibility:

    trait X where Self::U: Copy { type U; }

becomes

    trait X { type U: Copy; }

`Self::explicit_predicates_of` and `Self::explicit_item_bounds` will then take the appropriate subsets of the predicates here.

##### §Panics

This query will panic if the given definition is not a trait.

Source

#### pub fn explicit_predicates_of(self, key: impl IntoQueryParam<DefId>)

Returns the explicitly user-written predicates of the definition given by `DefId` that must be proven true at usage sites (and which can be assumed at definition site).

You should probably use `Self::predicates_of` unless you’re looking for predicates with explicit spans for diagnostics purposes.

Source

#### pub fn inferred_outlives_of(self, key: impl IntoQueryParam<DefId>)

Returns the inferred outlives-predicates of the item given by `DefId`.

E.g., for `struct Foo<'a, T> { x: &'a T }`, this would return `[T: 'a]`.

Tip: You can use `#[rustc_outlives]` on an item to basically print the result of this query for use in UI tests or for debugging purposes.

Source

#### pub fn explicit_super_predicates_of(self, key: impl IntoQueryParam<DefId>)

Returns the explicitly user-written super-predicates of the trait given by `DefId`.

These predicates are unelaborated and consequently don’t contain transitive super-predicates.

This is a subset of the full list of predicates. We store these in a separate map because we must evaluate them even during type conversion, often before the full predicates are available (note that super-predicates must not be cyclic).

Source

#### pub fn explicit_implied_predicates_of(self, key: impl IntoQueryParam<DefId>)

The predicates of the trait that are implied during elaboration.

This is a superset of the super-predicates of the trait, but a subset of the predicates of the trait. For regular traits, this includes all super-predicates and their associated type bounds. For trait aliases, currently, this includes all of the predicates of the trait alias.

Source

#### pub fn explicit_supertraits_containing_assoc_item(self, key: (DefId, Ident))

The Ident is the name of an associated type.The query returns only the subset of supertraits that define the given associated type. This is used to avoid cycles in resolving type-dependent associated item paths like `T::Item`.

Source

#### pub fn const_conditions(self, key: impl IntoQueryParam<DefId>)

Compute the conditions that need to hold for a conditionally-const item to be const. That is, compute the set of `[const]` where clauses for a given item.

This can be thought of as the `[const]` equivalent of `predicates_of`. These are the predicates that need to be proven at usage sites, and can be assumed at definition.

This query also computes the `[const]` where clauses for associated types, which are not “const”, but which have item bounds which may be `[const]`. These must hold for the `[const]` item bound to hold.

Source

#### pub fn explicit_implied_const_bounds(self, key: impl IntoQueryParam<DefId>)

Compute the const bounds that are implied for a conditionally-const item.

This can be though of as the `[const]` equivalent of `explicit_item_bounds`. These are the predicates that need to proven at definition sites, and can be assumed at usage sites.

Source

#### pub fn type_param_predicates(self, key: (LocalDefId, LocalDefId, Ident))

To avoid cycles within the predicates of a single item we compute per-type-parameter predicates for resolving `T::AssocTy`.

Source

#### pub fn trait_def(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing trait definition for `tcx.def_path_str(key)`

Source

#### pub fn adt_def(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing ADT definition for `tcx.def_path_str(key)`

Source

#### pub fn adt_destructor(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing `Drop` impl for `tcx.def_path_str(key)`

Source

#### pub fn adt_async_destructor(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing `AsyncDrop` impl for `tcx.def_path_str(key)`

Source

#### pub fn adt_sizedness_constraint(self, key: (DefId, SizedTraitKind))

[query description - consider adding a doc-comment!] computing the sizedness constraint for `tcx.def_path_str(key.0)`

Source

#### pub fn adt_dtorck_constraint(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing drop-check constraints for `tcx.def_path_str(key)`

Source

#### pub fn constness(self, key: impl IntoQueryParam<DefId>)

Returns the constness of the function-like1 definition given by `DefId`.

Tuple struct/variant constructors are always const, foreign functions are never const. The rest is const iff marked with keyword `const` (or rather its parent in the case of associated functions).

Do not call this query directly. It is only meant to cache the base data for the higher-level functions. Consider using `is_const_fn` or `is_const_trait_impl` instead.

Also note that neither of them takes into account feature gates, stability and const predicates/conditions!

##### §Panics

This query will panic if the given definition is not function-like1.

1. Tuple struct/variant constructors, closures and free, associated and foreign functions. ↩ 1 2

Source

#### pub fn asyncness(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] checking if the function is async: `tcx.def_path_str(key)`

Source

#### pub fn is_promotable_const_fn(self, key: impl IntoQueryParam<DefId>)

Returns `true` if calls to the function may be promoted.

This is either because the function is e.g., a tuple-struct or tuple-variant constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should be removed in the future in favour of some form of check which figures out whether the function does not inspect the bits of any of its arguments (so is essentially just a constructor function).

Source

#### pub fn coroutine_by_move_body_def_id(self, key: impl IntoQueryParam<DefId>)

The body of the coroutine, modified to take its upvars by move rather than by ref.

This is used by coroutine-closures, which must return a different flavor of coroutine when called using `AsyncFnOnce::call_once`. It is produced by the `ByMoveBody` pass which is run right after building the initial MIR, and will only be populated for coroutines which come out of the async closure desugaring.

Source

#### pub fn coroutine_kind(self, key: impl IntoQueryParam<DefId>)

Returns `Some(coroutine_kind)` if the node pointed to by `def_id` is a coroutine.

Source

#### pub fn coroutine_for_closure(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] Given a coroutine-closure def id, return the def id of the coroutine returned by it

Source

#### pub fn coroutine_hidden_types(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] looking up the hidden types stored across await points in a coroutine

Source

#### pub fn crate_variances(self, key: ())

Gets a map with the variances of every item in the local crate.

Do not call this query directly, use `Self::variances_of` instead.

Source

#### pub fn variances_of(self, key: impl IntoQueryParam<DefId>)

Returns the (inferred) variances of the item given by `DefId`.

The list of variances corresponds to the list of (early-bound) generic parameters of the item (including its parents).

Tip: You can use `#[rustc_variance]` on an item to basically print the result of this query for use in UI tests or for debugging purposes.

Source

#### pub fn inferred_outlives_crate(self, key: ())

Gets a map with the inferred outlives-predicates of every item in the local crate.

Do not call this query directly, use `Self::inferred_outlives_of` instead.

Source

#### pub fn associated_item_def_ids(self, key: impl IntoQueryParam<DefId>)

Maps from an impl/trait or struct/variant `DefId` to a list of the `DefId`s of its associated items or fields.

Source

#### pub fn associated_item(self, key: impl IntoQueryParam<DefId>)

Maps from a trait/impl item to the trait/impl item “descriptor”.

Source

#### pub fn associated_items(self, key: impl IntoQueryParam<DefId>)

Collects the associated items defined on a trait or impl.

Source

#### pub fn impl_item_implementor_ids(self, key: impl IntoQueryParam<DefId>)

Maps from associated items on a trait to the corresponding associated item on the impl specified by `impl_id`.

For example, with the following code

    struct Type {}
                            // DefId
    trait Trait {           // trait_id
        fn f();             // trait_f
        fn g() {}           // trait_g
    }

    impl Trait for Type {   // impl_id
        fn f() {}           // impl_f
        fn g() {}           // impl_g
    }

The map returned for `tcx.impl_item_implementor_ids(impl_id)` would be `{ trait_f: impl_f, trait_g: impl_g }`

Source

#### pub fn associated_types_for_impl_traits_in_trait_or_impl( self, key: impl IntoQueryParam<DefId>, )

Given the `item_def_id` of a trait or impl, return a mapping from associated fn def id to its associated type items that correspond to the RPITITs in its signature.

Source

#### pub fn impl_trait_header(self, key: impl IntoQueryParam<DefId>)

Given an `impl_id`, return the trait it implements along with some header information.

Source

#### pub fn impl_self_is_guaranteed_unsized(self, key: impl IntoQueryParam<DefId>)

Given an `impl_def_id`, return true if the self type is guaranteed to be unsized due to either being one of the built-in unsized types (str/slice/dyn) or to be a struct whose tail is one of those types.

Source

#### pub fn inherent_impls(self, key: impl IntoQueryParam<DefId>)

Maps a `DefId` of a type to a list of its inherent impls. Contains implementations of methods that are inherent to a type. Methods in these implementations don’t need to be exported.

Source

#### pub fn incoherent_impls(self, key: SimplifiedType)

[query description - consider adding a doc-comment!] collecting all inherent impls for `{:?}`

Source

#### pub fn check_transmutes(self, key: impl IntoQueryParam<LocalDefId>)

Unsafety-check this `LocalDefId`.

Source

#### pub fn check_unsafety(self, key: impl IntoQueryParam<LocalDefId>)

Unsafety-check this `LocalDefId`.

Source

#### pub fn check_tail_calls(self, key: impl IntoQueryParam<LocalDefId>)

Checks well-formedness of tail calls (`become f()`).

Source

#### pub fn assumed_wf_types(self, key: impl IntoQueryParam<LocalDefId>)

Returns the types assumed to be well formed while “inside” of the given item.

Note that we’ve liberated the late bound regions of function signatures, so this can not be used to check whether these types are well formed.

Source

#### pub fn assumed_wf_types_for_rpitit(self, key: impl IntoQueryParam<DefId>)

We need to store the assumed_wf_types for an RPITIT so that impls of foreign traits with return-position impl trait in traits can inherit the right wf types.

Source

#### pub fn fn_sig(self, key: impl IntoQueryParam<DefId>)

Computes the signature of the function.

Source

#### pub fn lint_mod(self, key: LocalModDefId)

Performs lint checking for the module.

Source

#### pub fn check_unused_traits(self, key: ())

[query description - consider adding a doc-comment!] checking unused trait imports in crate

Source

#### pub fn check_mod_attrs(self, key: LocalModDefId)

Checks the attributes in the module.

Source

#### pub fn check_mod_unstable_api_usage(self, key: LocalModDefId)

Checks for uses of unstable APIs in the module.

Source

#### pub fn check_mod_privacy(self, key: LocalModDefId)

[query description - consider adding a doc-comment!] checking privacy in `describe_as_module(key.to_local_def_id(), tcx)`

Source

#### pub fn check_liveness(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] checking liveness of variables in `tcx.def_path_str(key.to_def_id())`

Source

#### pub fn live_symbols_and_ignored_derived_traits(self, key: ())

Return the live symbols in the crate for dead code check.

The second return value maps from ADTs to ignored derived traits (e.g. Debug and Clone).

Source

#### pub fn check_mod_deathness(self, key: LocalModDefId)

[query description - consider adding a doc-comment!] checking deathness of variables in `describe_as_module(key, tcx)`

Source

#### pub fn check_type_wf(self, key: ())

[query description - consider adding a doc-comment!] checking that types are well-formed

Source

#### pub fn coerce_unsized_info(self, key: impl IntoQueryParam<DefId>)

Caches `CoerceUnsized` kinds for impls on custom types.

Source

#### pub fn typeck(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] type-checking `tcx.def_path_str(key)`

Source

#### pub fn used_trait_imports(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] finding used_trait_imports `tcx.def_path_str(key)`

Source

#### pub fn coherent_trait(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] coherence checking all impls of trait `tcx.def_path_str(def_id)`

Source

#### pub fn mir_borrowck(self, key: impl IntoQueryParam<LocalDefId>)

Borrow-checks the given typeck root, e.g. functions, const/static items, and its children, e.g. closures, inline consts.

Source

#### pub fn crate_inherent_impls(self, key: ())

Gets a complete map from all types to their inherent impls.

Not meant to be used directly outside of coherence.

Source

#### pub fn crate_inherent_impls_validity_check(self, key: ())

Checks all types in the crate for overlap in their inherent impls. Reports errors.

Not meant to be used directly outside of coherence.

Source

#### pub fn crate_inherent_impls_overlap_check(self, key: ())

Checks all types in the crate for overlap in their inherent impls. Reports errors.

Not meant to be used directly outside of coherence.

Source

#### pub fn orphan_check_impl(self, key: impl IntoQueryParam<LocalDefId>)

Checks whether all impls in the crate pass the overlap check, returning which impls fail it. If all impls are correct, the returned slice is empty.

Source

#### pub fn mir_callgraph_cyclic(self, key: impl IntoQueryParam<LocalDefId>)

Return the set of (transitive) callees that may result in a recursive call to `key`.

Source

#### pub fn mir_inliner_callees(self, key: InstanceKind<'tcx>)

Obtain all the calls into other local functions

Source

#### pub fn tag_for_variant( self, key: PseudoCanonicalInput<'tcx, (Ty<'tcx>, VariantIdx)>, )

Computes the tag (if any) for a given type and variant.

`None` means that the variant doesn’t need a tag (because it is niched).

##### §Panics

This query will panic for uninhabited variants and if the passed type is not an enum.

Source

#### pub fn eval_to_allocation_raw( self, key: PseudoCanonicalInput<'tcx, GlobalId<'tcx>>, )

Evaluates a constant and returns the computed allocation.

Do not call this query directly, use `Self::eval_to_const_value_raw` or `Self::eval_to_valtree` instead.

Source

#### pub fn eval_static_initializer(self, key: impl IntoQueryParam<DefId>)

Evaluate a static’s initializer, returning the allocation of the initializer’s memory.

Source

#### pub fn eval_to_const_value_raw( self, key: PseudoCanonicalInput<'tcx, GlobalId<'tcx>>, )

Evaluates const items or anonymous constants1 into a representation suitable for the type system and const generics.

Do not call this directly, use one of the following wrappers: `TyCtxt::const_eval_poly`, `TyCtxt::const_eval_resolve`, `TyCtxt::const_eval_instance`, or `TyCtxt::const_eval_global_id`.

1. Such as enum variant explicit discriminants or array lengths. ↩

Source

#### pub fn eval_to_valtree(self, key: PseudoCanonicalInput<'tcx, GlobalId<'tcx>>)

Evaluate a constant and convert it to a type level constant or return `None` if that is not possible.

Source

#### pub fn valtree_to_const_val(self, key: Value<'tcx>)

Converts a type-level constant value into a MIR constant value.

Source

#### pub fn destructure_const(self, key: Const<'tcx>)

Destructures array, ADT or tuple constants into the constants of their fields.

Source

#### pub fn lit_to_const(self, key: LitToConstInput<'tcx>)

[query description - consider adding a doc-comment!] converting literal to const

Source

#### pub fn check_match(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] match-checking `tcx.def_path_str(key)`

Source

#### pub fn effective_visibilities(self, key: ())

Performs part of the privacy check and computes effective visibilities.

Source

#### pub fn check_private_in_public(self, key: LocalModDefId)

[query description - consider adding a doc-comment!] checking for private elements in public interfaces for `describe_as_module(module_def_id, tcx)`

Source

#### pub fn reachable_set(self, key: ())

[query description - consider adding a doc-comment!] reachability

Source

#### pub fn region_scope_tree(self, key: impl IntoQueryParam<DefId>)

Per-body `region::ScopeTree`. The `DefId` should be the owner `DefId` for the body; in the case of closures, this will be redirected to the enclosing function.

Source

#### pub fn mir_shims(self, key: InstanceKind<'tcx>)

Generates a MIR body for the shim.

Source

#### pub fn symbol_name(self, key: Instance<'tcx>)

The `symbol_name` query provides the symbol name for calling a given instance from the local crate. In particular, it will also look up the correct symbol name of instances from upstream crates.

Source

#### pub fn def_kind(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] looking up definition kind of `tcx.def_path_str(def_id)`

Source

#### pub fn def_span(self, key: impl IntoQueryParam<DefId>)

Gets the span for the definition.

Source

#### pub fn def_ident_span(self, key: impl IntoQueryParam<DefId>)

Gets the span for the identifier of the definition.

Source

#### pub fn ty_span(self, key: impl IntoQueryParam<LocalDefId>)

Gets the span for the type of the definition. Panics if it is not a definition that has a single type.

Source

#### pub fn lookup_stability(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] looking up stability of `tcx.def_path_str(def_id)`

Source

#### pub fn lookup_const_stability(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] looking up const stability of `tcx.def_path_str(def_id)`

Source

#### pub fn lookup_default_body_stability(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] looking up default body stability of `tcx.def_path_str(def_id)`

Source

#### pub fn should_inherit_track_caller(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing should_inherit_track_caller of `tcx.def_path_str(def_id)`

Source

#### pub fn inherited_align(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing inherited_align of `tcx.def_path_str(def_id)`

Source

#### pub fn lookup_deprecation_entry(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] checking whether `tcx.def_path_str(def_id)` is deprecated

Source

#### pub fn is_doc_hidden(self, key: impl IntoQueryParam<DefId>)

Determines whether an item is annotated with `#[doc(hidden)]`.

Source

#### pub fn is_doc_notable_trait(self, key: impl IntoQueryParam<DefId>)

Determines whether an item is annotated with `#[doc(notable_trait)]`.

Source

#### pub fn attrs_for_def(self, key: impl IntoQueryParam<DefId>)

Returns the attributes on the item at `def_id`.

Do not use this directly, use `tcx.get_attrs` instead.

Source

#### pub fn codegen_fn_attrs(self, key: impl IntoQueryParam<DefId>)

Returns the `CodegenFnAttrs` for the item at `def_id`.

If possible, use `tcx.codegen_instance_attrs` instead. That function takes the instance kind into account.

For example, the `#[naked]` attribute should be applied for `InstanceKind::Item`, but should not be applied if the instance kind is `InstanceKind::ReifyShim`. Using this query would include the attribute regardless of the actual instance kind at the call site.

Source

#### pub fn asm_target_features(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing target features for inline asm of `tcx.def_path_str(def_id)`

Source

#### pub fn fn_arg_idents(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] looking up function parameter identifiers for `tcx.def_path_str(def_id)`

Source

#### pub fn rendered_const(self, key: impl IntoQueryParam<DefId>)

Gets the rendered value of the specified constant or associated constant. Used by rustdoc.

Source

#### pub fn rendered_precise_capturing_args(self, key: impl IntoQueryParam<DefId>)

Gets the rendered precise capturing args for an opaque for use in rustdoc.

Source

#### pub fn impl_parent(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing specialization parent impl of `tcx.def_path_str(def_id)`

Source

#### pub fn is_ctfe_mir_available(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] checking if item has CTFE MIR available: `tcx.def_path_str(key)`

Source

#### pub fn is_mir_available(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] checking if item has MIR available: `tcx.def_path_str(key)`

Source

#### pub fn own_existential_vtable_entries(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] finding all existential vtable entries for trait `tcx.def_path_str(key)`

Source

#### pub fn vtable_entries(self, key: TraitRef<'tcx>)

[query description - consider adding a doc-comment!] finding all vtable entries for trait `tcx.def_path_str(key.def_id)`

Source

#### pub fn first_method_vtable_slot(self, key: TraitRef<'tcx>)

[query description - consider adding a doc-comment!] finding the slot within the vtable of `key.self_ty()` for the implementation of `key.print_only_trait_name()`

Source

#### pub fn supertrait_vtable_slot(self, key: (Ty<'tcx>, Ty<'tcx>))

[query description - consider adding a doc-comment!] finding the slot within vtable for trait object `key.1` vtable ptr during trait upcasting coercion from `key.0` vtable

Source

#### pub fn vtable_allocation( self, key: (Ty<'tcx>, Option<ExistentialTraitRef<'tcx>>), )

[query description - consider adding a doc-comment!] vtable const allocation for < `key.0` as `key.1.map(| trait_ref | format! ("{trait_ref}")).unwrap_or_else(| | "_".to_owned())` >

Source

#### pub fn codegen_select_candidate( self, key: PseudoCanonicalInput<'tcx, TraitRef<'tcx>>, )

[query description - consider adding a doc-comment!] computing candidate for `key.value`

Source

#### pub fn all_local_trait_impls(self, key: ())

Return all `impl` blocks in the current crate.

Source

#### pub fn local_trait_impls(self, key: impl IntoQueryParam<DefId>)

Return all `impl` blocks of the given trait in the current crate.

Source

#### pub fn trait_impls_of(self, key: impl IntoQueryParam<DefId>)

Given a trait `trait_id`, return all known `impl` blocks.

Source

#### pub fn specialization_graph_of(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] building specialization graph of trait `tcx.def_path_str(trait_id)`

Source

#### pub fn dyn_compatibility_violations(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] determining dyn-compatibility of trait `tcx.def_path_str(trait_id)`

Source

#### pub fn is_dyn_compatible(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] checking if trait `tcx.def_path_str(trait_id)` is dyn-compatible

Source

#### pub fn param_env(self, key: impl IntoQueryParam<DefId>)

Gets the ParameterEnvironment for a given item; this environment will be in “user-facing” mode, meaning that it is suitable for type-checking etc, and it does not normalize specializable associated types.

You should almost certainly not use this. If you already have an InferCtxt, then you should also probably have a `ParamEnv` from when it was built. If you don’t, then you should take a `TypingEnv` to ensure that you handle opaque types correctly.

Source

#### pub fn typing_env_normalized_for_post_analysis( self, key: impl IntoQueryParam<DefId>, )

Like `param_env`, but returns the `ParamEnv` after all opaque types have been replaced with their hidden type. This is used in the old trait solver when in `PostAnalysis` mode and should not be called directly.

Source

#### pub fn is_copy_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Trait selection queries. These are best used by invoking `ty.is_copy_modulo_regions()`, `ty.is_copy()`, etc, since that will prune the environment where possible.

Source

#### pub fn is_use_cloned_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Trait selection queries. These are best used by invoking `ty.is_use_cloned_modulo_regions()`, `ty.is_use_cloned()`, etc, since that will prune the environment where possible.

Source

#### pub fn is_sized_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Query backing `Ty::is_sized`.

Source

#### pub fn is_freeze_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Query backing `Ty::is_freeze`.

Source

#### pub fn is_unpin_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Query backing `Ty::is_unpin`.

Source

#### pub fn is_async_drop_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Query backing `Ty::is_async_drop`.

Source

#### pub fn needs_drop_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Query backing `Ty::needs_drop`.

Source

#### pub fn needs_async_drop_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Query backing `Ty::needs_async_drop`.

Source

#### pub fn has_significant_drop_raw(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Query backing `Ty::has_significant_drop_raw`.

Source

#### pub fn has_structural_eq_impl(self, key: Ty<'tcx>)

Query backing `Ty::is_structural_eq_shallow`.

This is only correct for ADTs. Call `is_structural_eq_shallow` to handle all types correctly.

Source

#### pub fn adt_drop_tys(self, key: impl IntoQueryParam<DefId>)

A list of types where the ADT requires drop if and only if any of those types require drop. If the ADT is known to always need drop then `Err(AlwaysRequiresDrop)` is returned.

Source

#### pub fn adt_async_drop_tys(self, key: impl IntoQueryParam<DefId>)

A list of types where the ADT requires async drop if and only if any of those types require async drop. If the ADT is known to always need async drop then `Err(AlwaysRequiresDrop)` is returned.

Source

#### pub fn adt_significant_drop_tys(self, key: impl IntoQueryParam<DefId>)

A list of types where the ADT requires drop if and only if any of those types has significant drop. A type marked with the attribute `rustc_insignificant_dtor` is considered to not be significant. A drop is significant if it is implemented by the user or does anything that will have any observable behavior (other than freeing up memory). If the ADT is known to have a significant destructor then `Err(AlwaysRequiresDrop)` is returned.

Source

#### pub fn list_significant_drop_tys( self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>, )

Returns a list of types which (a) have a potentially significant destructor and (b) may be dropped as a result of dropping a value of some type `ty` (in the given environment).

The idea of “significant” drop is somewhat informal and is used only for diagnostics and edition migrations. The idea is that a significant drop may have some visible side-effect on execution; freeing memory is NOT considered a side-effect. The rules are as follows:

- Type with no explicit drop impl do not have significant drop.
- Types with a drop impl are assumed to have significant drop unless they have a `#[rustc_insignificant_dtor]` annotation.

Note that insignificant drop is a “shallow” property. A type like `Vec<LockGuard>` does not have significant drop but the type `LockGuard` does, and so if `ty = Vec<LockGuard>` then the return value would be `&[LockGuard]`. IMPORTANT: DO NOT run this query before promoted MIR body is constructed, because this query partially depends on that query. Otherwise, there is a risk of query cycles.

Source

#### pub fn layout_of(self, key: PseudoCanonicalInput<'tcx, Ty<'tcx>>)

Computes the layout of a type. Note that this implicitly executes in `TypingMode::PostAnalysis`, and will normalize the input type.

Source

#### pub fn fn_abi_of_fn_ptr( self, key: PseudoCanonicalInput<'tcx, (PolyFnSig<'tcx>, &'tcx List<Ty<'tcx>>)>, )

Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.

NB: this doesn’t handle virtual calls - those should use `fn_abi_of_instance` instead, where the instance is an `InstanceKind::Virtual`.

Source

#### pub fn fn_abi_of_instance( self, key: PseudoCanonicalInput<'tcx, (Instance<'tcx>, &'tcx List<Ty<'tcx>>)>, )

Compute a `FnAbi` suitable for declaring/defining an `fn` instance, and for direct calls to an `fn`.

NB: that includes virtual calls, which are represented by “direct calls” to an `InstanceKind::Virtual` instance (of `<dyn Trait as Trait>::fn`).

Source

#### pub fn dylib_dependency_formats(self, key: CrateNum)

[query description - consider adding a doc-comment!] getting dylib dependency formats of crate

Source

#### pub fn dependency_formats(self, key: ())

[query description - consider adding a doc-comment!] getting the linkage format of all dependencies

Source

#### pub fn is_compiler_builtins(self, key: CrateNum)

[query description - consider adding a doc-comment!] checking if the crate is_compiler_builtins

Source

#### pub fn has_global_allocator(self, key: CrateNum)

[query description - consider adding a doc-comment!] checking if the crate has_global_allocator

Source

#### pub fn has_alloc_error_handler(self, key: CrateNum)

[query description - consider adding a doc-comment!] checking if the crate has_alloc_error_handler

Source

#### pub fn has_panic_handler(self, key: CrateNum)

[query description - consider adding a doc-comment!] checking if the crate has_panic_handler

Source

#### pub fn is_profiler_runtime(self, key: CrateNum)

[query description - consider adding a doc-comment!] checking if a crate is `#![profiler_runtime]`

Source

#### pub fn has_ffi_unwind_calls(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] checking if `tcx.def_path_str(key)` contains FFI-unwind calls

Source

#### pub fn required_panic_strategy(self, key: CrateNum)

[query description - consider adding a doc-comment!] getting a crate’s required panic strategy

Source

#### pub fn panic_in_drop_strategy(self, key: CrateNum)

[query description - consider adding a doc-comment!] getting a crate’s configured panic-in-drop strategy

Source

#### pub fn is_no_builtins(self, key: CrateNum)

[query description - consider adding a doc-comment!] getting whether a crate has `#![no_builtins]`

Source

#### pub fn symbol_mangling_version(self, key: CrateNum)

[query description - consider adding a doc-comment!] getting a crate’s symbol mangling version

Source

#### pub fn extern_crate(self, key: CrateNum)

[query description - consider adding a doc-comment!] getting crate’s ExternCrateData

Source

#### pub fn specialization_enabled_in(self, key: CrateNum)

[query description - consider adding a doc-comment!] checking whether the crate enabled `specialization`/`min_specialization`

Source

#### pub fn specializes(self, key: (DefId, DefId))

[query description - consider adding a doc-comment!] computing whether impls specialize one another

Source

#### pub fn in_scope_traits_map(self, key: OwnerId)

[query description - consider adding a doc-comment!] getting traits in scope at a block

Source

#### pub fn defaultness(self, key: impl IntoQueryParam<DefId>)

Returns whether the impl or associated function has the `default` keyword. Note: This will ICE on inherent impl items. Consider using `AssocItem::defaultness`.

Source

#### pub fn default_field(self, key: impl IntoQueryParam<DefId>)

Returns whether the field corresponding to the `DefId` has a default field value.

Source

#### pub fn check_well_formed(self, key: impl IntoQueryParam<LocalDefId>)

[query description - consider adding a doc-comment!] checking that `tcx.def_path_str(key)` is well-formed

Source

#### pub fn enforce_impl_non_lifetime_params_are_constrained( self, key: impl IntoQueryParam<LocalDefId>, )

[query description - consider adding a doc-comment!] checking that `tcx.def_path_str(key)` ’s generics are constrained by the impl header

Source

#### pub fn reachable_non_generics(self, key: CrateNum)

[query description - consider adding a doc-comment!] looking up the exported symbols of a crate

Source

#### pub fn is_reachable_non_generic(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] checking whether `tcx.def_path_str(def_id)` is an exported symbol

Source

#### pub fn is_unreachable_local_definition( self, key: impl IntoQueryParam<LocalDefId>, )

[query description - consider adding a doc-comment!] checking whether `tcx.def_path_str(def_id)` is reachable from outside the crate

Source

#### pub fn upstream_monomorphizations(self, key: ())

The entire set of monomorphizations the local crate can safely link to because they are exported from upstream crates. Do not depend on this directly, as its value changes anytime a monomorphization gets added or removed in any upstream crate. Instead use the narrower `upstream_monomorphizations_for`, `upstream_drop_glue_for`, `upstream_async_drop_glue_for`, or, even better, `Instance::upstream_monomorphization()`.

Source

#### pub fn upstream_monomorphizations_for(self, key: impl IntoQueryParam<DefId>)

Returns the set of upstream monomorphizations available for the generic function identified by the given `def_id`. The query makes sure to make a stable selection if the same monomorphization is available in multiple upstream crates.

You likely want to call `Instance::upstream_monomorphization()` instead of invoking this query directly.

Source

#### pub fn upstream_drop_glue_for(self, key: GenericArgsRef<'tcx>)

Returns the upstream crate that exports drop-glue for the given type (`args` is expected to be a single-item list containing the type one wants drop-glue for).

This is a subset of `upstream_monomorphizations_for` in order to increase dep-tracking granularity. Otherwise adding or removing any type with drop-glue in any upstream crate would invalidate all functions calling drop-glue of an upstream type.

You likely want to call `Instance::upstream_monomorphization()` instead of invoking this query directly.

NOTE: This query could easily be extended to also support other common functions that have are large set of monomorphizations (like `Clone::clone` for example).

Source

#### pub fn upstream_async_drop_glue_for(self, key: GenericArgsRef<'tcx>)

Returns the upstream crate that exports async-drop-glue for the given type (`args` is expected to be a single-item list containing the type one wants async-drop-glue for).

This is a subset of `upstream_monomorphizations_for` in order to increase dep-tracking granularity. Otherwise adding or removing any type with async-drop-glue in any upstream crate would invalidate all functions calling async-drop-glue of an upstream type.

You likely want to call `Instance::upstream_monomorphization()` instead of invoking this query directly.

NOTE: This query could easily be extended to also support other common functions that have are large set of monomorphizations (like `Clone::clone` for example).

Source

#### pub fn foreign_modules(self, key: CrateNum)

Returns a list of all `extern` blocks of a crate.

Source

#### pub fn clashing_extern_declarations(self, key: ())

Lint against `extern fn` declarations having incompatible types.

Source

#### pub fn entry_fn(self, key: ())

Identifies the entry-point (e.g., the `main` function) for a given crate, returning `None` if there is no entry point (such as for library crates).

Source

#### pub fn proc_macro_decls_static(self, key: ())

Finds the `rustc_proc_macro_decls` item of a crate.

Source

#### pub fn crate_hash(self, key: CrateNum)

[query description - consider adding a doc-comment!] looking up the hash a crate

Source

#### pub fn crate_host_hash(self, key: CrateNum)

Gets the hash for the host proc macro. Used to support -Z dual-proc-macro.

Source

#### pub fn extra_filename(self, key: CrateNum)

Gets the extra data to put in each output filename for a crate. For example, compiling the `foo` crate with `extra-filename=-a` creates a `libfoo-b.rlib` file.

Source

#### pub fn crate_extern_paths(self, key: CrateNum)

Gets the paths where the crate came from in the file system.

Source

#### pub fn implementations_of_trait(self, key: (CrateNum, DefId))

Given a crate and a trait, look up all impls of that trait in the crate. Return `(impl_id, self_ty)`.

Source

#### pub fn crate_incoherent_impls(self, key: (CrateNum, SimplifiedType))

Collects all incoherent impls for the given crate and type.

Do not call this directly, but instead use the `incoherent_impls` query. This query is only used to get the data necessary for that query.

Source

#### pub fn native_library(self, key: impl IntoQueryParam<DefId>)

Get the corresponding native library from the `native_libraries` query

Source

#### pub fn inherit_sig_for_delegation_item( self, key: impl IntoQueryParam<LocalDefId>, )

[query description - consider adding a doc-comment!] inheriting delegation signature

Source

#### pub fn resolve_bound_vars(self, key: OwnerId)

Does lifetime resolution on items. Importantly, we can’t resolve lifetimes directly on things like trait methods, because of trait params. See `rustc_resolve::late::lifetimes` for details.

Source

#### pub fn named_variable_map(self, key: OwnerId)

[query description - consider adding a doc-comment!] looking up a named region inside `tcx.def_path_str(owner_id)`

Source

#### pub fn is_late_bound_map(self, key: OwnerId)

[query description - consider adding a doc-comment!] testing if a region is late bound inside `tcx.def_path_str(owner_id)`

Source

#### pub fn object_lifetime_default(self, key: impl IntoQueryParam<DefId>)

Returns the default lifetime to be used if a trait object type were to be passed for the type parameter given by `DefId`.

Tip: You can use `#[rustc_object_lifetime_default]` on an item to basically print the result of this query for use in UI tests or for debugging purposes.

##### §Examples

- For `T` in `struct Foo<'a, T: 'a>(&'a T);`, this would be `Param('a)`
- For `T` in `struct Bar<'a, T>(&'a T);`, this would be `Empty`

##### §Panics

This query will panic if the given definition is not a type parameter.

Source

#### pub fn late_bound_vars_map(self, key: OwnerId)

[query description - consider adding a doc-comment!] looking up late bound vars inside `tcx.def_path_str(owner_id)`

Source

#### pub fn opaque_captured_lifetimes(self, key: impl IntoQueryParam<LocalDefId>)

For an opaque type, return the list of (captured lifetime, inner generic param).

ⓘ

    fn foo<'a: 'a, 'b, T>(&'b u8) -> impl Into<Self> + 'b { ... }

We would return `[('a, '_a), ('b, '_b)]`, with `'a` early-bound and `'b` late-bound.

After hir_ty_lowering, we get:

ⓘ

    opaque foo::<'a>::opaque<'_a, '_b>: Into<Foo<'_a>> + '_b;
                             ^^^^^^^^ inner generic params
    fn foo<'a>: for<'b> fn(&'b u8) -> foo::<'a>::opaque::<'a, 'b>
                                                          ^^^^^^ captured lifetimes

Source

#### pub fn visibility(self, key: impl IntoQueryParam<DefId>)

Computes the visibility of the provided `def_id`.

If the item from the `def_id` doesn’t have a visibility, it will panic. For example a generic type parameter will panic if you call this method on it:

    use std::fmt::Debug;

    pub trait Foo<T: Debug> {}

In here, if you call `visibility` on `T`, it’ll panic.

Source

#### pub fn inhabited_predicate_adt(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] computing the uninhabited predicate of `{:?}`

Source

#### pub fn inhabited_predicate_type(self, key: Ty<'tcx>)

Do not call this query directly: invoke `Ty::inhabited_predicate` instead.

Source

#### pub fn dep_kind(self, key: CrateNum)

[query description - consider adding a doc-comment!] fetching what a dependency looks like

Source

#### pub fn crate_name(self, key: CrateNum)

Gets the name of the crate.

Source

#### pub fn module_children(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] collecting child items of module `tcx.def_path_str(def_id)`

Source

#### pub fn num_extern_def_ids(self, key: CrateNum)

Gets the number of definitions in a foreign crate.

This allows external tools to iterate over all definitions in a foreign crate.

This should never be used for the local crate, instead use `iter_local_def_id`.

Source

#### pub fn lib_features(self, key: CrateNum)

[query description - consider adding a doc-comment!] calculating the lib features defined in a crate

Source

#### pub fn stability_implications(self, key: CrateNum)

Mapping from feature name to feature name based on the `implied_by` field of `#[unstable]` attributes. If a `#[unstable(feature = "implier", implied_by = "impliee")]` attribute exists, then this map will have a `impliee -> implier` entry.

This mapping is necessary unless both the `#[stable]` and `#[unstable]` attributes should specify their implications (both `implies` and `implied_by`). If only one of the two attributes do (as in the current implementation, `implied_by` in `#[unstable]`), then this mapping is necessary for diagnostics. When a “unnecessary feature attribute” error is reported, only the `#[stable]` attribute information is available, so the map is necessary to know that the feature implies another feature. If it were reversed, and the `#[stable]` attribute had an `implies` meta item, then a map would be necessary when avoiding a “use of unstable feature” error for a feature that was implied.

Source

#### pub fn intrinsic_raw(self, key: impl IntoQueryParam<DefId>)

Whether the function is an intrinsic

Source

#### pub fn get_lang_items(self, key: ())

Returns the lang items defined in another crate by loading it from metadata.

Source

#### pub fn all_diagnostic_items(self, key: ())

Returns all diagnostic items defined in all crates.

Source

#### pub fn defined_lang_items(self, key: CrateNum)

Returns the lang items defined in another crate by loading it from metadata.

Source

#### pub fn diagnostic_items(self, key: CrateNum)

Returns the diagnostic items defined in a crate.

Source

#### pub fn missing_lang_items(self, key: CrateNum)

[query description - consider adding a doc-comment!] calculating the missing lang items in a crate

Source

#### pub fn visible_parent_map(self, key: ())

The visible parent map is a map from every item to a visible parent. It prefers the shortest visible path to an item. Used for diagnostics, for example path trimming. The parents are modules, enums or traits.

Source

#### pub fn trimmed_def_paths(self, key: ())

Collects the “trimmed”, shortest accessible paths to all items for diagnostics. See the provider docs for more info.

Source

#### pub fn missing_extern_crate_item(self, key: CrateNum)

[query description - consider adding a doc-comment!] seeing if we’re missing an `extern crate` item for this crate

Source

#### pub fn used_crate_source(self, key: CrateNum)

[query description - consider adding a doc-comment!] looking at the source for a crate

Source

#### pub fn debugger_visualizers(self, key: CrateNum)

Returns the debugger visualizers defined for this crate. NOTE: This query has to be marked `eval_always` because it reads data directly from disk that is not tracked anywhere else. I.e. it represents a genuine input to the query system.

Source

#### pub fn postorder_cnums(self, key: ())

[query description - consider adding a doc-comment!] generating a postorder list of CrateNums

Source

#### pub fn is_private_dep(self, key: CrateNum)

Returns whether or not the crate with CrateNum ‘cnum’ is marked as a private dependency

Source

#### pub fn allocator_kind(self, key: ())

[query description - consider adding a doc-comment!] getting the allocator kind for the current crate

Source

#### pub fn alloc_error_handler_kind(self, key: ())

[query description - consider adding a doc-comment!] alloc error handler kind for the current crate

Source

#### pub fn upvars_mentioned(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] collecting upvars mentioned in `tcx.def_path_str(def_id)`

Source

#### pub fn crates(self, key: ())

All available crates in the graph, including those that should not be user-facing (such as private crates).

Source

#### pub fn used_crates(self, key: ())

[query description - consider adding a doc-comment!] fetching `CrateNum`s for all crates loaded non-speculatively

Source

#### pub fn traits(self, key: CrateNum)

A list of all traits in a crate, used by rustdoc and error reporting.

Source

#### pub fn trait_impls_in_crate(self, key: CrateNum)

[query description - consider adding a doc-comment!] fetching all trait impls in a crate

Source

#### pub fn stable_order_of_exportable_impls(self, key: CrateNum)

[query description - consider adding a doc-comment!] fetching the stable impl’s order

Source

#### pub fn exportable_items(self, key: CrateNum)

[query description - consider adding a doc-comment!] fetching all exportable items in a crate

Source

#### pub fn exported_non_generic_symbols(self, key: CrateNum)

The list of non-generic symbols exported from the given crate.

This is separate from exported_generic_symbols to avoid having to deserialize all non-generic symbols too for upstream crates in the upstream_monomorphizations query.

- All names contained in `exported_non_generic_symbols(cnum)` are guaranteed to correspond to a publicly visible symbol in `cnum` machine code.
- The `exported_non_generic_symbols` and `exported_generic_symbols` sets of different crates do not intersect.

Source

#### pub fn exported_generic_symbols(self, key: CrateNum)

The list of generic symbols exported from the given crate.

- All names contained in `exported_generic_symbols(cnum)` are guaranteed to correspond to a publicly visible symbol in `cnum` machine code.
- The `exported_non_generic_symbols` and `exported_generic_symbols` sets of different crates do not intersect.

Source

#### pub fn collect_and_partition_mono_items(self, key: ())

[query description - consider adding a doc-comment!] collect_and_partition_mono_items

Source

#### pub fn is_codegened_item(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] determining whether `tcx.def_path_str(def_id)` needs codegen

Source

#### pub fn codegen_unit(self, key: Symbol)

[query description - consider adding a doc-comment!] getting codegen unit `{sym}`

Source

#### pub fn backend_optimization_level(self, key: ())

[query description - consider adding a doc-comment!] optimization level used by backend

Source

#### pub fn output_filenames(self, key: ())

Return the filenames where output artefacts shall be stored.

This query returns an `&Arc` because codegen backends need the value even after the `TyCtxt` has been destroyed.

Source

#### pub fn normalize_canonicalized_projection_ty( self, key: CanonicalAliasGoal<'tcx>, )

Do not call this query directly: Invoke `normalize` instead.

Source

#### pub fn normalize_canonicalized_free_alias(self, key: CanonicalAliasGoal<'tcx>)

Do not call this query directly: Invoke `normalize` instead.

Source

#### pub fn normalize_canonicalized_inherent_projection_ty( self, key: CanonicalAliasGoal<'tcx>, )

Do not call this query directly: Invoke `normalize` instead.

Source

#### pub fn try_normalize_generic_arg_after_erasing_regions( self, key: PseudoCanonicalInput<'tcx, GenericArg<'tcx>>, )

Do not call this query directly: invoke `try_normalize_erasing_regions` instead.

Source

#### pub fn implied_outlives_bounds( self, key: (CanonicalImpliedOutlivesBoundsGoal<'tcx>, bool), )

[query description - consider adding a doc-comment!] computing implied outlives bounds for `key.0.canonical.value.value.ty` (hack disabled = {:?})

Source

#### pub fn dropck_outlives(self, key: CanonicalDropckOutlivesGoal<'tcx>)

Do not call this query directly: invoke `DropckOutlives::new(dropped_ty)).fully_perform(typeck.infcx)` instead.

Source

#### pub fn evaluate_obligation(self, key: CanonicalPredicateGoal<'tcx>)

Do not call this query directly: invoke `infcx.predicate_may_hold()` or `infcx.predicate_must_hold()` instead.

Source

#### pub fn type_op_ascribe_user_type( self, key: CanonicalTypeOpAscribeUserTypeGoal<'tcx>, )

Do not call this query directly: part of the `Eq` type-op

Source

#### pub fn type_op_prove_predicate( self, key: CanonicalTypeOpProvePredicateGoal<'tcx>, )

Do not call this query directly: part of the `ProvePredicate` type-op

Source

#### pub fn type_op_normalize_ty( self, key: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>, )

Do not call this query directly: part of the `Normalize` type-op

Source

#### pub fn type_op_normalize_clause( self, key: CanonicalTypeOpNormalizeGoal<'tcx, Clause<'tcx>>, )

Do not call this query directly: part of the `Normalize` type-op

Source

#### pub fn type_op_normalize_poly_fn_sig( self, key: CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>, )

Do not call this query directly: part of the `Normalize` type-op

Source

#### pub fn type_op_normalize_fn_sig( self, key: CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>, )

Do not call this query directly: part of the `Normalize` type-op

Source

#### pub fn instantiate_and_check_impossible_predicates( self, key: (DefId, GenericArgsRef<'tcx>), )

[query description - consider adding a doc-comment!] checking impossible instantiated predicates: `tcx.def_path_str(key.0)`

Source

#### pub fn is_impossible_associated_item(self, key: (DefId, DefId))

[query description - consider adding a doc-comment!] checking if `tcx.def_path_str(key.1)` is impossible to reference within `tcx.def_path_str(key.0)`

Source

#### pub fn method_autoderef_steps( self, key: CanonicalMethodAutoderefStepsGoal<'tcx>, )

[query description - consider adding a doc-comment!] computing autoderef types for `goal.canonical.value.value.self_ty`

Source

#### pub fn evaluate_root_goal_for_proof_tree_raw(self, key: CanonicalInput<'tcx>)

Used by `-Znext-solver` to compute proof trees.

Source

#### pub fn rust_target_features(self, key: CrateNum)

Returns the Rust target features for the current target. These are not always the same as LLVM target features!

Source

#### pub fn implied_target_features(self, key: Symbol)

[query description - consider adding a doc-comment!] looking up implied target features

Source

#### pub fn features_query(self, key: ())

[query description - consider adding a doc-comment!] looking up enabled feature gates

Source

#### pub fn crate_for_resolver(self, key: ())

[query description - consider adding a doc-comment!] the ast before macro expansion and name resolution

Source

#### pub fn resolve_instance_raw( self, key: PseudoCanonicalInput<'tcx, (DefId, GenericArgsRef<'tcx>)>, )

Attempt to resolve the given `DefId` to an `Instance`, for the given generics args (`GenericArgsRef`), returning one of:

- `Ok(Some(instance))` on success
- `Ok(None)` when the `GenericArgsRef` are still too generic, and therefore don’t allow finding the final `Instance`
- `Err(ErrorGuaranteed)` when the `Instance` resolution process couldn’t complete due to errors elsewhere - this is distinct from `Ok(None)` to avoid misleading diagnostics when an error has already been/will be emitted, for the original cause.

Source

#### pub fn reveal_opaque_types_in_bounds(self, key: Clauses<'tcx>)

[query description - consider adding a doc-comment!] revealing opaque types in `{:?}`

Source

#### pub fn limits(self, key: ())

[query description - consider adding a doc-comment!] looking up limits

Source

#### pub fn diagnostic_hir_wf_check(self, key: (Predicate<'tcx>, WellFormedLoc))

Performs an HIR-based well-formed check on the item with the given `HirId`. If we get an `Unimplemented` error that matches the provided `Predicate`, return the cause of the newly created obligation.

This is only used by error-reporting code to get a better cause (in particular, a better span) for an existing error. Therefore, it is best-effort, and may never handle all of the cases that the normal `ty::Ty`-based wfcheck does. This is fine, because the `ty::Ty`-based wfcheck is always run.

Source

#### pub fn global_backend_features(self, key: ())

The list of backend features computed from CLI flags (`-Ctarget-cpu`, `-Ctarget-feature`, `--target` and similar).

Source

#### pub fn check_validity_requirement( self, key: (ValidityRequirement, PseudoCanonicalInput<'tcx, Ty<'tcx>>), )

[query description - consider adding a doc-comment!] checking validity requirement for `key.1.value` : `key.0`

Source

#### pub fn compare_impl_item(self, key: impl IntoQueryParam<LocalDefId>)

This takes the def-id of an associated item from a impl of a trait, and checks its validity against the trait item it corresponds to.

Any other def id will ICE.

Source

#### pub fn deduced_param_attrs(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] deducing parameter attributes for `tcx.def_path_str(def_id)`

Source

#### pub fn doc_link_resolutions(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] resolutions for documentation links for a module

Source

#### pub fn doc_link_traits_in_scope(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] traits in scope for documentation links for a module

Source

#### pub fn stripped_cfg_items(self, key: CrateNum)

Get all item paths that were stripped by a `#[cfg]` in a particular crate. Should not be called for the local crate before the resolver outputs are created, as it is only fed there.

Source

#### pub fn generics_require_sized_self(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] check whether the item has a `where Self: Sized` bound

Source

#### pub fn cross_crate_inlinable(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] whether the item should be made inlinable across crates

Source

#### pub fn check_mono_item(self, key: Instance<'tcx>)

Perform monomorphization-time checking on this item. This is used for lints/errors that can only be checked once the instance is fully monomorphized.

Source

#### pub fn skip_move_check_fns(self, key: ())

Builds the set of functions that should be skipped for the move-size check.

Source

#### pub fn items_of_instance(self, key: (Instance<'tcx>, CollectionMode))

[query description - consider adding a doc-comment!] collecting items used by `key.0`

Source

#### pub fn size_estimate(self, key: Instance<'tcx>)

[query description - consider adding a doc-comment!] estimating codegen size of `key`

Source

#### pub fn anon_const_kind(self, key: impl IntoQueryParam<DefId>)

[query description - consider adding a doc-comment!] looking up anon const kind of `tcx.def_path_str(def_id)`

Source

#### pub fn disabled_sanitizers_for(self, key: impl IntoQueryParam<LocalDefId>)

Checks for the nearest `#[sanitize(xyz = "off")]` or `#[sanitize(xyz = "on")]` on this def and any enclosing defs, up to the crate root.

Returns the set of sanitizers that is explicitly disabled for this def.

## Trait Implementations§

Source§

### impl<'tcx> Clone for TyCtxtEnsureDone<'tcx>

Source§

#### fn clone(&self) -> TyCtxtEnsureDone<'tcx>

Returns a duplicate 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<'tcx> Copy for TyCtxtEnsureDone<'tcx>

## Auto Trait Implementations§

§

### impl<'tcx> DynSend for TyCtxtEnsureDone<'tcx>

§

### impl<'tcx> DynSync for TyCtxtEnsureDone<'tcx>

§

### impl<'tcx> Freeze for TyCtxtEnsureDone<'tcx>

§

### impl<'tcx> !RefUnwindSafe for TyCtxtEnsureDone<'tcx>

§

### impl<'tcx> !Send for TyCtxtEnsureDone<'tcx>

§

### impl<'tcx> !Sync for TyCtxtEnsureDone<'tcx>

§

### impl<'tcx> Unpin for TyCtxtEnsureDone<'tcx>

§

### impl<'tcx> !UnwindSafe for TyCtxtEnsureDone<'tcx>

## Blanket Implementations§

Source§

### impl<T> Aligned for T

Source§

#### const ALIGN: Alignment

Alignment of `Self`.
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<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T
where T: Copy,

Source§

#### fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T

Source§

#### fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]

Source§

### impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T
where T: Copy,

Source§

#### fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T

Source§

#### fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]

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, dest: *mut u8)

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

### impl<T, R> CollectAndApply<T, R> for T

Source§

#### fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to `f(&iter.collect::<Vec<_>>())`.

Source§

#### type Output = R

Source§

### impl<T> DynClone for T
where T: Clone,

Source§

#### fn __clone_box(&self, _: Private) -> *mut ()

Source§

### impl<T> From<T> for T

Source§

#### fn from(t: T) -> T

Returns the argument unchanged.

Source§

### impl<T> Instrument for T

Source§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more
Source§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
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§

#### fn into_query_param(self) -> P

Source§

### impl<T> MaybeResult<T> for T

Source§

#### type Error = !

Source§

#### fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

Source§

#### fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

Source§

### impl<T> Pointable for T

Source§

#### const ALIGN: usize

The alignment of pointer.
Source§

#### type Init = T

The type for initializers.
Source§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

### impl<T> Same for T

Source§

#### type Output = T

Should always be `Self`
Source§

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

Source§

#### 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>,

Source§

#### 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>,

Source§

#### 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.
Source§

### impl<I, T, U> Upcast<I, U> for T
where U: UpcastFrom<I, T>,

Source§

#### fn upcast(self, interner: I) -> U

Source§

### impl<I, T> UpcastFrom<I, T> for T

Source§

#### fn upcast_from(from: T, _tcx: I) -> T

Source§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

#### fn vzip(self) -> V

Source§

### impl<Tcx, T> Value<Tcx> for T
where Tcx: DepContext,

Source§

#### default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T

Source§

### impl<T> WithSubscriber for T

Source§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more
Source§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more
Source§

### impl<T> ErasedDestructor for T
where T: 'static,

## Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain `repr(...)` attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 8 bytes