[−][src]Struct rustc::infer::InferCtxt
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Fields
tcx: TyCtxt<'a, 'gcx, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
in_progress_tables: Option<&'a RefCell<TypeckTables<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
During type-checking/inference of a body, in_progress_tables
contains a reference to the tables being built up, which are
used for reading closure kinds/signatures as they are inferred,
and for error reporting logic to read arbitrary node types.
projection_cache: RefCell<ProjectionCache<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
type_variables: RefCell<TypeVariableTable<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
int_unification_table: RefCell<UnificationTable<InPlace<IntVid>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
float_unification_table: RefCell<UnificationTable<InPlace<FloatVid>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
region_constraints: RefCell<Option<RegionConstraintCollector<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
lexical_region_resolutions: RefCell<Option<LexicalRegionResolutions<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
selection_cache: SelectionCache<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Caches the results of trait selection. This cache is used for things that have to do with the parameters in scope.
evaluation_cache: EvaluationCache<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Caches the results of trait evaluation.
reported_trait_errors: RefCell<FxHashMap<Span, Vec<Predicate<'tcx>>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
tainted_by_errors_flag: Cell<bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
err_count_on_creation: usize
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
in_snapshot: Cell<bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
region_obligations: RefCell<Vec<(NodeId, RegionObligation<'tcx>)>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
universe: Cell<UniverseIndex>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
What is the innermost universe we have created? Starts out as
UniverseIndex::root()
but grows from there as we enter
universal quantifiers.
NB: At present, we exclude the universal quantifiers on the
item we are type-checking, and just consider those names as
part of the root universe. So this would only get incremented
when we enter into a higher-ranked (for<..>
) type or trait
bound.
Methods
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub fn instantiate_opaque_types<T: TypeFoldable<'tcx>>(
&self,
parent_def_id: DefId,
body_id: NodeId,
param_env: ParamEnv<'tcx>,
value: &T
) -> InferOk<'tcx, (T, OpaqueTypeMap<'tcx>)>
[src]
pub fn instantiate_opaque_types<T: TypeFoldable<'tcx>>(
&self,
parent_def_id: DefId,
body_id: NodeId,
param_env: ParamEnv<'tcx>,
value: &T
) -> InferOk<'tcx, (T, OpaqueTypeMap<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Replace all opaque types in value
with fresh inference variables
and creates appropriate obligations. For example, given the input:
impl Iterator<Item = impl Debug>
this method would create two type variables, ?0
and ?1
. It would
return the type ?0
but also the obligations:
?0: Iterator<Item = ?1> ?1: Debug
Moreover, it returns a OpaqueTypeMap
that would map ?0
to
info about the impl Iterator<..>
type and ?1
to info about
the impl Debug
type.
Parameters
parent_def_id
-- we will only instantiate opaque types with this parent. This is typically the def-id of the function in whose return type opaque types are being instantiated.body_id
-- the body-id with which the resulting obligations should be associatedparam_env
-- the in-scope parameter environment to be used for obligationsvalue
-- the value within which we are instantiating opaque types
pub fn constrain_opaque_types<FRR: FreeRegionRelations<'tcx>>(
&self,
opaque_types: &OpaqueTypeMap<'tcx>,
free_region_relations: &FRR
)
[src]
pub fn constrain_opaque_types<FRR: FreeRegionRelations<'tcx>>(
&self,
opaque_types: &OpaqueTypeMap<'tcx>,
free_region_relations: &FRR
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the map opaque_types
containing the existential impl Trait
types whose underlying, hidden types are being
inferred, this method adds constraints to the regions
appearing in those underlying hidden types to ensure that they
at least do not refer to random scopes within the current
function. These constraints are not (quite) sufficient to
guarantee that the regions are actually legal values; that
final condition is imposed after region inference is done.
The Problem
Let's work through an example to explain how it works. Assume the current function is as follows:
fn foo<'a, 'b>(..) -> (impl Bar<'a>, impl Bar<'b>)
Here, we have two impl Trait
types whose values are being
inferred (the impl Bar<'a>
and the impl Bar<'b>
). Conceptually, this is sugar for a setup where we
define underlying abstract types (Foo1
, Foo2
) and then, in
the return type of foo
, we reference those definitions:
abstract type Foo1<'x>: Bar<'x>;
abstract type Foo2<'x>: Bar<'x>;
fn foo<'a, 'b>(..) -> (Foo1<'a>, Foo2<'b>) { .. }
// ^^^^ ^^
// | |
// | substs
// def_id
As indicating in the comments above, each of those references
is (in the compiler) basically a substitution (substs
)
applied to the type of a suitable def_id
(which identifies
Foo1
or Foo2
).
Now, at this point in compilation, what we have done is to
replace each of the references (Foo1<'a>
, Foo2<'b>
) with
fresh inference variables C1 and C2. We wish to use the values
of these variables to infer the underlying types of Foo1
and
Foo2
. That is, this gives rise to higher-order (pattern) unification
constraints like:
for<'a> (Foo1<'a> = C1)
for<'b> (Foo1<'b> = C2)
For these equation to be satisfiable, the types C1
and C2
can only refer to a limited set of regions. For example, C1
can only refer to 'static
and 'a
, and C2
can only refer
to 'static
and 'b
. The job of this function is to impose that
constraint.
Up to this point, C1 and C2 are basically just random type
inference variables, and hence they may contain arbitrary
regions. In fact, it is fairly likely that they do! Consider
this possible definition of foo
:
fn foo<'a, 'b>(x: &'a i32, y: &'b i32) -> (impl Bar<'a>, impl Bar<'b>) {
(&*x, &*y)
}
Here, the values for the concrete types of the two impl traits will include inference variables:
&'0 i32
&'1 i32
Ordinarily, the subtyping rules would ensure that these are
sufficiently large. But since impl Bar<'a>
isn't a specific
type per se, we don't get such constraints by default. This
is where this function comes into play. It adds extra
constraints to ensure that all the regions which appear in the
inferred type are regions that could validly appear.
This is actually a bit of a tricky constraint in general. We
want to say that each variable (e.g., '0
) can only take on
values that were supplied as arguments to the abstract type
(e.g., 'a
for Foo1<'a>
) or 'static
, which is always in
scope. We don't have a constraint quite of this kind in the current
region checker.
The Solution
We make use of the constraint that we do have in the <=
relation. To do that, we find the "minimum" of all the
arguments that appear in the substs: that is, some region
which is less than all the others. In the case of Foo1<'a>
,
that would be 'a
(it's the only choice, after all). Then we
apply that as a least bound to the variables (e.g., 'a <= '0
).
In some cases, there is no minimum. Consider this example:
fn baz<'a, 'b>() -> impl Trait<'a, 'b> { ... }
Here we would report an error, because 'a
and 'b
have no
relation to one another.
The free_region_relations
parameter
The free_region_relations
argument is used to find the
"minimum" of the regions supplied to a given abstract type.
It must be a relation that can answer whether 'a <= 'b
,
where 'a
and 'b
are regions that appear in the "substs"
for the abstract type references (the <'a>
in Foo1<'a>
).
Note that we do not impose the constraints based on the
generic regions from the Foo1
definition (e.g., 'x
). This
is because the constraints we are imposing here is basically
the concern of the one generating the constraining type C1,
which is the current function. It also means that we can
take "implied bounds" into account in some cases:
trait SomeTrait<'a, 'b> { }
fn foo<'a, 'b>(_: &'a &'b u32) -> impl SomeTrait<'a, 'b> { .. }
Here, the fact that 'b: 'a
is known only because of the
implied bounds from the &'a &'b u32
parameter, and is not
"inherent" to the abstract type definition.
Parameters
opaque_types
-- the map produced byinstantiate_opaque_types
free_region_relations
-- something that can be used to relate the free regions ('a
) that appear in the impl trait.
fn constrain_opaque_type<FRR: FreeRegionRelations<'tcx>>(
&self,
def_id: DefId,
opaque_defn: &OpaqueTypeDecl<'tcx>,
free_region_relations: &FRR
)
[src]
fn constrain_opaque_type<FRR: FreeRegionRelations<'tcx>>(
&self,
def_id: DefId,
opaque_defn: &OpaqueTypeDecl<'tcx>,
free_region_relations: &FRR
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn infer_opaque_definition_from_instantiation(
&self,
def_id: DefId,
opaque_defn: &OpaqueTypeDecl<'tcx>,
instantiated_ty: Ty<'gcx>
) -> Ty<'gcx>
[src]
pub fn infer_opaque_definition_from_instantiation(
&self,
def_id: DefId,
opaque_defn: &OpaqueTypeDecl<'tcx>,
instantiated_ty: Ty<'gcx>
) -> Ty<'gcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the fully resolved, instantiated type for an opaque
type, i.e., the value of an inference variable like C1 or C2
(*), computes the "definition type" for an abstract type
definition -- that is, the inferred value of Foo1<'x>
or
Foo2<'x>
that we would conceptually use in its definition:
abstract type Foo1<'x>: Bar<'x> = AAA; <-- this type AAA abstract type Foo2<'x>: Bar<'x> = BBB; <-- or this type BBB fn foo<'a, 'b>(..) -> (Foo1<'a>, Foo2<'b>) { .. }
Note that these values are defined in terms of a distinct set of
generic parameters ('x
instead of 'a
) from C1 or C2. The main
purpose of this function is to do that translation.
(*) C1 and C2 were introduced in the comments on
constrain_opaque_types
. Read that comment for more context.
Parameters
def_id
, theimpl Trait
typeopaque_defn
, the opaque definition created ininstantiate_opaque_types
instantiated_ty
, the inferred type C1 -- fully resolved, lifted version ofopaque_defn.concrete_ty
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub fn at(
&'a self,
cause: &'a ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>
) -> At<'a, 'gcx, 'tcx>
[src]
pub fn at(
&'a self,
cause: &'a ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>
) -> At<'a, 'gcx, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
pub fn canonicalize_query<V>(
&self,
value: &V,
var_values: &mut SmallCanonicalVarValues<'tcx>
) -> Canonicalized<'gcx, V> where
V: TypeFoldable<'tcx> + Lift<'gcx>,
[src]
pub fn canonicalize_query<V>(
&self,
value: &V,
var_values: &mut SmallCanonicalVarValues<'tcx>
) -> Canonicalized<'gcx, V> where
V: TypeFoldable<'tcx> + Lift<'gcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Canonicalizes a query value V
. When we canonicalize a query,
we not only canonicalize unbound inference variables, but we
also replace all free regions whatsoever. So for example a
query like T: Trait<'static>
would be canonicalized to
T: Trait<'?0>
with a mapping M that maps '?0
to 'static
.
To get a good understanding of what is happening here, check out the chapter in the rustc guide.
pub fn canonicalize_response<V>(&self, value: &V) -> Canonicalized<'gcx, V> where
V: TypeFoldable<'tcx> + Lift<'gcx>,
[src]
pub fn canonicalize_response<V>(&self, value: &V) -> Canonicalized<'gcx, V> where
V: TypeFoldable<'tcx> + Lift<'gcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Canonicalizes a query response V
. When we canonicalize a
query response, we only canonicalize unbound inference
variables, and we leave other free regions alone. So,
continuing with the example from canonicalize_query
, if
there was an input query T: Trait<'static>
, it would have
been canonicalized to
T: Trait<'?0>
with a mapping M that maps '?0
to 'static
. But if we found that there
exists only one possible impl of Trait
, and it looks like
impl<T> Trait<'static> for T { .. }
then we would prepare a query result R that (among other
things) includes a mapping to '?0 := 'static
. When
canonicalizing this query result R, we would leave this
reference to 'static
alone.
To get a good understanding of what is happening here, check out the chapter in the rustc guide.
pub fn canonicalize_hr_query_hack<V>(
&self,
value: &V,
var_values: &mut SmallCanonicalVarValues<'tcx>
) -> Canonicalized<'gcx, V> where
V: TypeFoldable<'tcx> + Lift<'gcx>,
[src]
pub fn canonicalize_hr_query_hack<V>(
&self,
value: &V,
var_values: &mut SmallCanonicalVarValues<'tcx>
) -> Canonicalized<'gcx, V> where
V: TypeFoldable<'tcx> + Lift<'gcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A hacky variant of canonicalize_query
that does not
canonicalize 'static
. Unfortunately, the existing leak
check treaks 'static
differently in some cases (see also
#33684), so if we are performing an operation that may need to
prove "leak-check" related things, we leave 'static
alone.
FIXME(#48536) -- once we have universes, we can remove this and just use
canonicalize_query
.
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
pub fn make_canonicalized_query_result<T>(
&self,
inference_vars: CanonicalVarValues<'tcx>,
answer: T,
fulfill_cx: &mut FulfillmentContext<'tcx>
) -> Fallible<CanonicalizedQueryResult<'gcx, T>> where
T: Debug + Lift<'gcx> + TypeFoldable<'tcx>,
[src]
pub fn make_canonicalized_query_result<T>(
&self,
inference_vars: CanonicalVarValues<'tcx>,
answer: T,
fulfill_cx: &mut FulfillmentContext<'tcx>
) -> Fallible<CanonicalizedQueryResult<'gcx, T>> where
T: Debug + Lift<'gcx> + TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
This method is meant to be invoked as the final step of a canonical query implementation. It is given:
- the instantiated variables
inference_vars
created from the query key - the result
answer
of the query - a fulfillment context
fulfill_cx
that may contain various obligations which have yet to be proven.
Given this, the function will process the obligations pending
in fulfill_cx
:
- If all the obligations can be proven successfully, it will
package up any resulting region obligations (extracted from
infcx
) along with the fully resolved valueanswer
into a query result (which is then itself canonicalized). - If some obligations can be neither proven nor disproven, then the same thing happens, but the resulting query is marked as ambiguous.
- Finally, if any of the obligations result in a hard error,
then
Err(NoSolution)
is returned.
fn make_query_result<T>(
&self,
inference_vars: CanonicalVarValues<'tcx>,
answer: T,
fulfill_cx: &mut FulfillmentContext<'tcx>
) -> Result<QueryResult<'tcx, T>, NoSolution> where
T: Debug + TypeFoldable<'tcx> + Lift<'gcx>,
[src]
fn make_query_result<T>(
&self,
inference_vars: CanonicalVarValues<'tcx>,
answer: T,
fulfill_cx: &mut FulfillmentContext<'tcx>
) -> Result<QueryResult<'tcx, T>, NoSolution> where
T: Debug + TypeFoldable<'tcx> + Lift<'gcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Helper for make_canonicalized_query_result
that does
everything up until the final canonicalization.
pub fn instantiate_query_result_and_region_obligations<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> InferResult<'tcx, R> where
R: Debug + TypeFoldable<'tcx>,
[src]
pub fn instantiate_query_result_and_region_obligations<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> InferResult<'tcx, R> where
R: Debug + TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the (canonicalized) result to a canonical query, instantiates the result so it can be used, plugging in the values from the canonical query. (Note that the result may have been ambiguous; you should check the certainty level of the query before applying this function.)
To get a good understanding of what is happening here, check out the chapter in the rustc guide.
pub fn instantiate_nll_query_result_and_region_obligations<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>,
output_query_region_constraints: &mut Vec<QueryRegionConstraint<'tcx>>
) -> InferResult<'tcx, R> where
R: Debug + TypeFoldable<'tcx>,
[src]
pub fn instantiate_nll_query_result_and_region_obligations<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>,
output_query_region_constraints: &mut Vec<QueryRegionConstraint<'tcx>>
) -> InferResult<'tcx, R> where
R: Debug + TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
An alternative to
instantiate_query_result_and_region_obligations
that is more
efficient for NLL. NLL is a bit more advanced in the
"transition to chalk" than the rest of the compiler. During
the NLL type check, all of the "processing" of types and
things happens in queries -- the NLL checker itself is only
interested in the region obligations ('a: 'b
or T: 'b
)
that come out of these queries, which it wants to convert into
MIR-based constraints and solve. Therefore, it is most
convenient for the NLL Type Checker to directly consume
the QueryRegionConstraint
values that arise from doing a
query. This is contrast to other parts of the compiler, which
would prefer for those QueryRegionConstraint
to be converted
into the older infcx-style constraints (e.g., calls to
sub_regions
or register_region_obligation
).
Therefore, instantiate_nll_query_result_and_region_obligations
performs the same
basic operations as instantiate_query_result_and_region_obligations
but
it returns its result differently:
- It creates a substitution
S
that maps from the original query variables to the values computed in the query result. If any errors arise, they are propagated back as anErr
result. - In the case of a successful substitution, we will append
QueryRegionConstraint
values onto theoutput_query_region_constraints
vector for the solver to use (if an error arises, some values may also be pushed, but they should be ignored). - It can happen (though it rarely does currently) that equating types and things will give rise to subobligations that must be processed. In this case, those subobligations are propagated back in the return value.
- Finally, the query result (of type
R
) is propagated back, after applying the substitutionS
.
fn query_result_substitution<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> InferResult<'tcx, CanonicalVarValues<'tcx>> where
R: Debug + TypeFoldable<'tcx>,
[src]
fn query_result_substitution<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> InferResult<'tcx, CanonicalVarValues<'tcx>> where
R: Debug + TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the original values and the (canonicalized) result from computing a query, returns a substitution that can be applied to the query result to convert the result back into the original namespace.
The substitution also comes accompanied with subobligations that arose from unification; these might occur if (for example) we are doing lazy normalization and the value assigned to a type variable is unified with an unnormalized projection.
fn query_result_substitution_guess<R>(
&self,
cause: &ObligationCause<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> CanonicalVarValues<'tcx> where
R: Debug + TypeFoldable<'tcx>,
[src]
fn query_result_substitution_guess<R>(
&self,
cause: &ObligationCause<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> CanonicalVarValues<'tcx> where
R: Debug + TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the original values and the (canonicalized) result from computing a query, returns a guess at a substitution that can be applied to the query result to convert the result back into the original namespace. This is called a guess because it uses a quick heuristic to find the values for each canonical variable; if that quick heuristic fails, then we will instantiate fresh inference variables for each canonical variable instead. Therefore, the result of this method must be properly unified
fn unify_query_result_substitution_guess<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
result_subst: &CanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> InferResult<'tcx, ()> where
R: Debug + TypeFoldable<'tcx>,
[src]
fn unify_query_result_substitution_guess<R>(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
original_values: &SmallCanonicalVarValues<'tcx>,
result_subst: &CanonicalVarValues<'tcx>,
query_result: &Canonical<'tcx, QueryResult<'tcx, R>>
) -> InferResult<'tcx, ()> where
R: Debug + TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given a "guess" at the values for the canonical variables in the input, try to unify with the actual values found in the query result. Often, but not always, this is a no-op, because we already found the mapping in the "guessing" step.
See also: query_result_substitution_guess
fn query_region_constraints_into_obligations<'a>(
&'a self,
cause: &'a ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
unsubstituted_region_constraints: &'a [QueryRegionConstraint<'tcx>],
result_subst: &'a CanonicalVarValues<'tcx>
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a
[src]
fn query_region_constraints_into_obligations<'a>(
&'a self,
cause: &'a ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
unsubstituted_region_constraints: &'a [QueryRegionConstraint<'tcx>],
result_subst: &'a CanonicalVarValues<'tcx>
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Converts the region constraints resulting from a query into an iterator of obligations.
fn unify_canonical_vars(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
variables1: &SmallCanonicalVarValues<'tcx>,
variables2: impl Fn(CanonicalVar) -> Kind<'tcx>
) -> InferResult<'tcx, ()>
[src]
fn unify_canonical_vars(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
variables1: &SmallCanonicalVarValues<'tcx>,
variables2: impl Fn(CanonicalVar) -> Kind<'tcx>
) -> InferResult<'tcx, ()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given two sets of values for the same set of canonical variables, unify them. The second set is produced lazilly by supplying indices from the first set.
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
pub fn instantiate_canonical_with_fresh_inference_vars<T>(
&self,
span: Span,
canonical: &Canonical<'tcx, T>
) -> (T, CanonicalVarValues<'tcx>) where
T: TypeFoldable<'tcx>,
[src]
pub fn instantiate_canonical_with_fresh_inference_vars<T>(
&self,
span: Span,
canonical: &Canonical<'tcx, T>
) -> (T, CanonicalVarValues<'tcx>) where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Creates a substitution S for the canonical value with fresh inference variables and applies it to the canonical value. Returns both the instantiated result and the substitution S.
This is useful at the start of a query: it basically brings the canonical value "into scope" within your new infcx. At the end of processing, the substitution S (once canonicalized) then represents the values that you computed for each of the canonical inputs to your query.
fn fresh_inference_vars_for_canonical_vars(
&self,
span: Span,
variables: &List<CanonicalVarInfo>
) -> CanonicalVarValues<'tcx>
[src]
fn fresh_inference_vars_for_canonical_vars(
&self,
span: Span,
variables: &List<CanonicalVarInfo>
) -> CanonicalVarValues<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the "infos" about the canonical variables from some
canonical, creates fresh inference variables with the same
characteristics. You can then use substitute
to instantiate
the canonical variable with these inference variables.
fn fresh_inference_var_for_canonical_var(
&self,
span: Span,
cv_info: CanonicalVarInfo
) -> Kind<'tcx>
[src]
fn fresh_inference_var_for_canonical_var(
&self,
span: Span,
cv_info: CanonicalVarInfo
) -> Kind<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given the "info" about a canonical variable, creates a fresh inference variable with the same characteristics.
impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx>
[src]
impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx>
pub fn super_combine_tys<R>(
&self,
relation: &mut R,
a: Ty<'tcx>,
b: Ty<'tcx>
) -> RelateResult<'tcx, Ty<'tcx>> where
R: TypeRelation<'infcx, 'gcx, 'tcx>,
[src]
pub fn super_combine_tys<R>(
&self,
relation: &mut R,
a: Ty<'tcx>,
b: Ty<'tcx>
) -> RelateResult<'tcx, Ty<'tcx>> where
R: TypeRelation<'infcx, 'gcx, 'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn unify_integral_variable(
&self,
vid_is_expected: bool,
vid: IntVid,
val: IntVarValue
) -> RelateResult<'tcx, Ty<'tcx>>
[src]
fn unify_integral_variable(
&self,
vid_is_expected: bool,
vid: IntVid,
val: IntVarValue
) -> RelateResult<'tcx, Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn unify_float_variable(
&self,
vid_is_expected: bool,
vid: FloatVid,
val: FloatTy
) -> RelateResult<'tcx, Ty<'tcx>>
[src]
fn unify_float_variable(
&self,
vid_is_expected: bool,
vid: FloatVid,
val: FloatTy
) -> RelateResult<'tcx, Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub(super) fn note_region_origin(
&self,
err: &mut DiagnosticBuilder,
origin: &SubregionOrigin<'tcx>
)
[src]
pub(super) fn note_region_origin(
&self,
err: &mut DiagnosticBuilder,
origin: &SubregionOrigin<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub(super) fn report_concrete_failure(
&self,
region_scope_tree: &ScopeTree,
origin: SubregionOrigin<'tcx>,
sub: Region<'tcx>,
sup: Region<'tcx>
) -> DiagnosticBuilder<'tcx>
[src]
pub(super) fn report_concrete_failure(
&self,
region_scope_tree: &ScopeTree,
origin: SubregionOrigin<'tcx>,
sub: Region<'tcx>,
sup: Region<'tcx>
) -> DiagnosticBuilder<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub fn extract_type_name(&self, ty: &'a Ty<'tcx>) -> String
[src]
pub fn extract_type_name(&self, ty: &'a Ty<'tcx>) -> String
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn need_type_info_err(
&self,
body_id: Option<BodyId>,
span: Span,
ty: Ty<'tcx>
) -> DiagnosticBuilder<'gcx>
[src]
pub fn need_type_info_err(
&self,
body_id: Option<BodyId>,
span: Span,
ty: Ty<'tcx>
) -> DiagnosticBuilder<'gcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
pub fn try_report_nice_region_error(
&self,
error: &RegionResolutionError<'tcx>
) -> bool
[src]
pub fn try_report_nice_region_error(
&self,
error: &RegionResolutionError<'tcx>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub fn report_region_errors(
&self,
region_scope_tree: &ScopeTree,
errors: &Vec<RegionResolutionError<'tcx>>,
will_later_be_reported_by_nll: bool
)
[src]
pub fn report_region_errors(
&self,
region_scope_tree: &ScopeTree,
errors: &Vec<RegionResolutionError<'tcx>>,
will_later_be_reported_by_nll: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn process_errors(
&self,
errors: &Vec<RegionResolutionError<'tcx>>
) -> Vec<RegionResolutionError<'tcx>>
[src]
fn process_errors(
&self,
errors: &Vec<RegionResolutionError<'tcx>>
) -> Vec<RegionResolutionError<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn check_and_note_conflicting_crates(
&self,
err: &mut DiagnosticBuilder,
terr: &TypeError<'tcx>,
sp: Span
)
[src]
fn check_and_note_conflicting_crates(
&self,
err: &mut DiagnosticBuilder,
terr: &TypeError<'tcx>,
sp: Span
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Adds a note if the types come from similarly named crates
fn note_error_origin(
&self,
err: &mut DiagnosticBuilder<'tcx>,
cause: &ObligationCause<'tcx>
)
[src]
fn note_error_origin(
&self,
err: &mut DiagnosticBuilder<'tcx>,
cause: &ObligationCause<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn highlight_outer(
&self,
value: &mut DiagnosticStyledString,
other_value: &mut DiagnosticStyledString,
name: String,
sub: &Substs<'tcx>,
pos: usize,
other_ty: &Ty<'tcx>
)
[src]
fn highlight_outer(
&self,
value: &mut DiagnosticStyledString,
other_value: &mut DiagnosticStyledString,
name: String,
sub: &Substs<'tcx>,
pos: usize,
other_ty: &Ty<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given that other_ty
is the same as a type argument for name
in sub
, populate value
highlighting name
and every type argument that isn't at pos
(which is other_ty
), and
populate other_value
with other_ty
.
Foo<Bar<Qux>>
^^^^--------^ this is highlighted
| |
| this type argument is exactly the same as the other type, not highlighted
this is highlighted
Bar<Qux>
-------- this type is the same as a type argument in the other type, not highlighted
fn cmp_type_arg(
&self,
t1_out: &mut DiagnosticStyledString,
t2_out: &mut DiagnosticStyledString,
path: String,
sub: &Substs<'tcx>,
other_path: String,
other_ty: &Ty<'tcx>
) -> Option<()>
[src]
fn cmp_type_arg(
&self,
t1_out: &mut DiagnosticStyledString,
t2_out: &mut DiagnosticStyledString,
path: String,
sub: &Substs<'tcx>,
other_path: String,
other_ty: &Ty<'tcx>
) -> Option<()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
If other_ty
is the same as a type argument present in sub
, highlight path
in t1_out
,
as that is the difference to the other type.
For the following code:
let x: Foo<Bar<Qux>> = foo::<Bar<Qux>>();
The type error output will behave in the following way:
Foo<Bar<Qux>>
^^^^--------^ this is highlighted
| |
| this type argument is exactly the same as the other type, not highlighted
this is highlighted
Bar<Qux>
-------- this type is the same as a type argument in the other type, not highlighted
fn push_comma(
&self,
value: &mut DiagnosticStyledString,
other_value: &mut DiagnosticStyledString,
len: usize,
pos: usize
)
[src]
fn push_comma(
&self,
value: &mut DiagnosticStyledString,
other_value: &mut DiagnosticStyledString,
len: usize,
pos: usize
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Add a ,
to the type representation only if it is appropriate.
fn strip_generic_default_params(
&self,
def_id: DefId,
substs: &Substs<'tcx>
) -> &'tcx Substs<'tcx>
[src]
fn strip_generic_default_params(
&self,
def_id: DefId,
substs: &Substs<'tcx>
) -> &'tcx Substs<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
For generic types with parameters with defaults, remove the parameters corresponding to
the defaults. This repeats a lot of the logic found in PrintContext::parameterized
.
fn cmp(
&self,
t1: Ty<'tcx>,
t2: Ty<'tcx>
) -> (DiagnosticStyledString, DiagnosticStyledString)
[src]
fn cmp(
&self,
t1: Ty<'tcx>,
t2: Ty<'tcx>
) -> (DiagnosticStyledString, DiagnosticStyledString)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Compare two given types, eliding parts that are the same between them and highlighting relevant differences, and return two representation of those types for highlighted printing.
pub fn note_type_err(
&self,
diag: &mut DiagnosticBuilder<'tcx>,
cause: &ObligationCause<'tcx>,
secondary_span: Option<(Span, String)>,
values: Option<ValuePairs<'tcx>>,
terr: &TypeError<'tcx>
)
[src]
pub fn note_type_err(
&self,
diag: &mut DiagnosticBuilder<'tcx>,
cause: &ObligationCause<'tcx>,
secondary_span: Option<(Span, String)>,
values: Option<ValuePairs<'tcx>>,
terr: &TypeError<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn report_and_explain_type_error(
&self,
trace: TypeTrace<'tcx>,
terr: &TypeError<'tcx>
) -> DiagnosticBuilder<'tcx>
[src]
pub fn report_and_explain_type_error(
&self,
trace: TypeTrace<'tcx>,
terr: &TypeError<'tcx>
) -> DiagnosticBuilder<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn values_str(
&self,
values: &ValuePairs<'tcx>
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)>
[src]
fn values_str(
&self,
values: &ValuePairs<'tcx>
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn expected_found_str_ty(
&self,
exp_found: &ExpectedFound<Ty<'tcx>>
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)>
[src]
fn expected_found_str_ty(
&self,
exp_found: &ExpectedFound<Ty<'tcx>>
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn expected_found_str<T: Display + TypeFoldable<'tcx>>(
&self,
exp_found: &ExpectedFound<T>
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)>
[src]
fn expected_found_str<T: Display + TypeFoldable<'tcx>>(
&self,
exp_found: &ExpectedFound<T>
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns a string of the form "expected {}
, found {}
".
pub fn report_generic_bound_failure(
&self,
region_scope_tree: &ScopeTree,
span: Span,
origin: Option<SubregionOrigin<'tcx>>,
bound_kind: GenericKind<'tcx>,
sub: Region<'tcx>
)
[src]
pub fn report_generic_bound_failure(
&self,
region_scope_tree: &ScopeTree,
span: Span,
origin: Option<SubregionOrigin<'tcx>>,
bound_kind: GenericKind<'tcx>,
sub: Region<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn construct_generic_bound_failure(
&self,
region_scope_tree: &ScopeTree,
span: Span,
origin: Option<SubregionOrigin<'tcx>>,
bound_kind: GenericKind<'tcx>,
sub: Region<'tcx>
) -> DiagnosticBuilder<'a>
[src]
pub fn construct_generic_bound_failure(
&self,
region_scope_tree: &ScopeTree,
span: Span,
origin: Option<SubregionOrigin<'tcx>>,
bound_kind: GenericKind<'tcx>,
sub: Region<'tcx>
) -> DiagnosticBuilder<'a>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn report_sub_sup_conflict(
&self,
region_scope_tree: &ScopeTree,
var_origin: RegionVariableOrigin,
sub_origin: SubregionOrigin<'tcx>,
sub_region: Region<'tcx>,
sup_origin: SubregionOrigin<'tcx>,
sup_region: Region<'tcx>
)
[src]
fn report_sub_sup_conflict(
&self,
region_scope_tree: &ScopeTree,
var_origin: RegionVariableOrigin,
sub_origin: SubregionOrigin<'tcx>,
sub_region: Region<'tcx>,
sup_origin: SubregionOrigin<'tcx>,
sup_region: Region<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
fn report_inference_failure(
&self,
var_origin: RegionVariableOrigin
) -> DiagnosticBuilder<'tcx>
[src]
fn report_inference_failure(
&self,
var_origin: RegionVariableOrigin
) -> DiagnosticBuilder<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub fn fudge_regions_if_ok<T, E, F>(
&self,
origin: &RegionVariableOrigin,
f: F
) -> Result<T, E> where
F: FnOnce() -> Result<T, E>,
T: TypeFoldable<'tcx>,
[src]
pub fn fudge_regions_if_ok<T, E, F>(
&self,
origin: &RegionVariableOrigin,
f: F
) -> Result<T, E> where
F: FnOnce() -> Result<T, E>,
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
This rather funky routine is used while processing expected
types. What happens here is that we want to propagate a
coercion through the return type of a fn to its
argument. Consider the type of Option::Some
, which is
basically for<T> fn(T) -> Option<T>
. So if we have an
expression Some(&[1, 2, 3])
, and that has the expected type
Option<&[u32]>
, we would like to type check &[1, 2, 3]
with the expectation of &[u32]
. This will cause us to coerce
from &[u32; 3]
to &[u32]
and make the users life more
pleasant.
The way we do this is using fudge_regions_if_ok
. What the
routine actually does is to start a snapshot and execute the
closure f
. In our example above, what this closure will do
is to unify the expectation (Option<&[u32]>
) with the actual
return type (Option<?T>
, where ?T
represents the variable
instantiated for T
). This will cause ?T
to be unified
with &?a [u32]
, where ?a
is a fresh lifetime variable. The
input type (?T
) is then returned by f()
.
At this point, fudge_regions_if_ok
will normalize all type
variables, converting ?T
to &?a [u32]
and end the
snapshot. The problem is that we can't just return this type
out, because it references the region variable ?a
, and that
region variable was popped when we popped the snapshot.
So what we do is to keep a list (region_vars
, in the code below)
of region variables created during the snapshot (here, ?a
). We
fold the return value and replace any such regions with a new
region variable (e.g., ?b
) and return the result (&?b [u32]
).
This can then be used as the expectation for the fn argument.
The important point here is that, for soundness purposes, the
regions in question are not particularly important. We will
use the expected types to guide coercions, but we will still
type-check the resulting types from those coercions against
the actual types (?T
, Option<?T
) -- and remember that
after the snapshot is popped, the variable ?T
is no longer
unified.
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
fn tainted_regions(
&self,
snapshot: &CombinedSnapshot<'a, 'tcx>,
r: Region<'tcx>,
directions: TaintDirections
) -> FxHashSet<Region<'tcx>>
[src]
fn tainted_regions(
&self,
snapshot: &CombinedSnapshot<'a, 'tcx>,
r: Region<'tcx>,
directions: TaintDirections
) -> FxHashSet<Region<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn region_vars_confined_to_snapshot(
&self,
snapshot: &CombinedSnapshot<'a, 'tcx>
) -> Vec<RegionVid>
[src]
fn region_vars_confined_to_snapshot(
&self,
snapshot: &CombinedSnapshot<'a, 'tcx>
) -> Vec<RegionVid>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns the set of region variables that do not affect any
types/regions which existed before snapshot
was
started. This is used in the sub/lub/glb computations. The
idea here is that when we are computing lub/glb of two
regions, we sometimes create intermediate region variables.
Those region variables may touch some of the skolemized or
other "forbidden" regions we created to replace bound
regions, but they don't really represent an "external"
constraint.
However, sometimes fresh variables are created for other purposes too, and those may represent an external constraint. In particular, when a type variable is instantiated, we create region variables for all the regions that appear within, and if that type variable pre-existed the snapshot, then those region variables represent external constraints.
An example appears in the unit test
sub_free_bound_false_infer
. In this test, we want to
know whether
fn(_#0t) <: for<'a> fn(&'a int)
Note that the subtype has a type variable. Because the type variable can't be instantiated with a region that is bound in the fn signature, this comparison ought to fail. But if we're not careful, it will succeed.
The reason is that when we walk through the subtyping
algorithm, we begin by replacing 'a
with a skolemized
variable '1
. We then have fn(_#0t) <: fn(&'1 int)
. This
can be made true by unifying _#0t
with &'1 int
. In the
process, we create a fresh variable for the skolemized
region, '$2
, and hence we have that _#0t == &'$2 int
. However, because '$2
was created during the sub
computation, if we're not careful we will erroneously
assume it is one of the transient region variables
representing a lub/glb internally. Not good.
To prevent this, we check for type variables which were unified during the snapshot, and say that any region variable created during the snapshot but which finds its way into a type variable is considered to "escape" the snapshot.
pub fn skolemize_late_bound_regions<T>(
&self,
binder: &Binder<T>
) -> (T, SkolemizationMap<'tcx>) where
T: TypeFoldable<'tcx>,
[src]
pub fn skolemize_late_bound_regions<T>(
&self,
binder: &Binder<T>
) -> (T, SkolemizationMap<'tcx>) where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Replace all regions bound by binder
with skolemized regions and
return a map indicating which bound-region was replaced with what
skolemized region. This is the first step of checking subtyping
when higher-ranked things are involved.
Important: you must call this function from within a snapshot.
Moreover, before committing the snapshot, you must eventually call
either plug_leaks
or pop_skolemized
to remove the skolemized
regions. If you rollback the snapshot (or are using a probe), then
the pop occurs as part of the rollback, so an explicit call is not
needed (but is also permitted).
For more information about how skolemization for HRTBs works, see the rustc guide.
pub fn leak_check(
&self,
overly_polymorphic: bool,
_span: Span,
skol_map: &SkolemizationMap<'tcx>,
snapshot: &CombinedSnapshot<'a, 'tcx>
) -> RelateResult<'tcx, ()>
[src]
pub fn leak_check(
&self,
overly_polymorphic: bool,
_span: Span,
skol_map: &SkolemizationMap<'tcx>,
snapshot: &CombinedSnapshot<'a, 'tcx>
) -> RelateResult<'tcx, ()>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Searches the region constraints created since snapshot
was started
and checks to determine whether any of the skolemized regions created
in skol_map
would "escape" -- meaning that they are related to
other regions in some way. If so, the higher-ranked subtyping doesn't
hold. See README.md
for more details.
pub fn plug_leaks<T>(
&self,
skol_map: SkolemizationMap<'tcx>,
snapshot: &CombinedSnapshot<'a, 'tcx>,
value: T
) -> T where
T: TypeFoldable<'tcx>,
[src]
pub fn plug_leaks<T>(
&self,
skol_map: SkolemizationMap<'tcx>,
snapshot: &CombinedSnapshot<'a, 'tcx>,
value: T
) -> T where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
This code converts from skolemized regions back to late-bound
regions. It works by replacing each region in the taint set of a
skolemized region with a bound-region. The bound region will be bound
by the outer-most binder in value
; the caller must ensure that there is
such a binder and it is the right place.
This routine is only intended to be used when the leak-check has
passed; currently, it's used in the trait matching code to create
a set of nested obligations frmo an impl that matches against
something higher-ranked. More details can be found in
librustc/middle/traits/README.md
.
As a brief example, consider the obligation for<'a> Fn(&'a int) -> &'a int
, and the impl:
impl<A,R> Fn<A,R> for SomethingOrOther where A : Clone { ... }
Here we will have replaced 'a
with a skolemized region
'0
. This means that our substitution will be {A=>&'0 int, R=>&'0 int}
.
When we apply the substitution to the bounds, we will wind up with
&'0 int : Clone
as a predicate. As a last step, we then go and
replace '0
with a late-bound region 'a
. The depth is matched
to the depth of the predicate, in this case 1, so that the final
predicate is for<'a> &'a int : Clone
.
pub fn pop_skolemized(
&self,
skol_map: SkolemizationMap<'tcx>,
snapshot: &CombinedSnapshot<'a, 'tcx>
)
[src]
pub fn pop_skolemized(
&self,
skol_map: SkolemizationMap<'tcx>,
snapshot: &CombinedSnapshot<'a, 'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Pops the skolemized regions found in skol_map
from the region
inference context. Whenever you create skolemized regions via
skolemize_late_bound_regions
, they must be popped before you
commit the enclosing snapshot (if you do not commit, e.g. within a
probe or as a result of an error, then this is not necessary, as
popping happens as part of the rollback).
Note: popping also occurs implicitly as part of leak_check
.
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
pub fn register_region_obligation(
&self,
body_id: NodeId,
obligation: RegionObligation<'tcx>
)
[src]
pub fn register_region_obligation(
&self,
body_id: NodeId,
obligation: RegionObligation<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Registers that the given region obligation must be resolved
from within the scope of body_id
. These regions are enqueued
and later processed by regionck, when full type information is
available (see region_obligations
field for more
information).
pub fn take_registered_region_obligations(
&self
) -> Vec<(NodeId, RegionObligation<'tcx>)>
[src]
pub fn take_registered_region_obligations(
&self
) -> Vec<(NodeId, RegionObligation<'tcx>)>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Trait queries just want to pass back type obligations "as is"
pub fn process_registered_region_obligations(
&self,
region_bound_pairs: &[(Region<'tcx>, GenericKind<'tcx>)],
implicit_region_bound: Option<Region<'tcx>>,
param_env: ParamEnv<'tcx>,
body_id: NodeId
)
[src]
pub fn process_registered_region_obligations(
&self,
region_bound_pairs: &[(Region<'tcx>, GenericKind<'tcx>)],
implicit_region_bound: Option<Region<'tcx>>,
param_env: ParamEnv<'tcx>,
body_id: NodeId
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Process the region obligations that must be proven (during
regionck
) for the given body_id
, given information about
the region bounds in scope and so forth. This function must be
invoked for all relevant body-ids before region inference is
done (or else an assert will fire).
See the region_obligations
field of InferCtxt
for some
comments about how this function fits into the overall expected
flow of the the inferencer. The key point is that it is
invoked after all type-inference variables have been bound --
towards the end of regionck. This also ensures that the
region-bound-pairs are available (see comments above regarding
closures).
Parameters
region_bound_pairs
: the set of region bounds implied by the parameters and where-clauses. In particular, each pair('a, K)
in this list tells us that the bounds in scope indicate thatK: 'a
, whereK
is either a generic parameter likeT
or a projection likeT::Item
.implicit_region_bound
: if some, this is a region bound that is considered to hold for all type parameters (the function body).param_env
is the parameter environment for the enclosing function.body_id
is the body-id whose region obligations are being processed.
Returns
This function may have to perform normalizations, and hence it
returns an InferOk
with subobligations that must be
processed.
pub fn type_must_outlive(
&self,
region_bound_pairs: &[(Region<'tcx>, GenericKind<'tcx>)],
implicit_region_bound: Option<Region<'tcx>>,
param_env: ParamEnv<'tcx>,
origin: SubregionOrigin<'tcx>,
ty: Ty<'tcx>,
region: Region<'tcx>
)
[src]
pub fn type_must_outlive(
&self,
region_bound_pairs: &[(Region<'tcx>, GenericKind<'tcx>)],
implicit_region_bound: Option<Region<'tcx>>,
param_env: ParamEnv<'tcx>,
origin: SubregionOrigin<'tcx>,
ty: Ty<'tcx>,
region: Region<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Processes a single ad-hoc region obligation that was not registered in advance.
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub fn is_in_snapshot(&self) -> bool
[src]
pub fn is_in_snapshot(&self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn freshen<T: TypeFoldable<'tcx>>(&self, t: T) -> T
[src]
pub fn freshen<T: TypeFoldable<'tcx>>(&self, t: T) -> T
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn type_var_diverges(&'a self, ty: Ty) -> bool
[src]
pub fn type_var_diverges(&'a self, ty: Ty) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn freshener<'b>(&'b self) -> TypeFreshener<'b, 'gcx, 'tcx>
[src]
pub fn freshener<'b>(&'b self) -> TypeFreshener<'b, 'gcx, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric
[src]
pub fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn unsolved_variables(&self) -> Vec<Ty<'tcx>>
[src]
pub fn unsolved_variables(&self) -> Vec<Ty<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn combine_fields(
&'a self,
trace: TypeTrace<'tcx>,
param_env: ParamEnv<'tcx>
) -> CombineFields<'a, 'gcx, 'tcx>
[src]
fn combine_fields(
&'a self,
trace: TypeTrace<'tcx>,
param_env: ParamEnv<'tcx>
) -> CombineFields<'a, 'gcx, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn save_and_restore_in_snapshot_flag<F, R>(&self, func: F) -> R where
F: FnOnce(&Self) -> R,
[src]
pub fn save_and_restore_in_snapshot_flag<F, R>(&self, func: F) -> R where
F: FnOnce(&Self) -> R,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn start_snapshot(&self) -> CombinedSnapshot<'a, 'tcx>
[src]
fn start_snapshot(&self) -> CombinedSnapshot<'a, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn rollback_to(&self, cause: &str, snapshot: CombinedSnapshot<'a, 'tcx>)
[src]
fn rollback_to(&self, cause: &str, snapshot: CombinedSnapshot<'a, 'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn commit_from(&self, snapshot: CombinedSnapshot<'a, 'tcx>)
[src]
fn commit_from(&self, snapshot: CombinedSnapshot<'a, 'tcx>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn commit_unconditionally<R, F>(&self, f: F) -> R where
F: FnOnce() -> R,
[src]
pub fn commit_unconditionally<R, F>(&self, f: F) -> R where
F: FnOnce() -> R,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Execute f
and commit the bindings
pub fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E> where
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> Result<T, E>,
[src]
pub fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E> where
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> Result<T, E>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Execute f
and commit the bindings if closure f
returns Ok(_)
pub fn in_snapshot<T, F>(&self, f: F) -> T where
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> T,
[src]
pub fn in_snapshot<T, F>(&self, f: F) -> T where
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> T,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn probe<R, F>(&self, f: F) -> R where
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> R,
[src]
pub fn probe<R, F>(&self, f: F) -> R where
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> R,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Execute f
then unroll any bindings it creates
pub fn add_given(&self, sub: Region<'tcx>, sup: RegionVid)
[src]
pub fn add_given(&self, sub: Region<'tcx>, sup: RegionVid)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn can_sub<T>(
&self,
param_env: ParamEnv<'tcx>,
a: T,
b: T
) -> UnitResult<'tcx> where
T: ToTrace<'tcx>,
[src]
pub fn can_sub<T>(
&self,
param_env: ParamEnv<'tcx>,
a: T,
b: T
) -> UnitResult<'tcx> where
T: ToTrace<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn can_eq<T>(
&self,
param_env: ParamEnv<'tcx>,
a: T,
b: T
) -> UnitResult<'tcx> where
T: ToTrace<'tcx>,
[src]
pub fn can_eq<T>(
&self,
param_env: ParamEnv<'tcx>,
a: T,
b: T
) -> UnitResult<'tcx> where
T: ToTrace<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn sub_regions(
&self,
origin: SubregionOrigin<'tcx>,
a: Region<'tcx>,
b: Region<'tcx>
)
[src]
pub fn sub_regions(
&self,
origin: SubregionOrigin<'tcx>,
a: Region<'tcx>,
b: Region<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn subtype_predicate(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
predicate: &PolySubtypePredicate<'tcx>
) -> Option<InferResult<'tcx, ()>>
[src]
pub fn subtype_predicate(
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
predicate: &PolySubtypePredicate<'tcx>
) -> Option<InferResult<'tcx, ()>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn region_outlives_predicate(
&self,
cause: &ObligationCause<'tcx>,
predicate: &PolyRegionOutlivesPredicate<'tcx>
) -> UnitResult<'tcx>
[src]
pub fn region_outlives_predicate(
&self,
cause: &ObligationCause<'tcx>,
predicate: &PolyRegionOutlivesPredicate<'tcx>
) -> UnitResult<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn next_ty_var_id(
&self,
diverging: bool,
origin: TypeVariableOrigin
) -> TyVid
[src]
pub fn next_ty_var_id(
&self,
diverging: bool,
origin: TypeVariableOrigin
) -> TyVid
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn next_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx>
[src]
pub fn next_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn next_diverging_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx>
[src]
pub fn next_diverging_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn next_int_var_id(&self) -> IntVid
[src]
pub fn next_int_var_id(&self) -> IntVid
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn next_float_var_id(&self) -> FloatVid
[src]
pub fn next_float_var_id(&self) -> FloatVid
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn next_region_var(&self, origin: RegionVariableOrigin) -> Region<'tcx>
[src]
pub fn next_region_var(&self, origin: RegionVariableOrigin) -> Region<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create a fresh region variable with the next available index. The variable will be created in the maximum universe created thus far, allowing it to name any region created thus far.
pub fn next_region_var_in_universe(
&self,
origin: RegionVariableOrigin,
universe: UniverseIndex
) -> Region<'tcx>
[src]
pub fn next_region_var_in_universe(
&self,
origin: RegionVariableOrigin,
universe: UniverseIndex
) -> Region<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create a fresh region variable with the next available index
in the given universe; typically, you can use
next_region_var
and just use the maximal universe.
pub fn num_region_vars(&self) -> usize
[src]
pub fn num_region_vars(&self) -> usize
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Number of region variables created so far.
pub fn next_nll_region_var(
&self,
origin: NLLRegionVariableOrigin
) -> Region<'tcx>
[src]
pub fn next_nll_region_var(
&self,
origin: NLLRegionVariableOrigin
) -> Region<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Just a convenient wrapper of next_region_var
for using during NLL.
pub fn next_nll_region_var_in_universe(
&self,
origin: NLLRegionVariableOrigin,
universe: UniverseIndex
) -> Region<'tcx>
[src]
pub fn next_nll_region_var_in_universe(
&self,
origin: NLLRegionVariableOrigin,
universe: UniverseIndex
) -> Region<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Just a convenient wrapper of next_region_var
for using during NLL.
pub fn var_for_def(&self, span: Span, param: &GenericParamDef) -> Kind<'tcx>
[src]
pub fn var_for_def(&self, span: Span, param: &GenericParamDef) -> Kind<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn fresh_substs_for_item(
&self,
span: Span,
def_id: DefId
) -> &'tcx Substs<'tcx>
[src]
pub fn fresh_substs_for_item(
&self,
span: Span,
def_id: DefId
) -> &'tcx Substs<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given a set of generics defined on a type or impl, returns a substitution mapping each type/region parameter to a fresh inference variable.
pub fn is_tainted_by_errors(&self) -> bool
[src]
pub fn is_tainted_by_errors(&self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
True if errors have been reported since this infcx was created. This is sometimes used as a heuristic to skip reporting errors that often occur as a result of earlier errors, but where it's hard to be 100% sure (e.g., unresolved inference variables, regionck errors).
pub fn set_tainted_by_errors(&self)
[src]
pub fn set_tainted_by_errors(&self)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Set the "tainted by errors" flag to true. We call this when we observe an error from a prior pass.
pub fn resolve_regions_and_report_errors(
&self,
region_context: DefId,
region_map: &ScopeTree,
outlives_env: &OutlivesEnvironment<'tcx>
)
[src]
pub fn resolve_regions_and_report_errors(
&self,
region_context: DefId,
region_map: &ScopeTree,
outlives_env: &OutlivesEnvironment<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Process the region constraints and report any errors that
result. After this, no more unification operations should be
done -- or the compiler will panic -- but it is legal to use
resolve_type_vars_if_possible
as well as fully_resolve
.
pub fn resolve_regions_and_report_errors_unless_nll(
&self,
region_context: DefId,
region_map: &ScopeTree,
outlives_env: &OutlivesEnvironment<'tcx>
)
[src]
pub fn resolve_regions_and_report_errors_unless_nll(
&self,
region_context: DefId,
region_map: &ScopeTree,
outlives_env: &OutlivesEnvironment<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Like resolve_regions_and_report_errors
, but skips error
reporting if NLL is enabled. This is used for fn bodies where
the same error may later be reported by the NLL-based
inference.
fn resolve_regions_and_report_errors_inner(
&self,
region_context: DefId,
region_map: &ScopeTree,
outlives_env: &OutlivesEnvironment<'tcx>,
will_later_be_reported_by_nll: bool
)
[src]
fn resolve_regions_and_report_errors_inner(
&self,
region_context: DefId,
region_map: &ScopeTree,
outlives_env: &OutlivesEnvironment<'tcx>,
will_later_be_reported_by_nll: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn take_and_reset_region_constraints(&self) -> RegionConstraintData<'tcx>
[src]
pub fn take_and_reset_region_constraints(&self) -> RegionConstraintData<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Obtains (and clears) the current set of region constraints. The inference context is still usable: further unifications will simply add new constraints.
This method is not meant to be used with normal lexical region resolution. Rather, it is used in the NLL mode as a kind of interim hack: basically we run normal type-check and generate region constraints as normal, but then we take them and translate them into the form that the NLL solver understands. See the NLL module for mode details.
pub fn with_region_constraints<R>(
&self,
op: impl FnOnce(&RegionConstraintData<'tcx>) -> R
) -> R
[src]
pub fn with_region_constraints<R>(
&self,
op: impl FnOnce(&RegionConstraintData<'tcx>) -> R
) -> R
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Gives temporary access to the region constraint data.
pub fn take_region_var_origins(&self) -> VarInfos
[src]
pub fn take_region_var_origins(&self) -> VarInfos
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Takes ownership of the list of variable regions. This implies
that all the region constriants have already been taken, and
hence that resolve_regions_and_report_errors
can never be
called. This is used only during NLL processing to "hand off" ownership
of the set of region vairables into the NLL region context.
pub fn ty_to_string(&self, t: Ty<'tcx>) -> String
[src]
pub fn ty_to_string(&self, t: Ty<'tcx>) -> String
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String
[src]
pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn trait_ref_to_string(&self, t: &TraitRef<'tcx>) -> String
[src]
pub fn trait_ref_to_string(&self, t: &TraitRef<'tcx>) -> String
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn inlined_shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx>
[src]
pub fn inlined_shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx>
[src]
pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn resolve_type_vars_if_possible<T>(&self, value: &T) -> T where
T: TypeFoldable<'tcx>,
[src]
pub fn resolve_type_vars_if_possible<T>(&self, value: &T) -> T where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Where possible, replaces type/int/float variables in
value
with their final value. Note that region variables
are unaffected. If a type variable has not been unified, it
is left as is. This is an idempotent operation that does
not affect inference state in any way and so you can do it
at will.
pub fn any_unresolved_type_vars<T>(&self, value: &T) -> bool where
T: TypeFoldable<'tcx>,
[src]
pub fn any_unresolved_type_vars<T>(&self, value: &T) -> bool where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns true if T
contains unresolved type variables. In the
process of visiting T
, this will resolve (where possible)
type variables in T
, but it never constructs the final,
resolved type, so it's more efficient than
resolve_type_vars_if_possible()
.
pub fn resolve_type_and_region_vars_if_possible<T>(&self, value: &T) -> T where
T: TypeFoldable<'tcx>,
[src]
pub fn resolve_type_and_region_vars_if_possible<T>(&self, value: &T) -> T where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn fully_resolve<T: TypeFoldable<'tcx>>(&self, value: &T) -> FixupResult<T>
[src]
pub fn fully_resolve<T: TypeFoldable<'tcx>>(&self, value: &T) -> FixupResult<T>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Attempts to resolve all type/region variables in
value
. Region inference must have been run already (e.g.,
by calling resolve_regions_and_report_errors
). If some
variable was never unified, an Err
results.
This method is idempotent, but it not typically not invoked except during the writeback phase.
pub fn type_error_struct_with_diag<M>(
&self,
sp: Span,
mk_diag: M,
actual_ty: Ty<'tcx>
) -> DiagnosticBuilder<'tcx> where
M: FnOnce(String) -> DiagnosticBuilder<'tcx>,
[src]
pub fn type_error_struct_with_diag<M>(
&self,
sp: Span,
mk_diag: M,
actual_ty: Ty<'tcx>
) -> DiagnosticBuilder<'tcx> where
M: FnOnce(String) -> DiagnosticBuilder<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn report_mismatched_types(
&self,
cause: &ObligationCause<'tcx>,
expected: Ty<'tcx>,
actual: Ty<'tcx>,
err: TypeError<'tcx>
) -> DiagnosticBuilder<'tcx>
[src]
pub fn report_mismatched_types(
&self,
cause: &ObligationCause<'tcx>,
expected: Ty<'tcx>,
actual: Ty<'tcx>,
err: TypeError<'tcx>
) -> DiagnosticBuilder<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn replace_late_bound_regions_with_fresh_var<T>(
&self,
span: Span,
lbrct: LateBoundRegionConversionTime,
value: &Binder<T>
) -> (T, BTreeMap<BoundRegion, Region<'tcx>>) where
T: TypeFoldable<'tcx>,
[src]
pub fn replace_late_bound_regions_with_fresh_var<T>(
&self,
span: Span,
lbrct: LateBoundRegionConversionTime,
value: &Binder<T>
) -> (T, BTreeMap<BoundRegion, Region<'tcx>>) where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn match_poly_projection_predicate(
&self,
cause: ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
match_a: PolyProjectionPredicate<'tcx>,
match_b: TraitRef<'tcx>
) -> InferResult<'tcx, HrMatchResult<Ty<'tcx>>>
[src]
pub fn match_poly_projection_predicate(
&self,
cause: ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
match_a: PolyProjectionPredicate<'tcx>,
match_b: TraitRef<'tcx>
) -> InferResult<'tcx, HrMatchResult<Ty<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given a higher-ranked projection predicate like:
for<'a> <T as Fn<&'a u32>>::Output = &'a u32
and a target trait-ref like:
<T as Fn<&'x u32>>
find a substitution S
for the higher-ranked regions (here,
['a => 'x]
) such that the predicate matches the trait-ref,
and then return the value (here, &'a u32
) but with the
substitution applied (hence, &'x u32
).
See higher_ranked_match
in higher_ranked/mod.rs
for more
details.
pub fn verify_generic_bound(
&self,
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
a: Region<'tcx>,
bound: VerifyBound<'tcx>
)
[src]
pub fn verify_generic_bound(
&self,
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
a: Region<'tcx>,
bound: VerifyBound<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
See verify_generic_bound
method in region_constraints
pub fn type_moves_by_default(
&self,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
span: Span
) -> bool
[src]
pub fn type_moves_by_default(
&self,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
span: Span
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn closure_kind(
&self,
closure_def_id: DefId,
closure_substs: ClosureSubsts<'tcx>
) -> Option<ClosureKind>
[src]
pub fn closure_kind(
&self,
closure_def_id: DefId,
closure_substs: ClosureSubsts<'tcx>
) -> Option<ClosureKind>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Obtains the latest type of the given closure; this may be a
closure in the current function, in which case its
ClosureKind
may not yet be known.
pub fn closure_sig(
&self,
def_id: DefId,
substs: ClosureSubsts<'tcx>
) -> PolyFnSig<'tcx>
[src]
pub fn closure_sig(
&self,
def_id: DefId,
substs: ClosureSubsts<'tcx>
) -> PolyFnSig<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Obtain the signature of a closure. For closures, unlike
tcx.fn_sig(def_id)
, this method will work during the
type-checking of the enclosing function and return the closure
signature in its partially inferred state.
pub fn partially_normalize_associated_types_in<T>(
&self,
span: Span,
body_id: NodeId,
param_env: ParamEnv<'tcx>,
value: &T
) -> InferOk<'tcx, T> where
T: TypeFoldable<'tcx>,
[src]
pub fn partially_normalize_associated_types_in<T>(
&self,
span: Span,
body_id: NodeId,
param_env: ParamEnv<'tcx>,
value: &T
) -> InferOk<'tcx, T> where
T: TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Normalizes associated types in value
, potentially returning
new obligations that must further be processed.
pub fn borrow_region_constraints(
&self
) -> RefMut<RegionConstraintCollector<'tcx>>
[src]
pub fn borrow_region_constraints(
&self
) -> RefMut<RegionConstraintCollector<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn clear_caches(&self)
[src]
pub fn clear_caches(&self)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Clears the selection, evaluation, and projection cachesThis is useful when repeatedly attemping to select an Obligation while changing only its ParamEnv, since FulfillmentContext doesn't use 'probe'
fn universe(&self) -> UniverseIndex
[src]
fn universe(&self) -> UniverseIndex
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn create_subuniverse(&self) -> UniverseIndex
[src]
pub fn create_subuniverse(&self) -> UniverseIndex
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create and return a new subunivese of the current universe;
update self.universe
to that new subuniverse. At present,
used only in the NLL subtyping code, which uses the new
universe-based scheme instead of the more limited leak-check
scheme.
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
pub fn report_fulfillment_errors(
&self,
errors: &[FulfillmentError<'tcx>],
body_id: Option<BodyId>,
fallback_has_occurred: bool
)
[src]
pub fn report_fulfillment_errors(
&self,
errors: &[FulfillmentError<'tcx>],
body_id: Option<BodyId>,
fallback_has_occurred: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn error_implies(&self, cond: &Predicate<'tcx>, error: &Predicate<'tcx>) -> bool
[src]
fn error_implies(&self, cond: &Predicate<'tcx>, error: &Predicate<'tcx>) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn report_fulfillment_error(
&self,
error: &FulfillmentError<'tcx>,
body_id: Option<BodyId>,
fallback_has_occurred: bool
)
[src]
fn report_fulfillment_error(
&self,
error: &FulfillmentError<'tcx>,
body_id: Option<BodyId>,
fallback_has_occurred: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn report_projection_error(
&self,
obligation: &PredicateObligation<'tcx>,
error: &MismatchedProjectionTypes<'tcx>
)
[src]
fn report_projection_error(
&self,
obligation: &PredicateObligation<'tcx>,
error: &MismatchedProjectionTypes<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn fuzzy_match_tys(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> bool
[src]
fn fuzzy_match_tys(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn impl_similar_to(
&self,
trait_ref: PolyTraitRef<'tcx>,
obligation: &PredicateObligation<'tcx>
) -> Option<DefId>
[src]
fn impl_similar_to(
&self,
trait_ref: PolyTraitRef<'tcx>,
obligation: &PredicateObligation<'tcx>
) -> Option<DefId>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn on_unimplemented_note(
&self,
trait_ref: PolyTraitRef<'tcx>,
obligation: &PredicateObligation<'tcx>
) -> OnUnimplementedNote
[src]
fn on_unimplemented_note(
&self,
trait_ref: PolyTraitRef<'tcx>,
obligation: &PredicateObligation<'tcx>
) -> OnUnimplementedNote
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn find_similar_impl_candidates(
&self,
trait_ref: PolyTraitRef<'tcx>
) -> Vec<TraitRef<'tcx>>
[src]
fn find_similar_impl_candidates(
&self,
trait_ref: PolyTraitRef<'tcx>
) -> Vec<TraitRef<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn report_similar_impl_candidates(
&self,
impl_candidates: Vec<TraitRef<'tcx>>,
err: &mut DiagnosticBuilder
)
[src]
fn report_similar_impl_candidates(
&self,
impl_candidates: Vec<TraitRef<'tcx>>,
err: &mut DiagnosticBuilder
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn report_overflow_error<T>(
&self,
obligation: &Obligation<'tcx, T>,
suggest_increasing_limit: bool
) -> ! where
T: Display + TypeFoldable<'tcx>,
[src]
pub fn report_overflow_error<T>(
&self,
obligation: &Obligation<'tcx, T>,
suggest_increasing_limit: bool
) -> ! where
T: Display + TypeFoldable<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Reports that an overflow has occurred and halts compilation. We halt compilation unconditionally because it is important that overflows never be masked -- they basically represent computations whose result could not be truly determined and thus we can't say if the program type checks or not -- and they are unusual occurrences in any case.
pub fn report_overflow_error_cycle(
&self,
cycle: &[PredicateObligation<'tcx>]
) -> !
[src]
pub fn report_overflow_error_cycle(
&self,
cycle: &[PredicateObligation<'tcx>]
) -> !
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Reports that a cycle was detected which led to overflow and halts
compilation. This is equivalent to report_overflow_error
except
that we can give a more helpful error message (and, in particular,
we do not suggest increasing the overflow limit, which is not
going to help).
pub fn report_extra_impl_obligation(
&self,
error_span: Span,
item_name: Name,
_impl_item_def_id: DefId,
trait_item_def_id: DefId,
requirement: &Display
) -> DiagnosticBuilder<'tcx>
[src]
pub fn report_extra_impl_obligation(
&self,
error_span: Span,
item_name: Name,
_impl_item_def_id: DefId,
trait_item_def_id: DefId,
requirement: &Display
) -> DiagnosticBuilder<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn get_parent_trait_ref(
&self,
code: &ObligationCauseCode<'tcx>
) -> Option<String>
[src]
fn get_parent_trait_ref(
&self,
code: &ObligationCauseCode<'tcx>
) -> Option<String>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Get the parent trait chain start
pub fn report_selection_error(
&self,
obligation: &PredicateObligation<'tcx>,
error: &SelectionError<'tcx>,
fallback_has_occurred: bool
)
[src]
pub fn report_selection_error(
&self,
obligation: &PredicateObligation<'tcx>,
error: &SelectionError<'tcx>,
fallback_has_occurred: bool
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn suggest_borrow_on_unsized_slice(
&self,
code: &ObligationCauseCode<'tcx>,
err: &mut DiagnosticBuilder<'tcx>
)
[src]
fn suggest_borrow_on_unsized_slice(
&self,
code: &ObligationCauseCode<'tcx>,
err: &mut DiagnosticBuilder<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
When encountering an assignment of an unsized trait, like let x = ""[..];
, provide a
suggestion to borrow the initializer in order to use have a slice instead.
fn suggest_remove_reference(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'tcx>,
trait_ref: &Binder<TraitRef<'tcx>>
)
[src]
fn suggest_remove_reference(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'tcx>,
trait_ref: &Binder<TraitRef<'tcx>>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Whenever references are used by mistake, like for (i, e) in &vec.iter().enumerate()
,
suggest removing these references until we reach a type that implements the trait.
pub fn get_fn_like_arguments(&self, node: Node) -> (Span, Vec<ArgKind>)
[src]
pub fn get_fn_like_arguments(&self, node: Node) -> (Span, Vec<ArgKind>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given some node representing a fn-like thing in the HIR map,
returns a span and ArgKind
information that describes the
arguments it expects. This can be supplied to
report_arg_count_mismatch
.
pub fn report_arg_count_mismatch(
&self,
span: Span,
found_span: Option<Span>,
expected_args: Vec<ArgKind>,
found_args: Vec<ArgKind>,
is_closure: bool
) -> DiagnosticBuilder<'tcx>
[src]
pub fn report_arg_count_mismatch(
&self,
span: Span,
found_span: Option<Span>,
expected_args: Vec<ArgKind>,
found_args: Vec<ArgKind>,
is_closure: bool
) -> DiagnosticBuilder<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Reports an error when the number of arguments needed by a trait match doesn't match the number that the expression provides.
fn report_closure_arg_mismatch(
&self,
span: Span,
found_span: Option<Span>,
expected_ref: PolyTraitRef<'tcx>,
found: PolyTraitRef<'tcx>
) -> DiagnosticBuilder<'tcx>
[src]
fn report_closure_arg_mismatch(
&self,
span: Span,
found_span: Option<Span>,
expected_ref: PolyTraitRef<'tcx>,
found: PolyTraitRef<'tcx>
) -> DiagnosticBuilder<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
fn maybe_report_ambiguity(
&self,
obligation: &PredicateObligation<'tcx>,
body_id: Option<BodyId>
)
[src]
fn maybe_report_ambiguity(
&self,
obligation: &PredicateObligation<'tcx>,
body_id: Option<BodyId>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn predicate_can_apply(
&self,
param_env: ParamEnv<'tcx>,
pred: PolyTraitRef<'tcx>
) -> bool
[src]
fn predicate_can_apply(
&self,
param_env: ParamEnv<'tcx>,
pred: PolyTraitRef<'tcx>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns whether the trait predicate may apply for some assignment to the type parameters.
fn note_obligation_cause<T>(
&self,
err: &mut DiagnosticBuilder,
obligation: &Obligation<'tcx, T>
) where
T: Display,
[src]
fn note_obligation_cause<T>(
&self,
err: &mut DiagnosticBuilder,
obligation: &Obligation<'tcx, T>
) where
T: Display,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn note_obligation_cause_code<T>(
&self,
err: &mut DiagnosticBuilder,
predicate: &T,
cause_code: &ObligationCauseCode<'tcx>,
obligated_types: &mut Vec<&TyS<'tcx>>
) where
T: Display,
[src]
fn note_obligation_cause_code<T>(
&self,
err: &mut DiagnosticBuilder,
predicate: &T,
cause_code: &ObligationCauseCode<'tcx>,
obligated_types: &mut Vec<&TyS<'tcx>>
) where
T: Display,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder)
[src]
fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn is_recursive_obligation(
&self,
obligated_types: &mut Vec<&TyS<'tcx>>,
cause_code: &ObligationCauseCode<'tcx>
) -> bool
[src]
fn is_recursive_obligation(
&self,
obligated_types: &mut Vec<&TyS<'tcx>>,
cause_code: &ObligationCauseCode<'tcx>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx>
fn drain_fulfillment_cx_or_panic<T>(
&self,
span: Span,
fulfill_cx: &mut FulfillmentContext<'tcx>,
result: &T
) -> T::Lifted where
T: TypeFoldable<'tcx> + Lift<'gcx>,
[src]
fn drain_fulfillment_cx_or_panic<T>(
&self,
span: Span,
fulfill_cx: &mut FulfillmentContext<'tcx>,
result: &T
) -> T::Lifted where
T: TypeFoldable<'tcx> + Lift<'gcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Finishes processes any obligations that remain in the
fulfillment context, and then returns the result with all type
variables removed and regions erased. Because this is intended
for use after type-check has completed, if any errors occur,
it will panic. It is used during normalization and other cases
where processing the obligations in fulfill_cx
may cause
type inference variables that appear in result
to be
unified, and hence we need to process those obligations to get
the complete picture of the type.
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
pub fn predicate_may_hold(&self, obligation: &PredicateObligation<'tcx>) -> bool
[src]
pub fn predicate_may_hold(&self, obligation: &PredicateObligation<'tcx>) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Evaluates whether the predicate can be satisfied (by any means)
in the given ParamEnv
.
pub fn predicate_must_hold(
&self,
obligation: &PredicateObligation<'tcx>
) -> bool
[src]
pub fn predicate_must_hold(
&self,
obligation: &PredicateObligation<'tcx>
) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Evaluates whether the predicate can be satisfied in the given
ParamEnv
, and returns false
if not certain. However, this is
not entirely accurate if inference variables are involved.
pub fn evaluate_obligation(
&self,
obligation: &PredicateObligation<'tcx>
) -> Result<EvaluationResult, OverflowError>
[src]
pub fn evaluate_obligation(
&self,
obligation: &PredicateObligation<'tcx>
) -> Result<EvaluationResult, OverflowError>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Evaluate a given predicate, capturing overflow and propagating it back.
fn evaluate_obligation_no_overflow(
&self,
obligation: &PredicateObligation<'tcx>
) -> EvaluationResult
[src]
fn evaluate_obligation_no_overflow(
&self,
obligation: &PredicateObligation<'tcx>
) -> EvaluationResult
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx>
pub fn implied_outlives_bounds(
&self,
param_env: ParamEnv<'tcx>,
body_id: NodeId,
ty: Ty<'tcx>,
span: Span
) -> Vec<OutlivesBound<'tcx>>
[src]
pub fn implied_outlives_bounds(
&self,
param_env: ParamEnv<'tcx>,
body_id: NodeId,
ty: Ty<'tcx>,
span: Span
) -> Vec<OutlivesBound<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Implied bounds are region relationships that we deduce automatically. The idea is that (e.g.) a caller must check that a function's argument types are well-formed immediately before calling that fn, and hence the callee can assume that its argument types are well-formed. This may imply certain relationships between generic parameters. For example:
fn foo<'a,T>(x: &'a T)
can only be called with a 'a
and T
such that &'a T
is WF.
For &'a T
to be WF, T: 'a
must hold. So we can assume T: 'a
.
Parameters
param_env
, the where-clauses in scopebody_id
, the body-id to use when normalizing assoc types. Note that this may cause outlives obligations to be injected into the inference context with this body-id.ty
, the type that we are supposed to assume is WF.span
, a span to use when normalizing, hopefully not important, might be useful if abug!
occurs.
Trait Implementations
impl<'cx, 'gcx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'cx, 'gcx, 'tcx>
[src]
impl<'cx, 'gcx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'cx, 'gcx, 'tcx>
fn push_sub_region_constraint(
&mut self,
origin: SubregionOrigin<'tcx>,
a: Region<'tcx>,
b: Region<'tcx>
)
[src]
fn push_sub_region_constraint(
&mut self,
origin: SubregionOrigin<'tcx>,
a: Region<'tcx>,
b: Region<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn push_verify(
&mut self,
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
a: Region<'tcx>,
bound: VerifyBound<'tcx>
)
[src]
fn push_verify(
&mut self,
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
a: Region<'tcx>,
bound: VerifyBound<'tcx>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Auto Trait Implementations
impl<'a, 'gcx, 'tcx> !Send for InferCtxt<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> !Send for InferCtxt<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> !Sync for InferCtxt<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> !Sync for InferCtxt<'a, 'gcx, 'tcx>
Blanket Implementations
impl<T> MaybeResult for T
[src]
impl<T> MaybeResult for T
fn from_ok(T) -> T
[src]
fn from_ok(T) -> T
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn map_same<F>(Self, F) -> T where
F: FnOnce(T) -> T,
[src]
fn map_same<F>(Self, F) -> T where
F: FnOnce(T) -> T,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl<'a, T> Captures for T where
T: ?Sized,
[src]
impl<'a, T> Captures for T where
T: ?Sized,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Rfn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Rfn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<E> SpecializationError for E
[src]
impl<E> SpecializationError for E
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized,
[src]
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more
impl<T> Erased for T
[src]
impl<T> Erased for T
impl<T> Send for T where
T: ?Sized,
[src]
impl<T> Send for T where
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
impl<T> Sync for T where
T: ?Sized,
impl<T> Erased for T
impl<T> Erased for T