Struct rustc_typeck::check::Inherited
[−]
[src]
pub struct Inherited<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /* fields omitted */ }
rustc_private
)closures defined within the function. For example:
fn foo() { bar(move|| { ... }) }
Here, the function foo()
and the closure passed to
bar()
will each have their own FnCtxt
, but they will
share the inherited fields.
Methods
impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx>
[src]
fn build(tcx: TyCtxt<'a, 'gcx, 'gcx>,
id: NodeId)
-> InheritedBuilder<'a, 'gcx, 'tcx>
id: NodeId)
-> InheritedBuilder<'a, 'gcx, 'tcx>
rustc_private
)impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx>
[src]
fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>) -> Self
rustc_private
)Methods from Deref<Target=InferCtxt<'a, 'gcx, 'tcx>>
fn super_combine_tys<R>(&self,
relation: &mut R,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<&'tcx TyS<'tcx>, TypeError<'tcx>> where R: TypeRelation<'infcx, 'gcx, 'tcx>
relation: &mut R,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<&'tcx TyS<'tcx>, TypeError<'tcx>> where R: TypeRelation<'infcx, 'gcx, 'tcx>
rustc_private
)fn report_region_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>)
rustc_private
)fn note_type_err(&self,
diag: &mut DiagnosticBuilder<'tcx>,
cause: &ObligationCause<'tcx>,
secondary_span: Option<(Span, String)>,
values: Option<ValuePairs<'tcx>>,
terr: &TypeError<'tcx>)
diag: &mut DiagnosticBuilder<'tcx>,
cause: &ObligationCause<'tcx>,
secondary_span: Option<(Span, String)>,
values: Option<ValuePairs<'tcx>>,
terr: &TypeError<'tcx>)
rustc_private
)fn note_issue_32330(&self,
diag: &mut DiagnosticBuilder<'tcx>,
terr: &TypeError<'tcx>)
diag: &mut DiagnosticBuilder<'tcx>,
terr: &TypeError<'tcx>)
rustc_private
)fn report_and_explain_type_error(&self,
trace: TypeTrace<'tcx>,
terr: &TypeError<'tcx>)
-> DiagnosticBuilder<'tcx>
trace: TypeTrace<'tcx>,
terr: &TypeError<'tcx>)
-> DiagnosticBuilder<'tcx>
rustc_private
)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>
origin: &RegionVariableOrigin,
f: F)
-> Result<T, E> where F: FnOnce() -> Result<T, E>, T: TypeFoldable<'tcx>
rustc_private
)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.
Assumptions:
- no new type variables are created during f()
(asserted
below); this simplifies our logic since we don't have to
check for escaping type variables
fn skolemize_late_bound_regions<T>(&self,
binder: &Binder<T>,
snapshot: &CombinedSnapshot)
-> (T, HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>) where T: TypeFoldable<'tcx>
binder: &Binder<T>,
snapshot: &CombinedSnapshot)
-> (T, HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>) where T: TypeFoldable<'tcx>
rustc_private
)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).
See README.md
for more details.
fn leak_check(&self,
overly_polymorphic: bool,
_span: Span,
skol_map: &HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>,
snapshot: &CombinedSnapshot)
-> Result<(), TypeError<'tcx>>
overly_polymorphic: bool,
_span: Span,
skol_map: &HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>,
snapshot: &CombinedSnapshot)
-> Result<(), TypeError<'tcx>>
rustc_private
)Searches the region constriants 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.
fn plug_leaks<T>(&self,
skol_map: HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>,
snapshot: &CombinedSnapshot,
value: T)
-> T where T: TypeFoldable<'tcx>
skol_map: HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>,
snapshot: &CombinedSnapshot,
value: T)
-> T where T: TypeFoldable<'tcx>
rustc_private
)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
.
fn pop_skolemized(&self,
skol_map: HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>,
snapshot: &CombinedSnapshot)
skol_map: HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>,
snapshot: &CombinedSnapshot)
rustc_private
)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
.
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>
span: Span,
fulfill_cx: &mut FulfillmentContext<'tcx>,
result: &T)
-> T::Lifted where T: TypeFoldable<'tcx> + Lift<'gcx>
rustc_private
)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.
fn projection_mode(&self) -> Reveal
rustc_private
)fn freshen<T>(&self, t: T) -> T where T: TypeFoldable<'tcx>
rustc_private
)fn type_var_diverges(&'a self, ty: &TyS) -> bool
rustc_private
)fn freshener(&'b self) -> TypeFreshener<'b, 'gcx, 'tcx>
rustc_private
)fn type_is_unconstrained_numeric(&'a self, ty: &TyS) -> UnconstrainedNumeric
rustc_private
)fn default(&self, ty: &'tcx TyS<'tcx>) -> Option<Default<'tcx>>
rustc_private
)Returns a type variable's default fallback if any exists. A default must be attached to the variable when created, if it is created without a default, this will return None.
This code does not apply to integral or floating point variables, only to use declared defaults.
See new_ty_var_with_default
to create a type variable with a default.
See type_variable::Default
for details about what a default entails.
fn unsolved_variables(&self) -> Vec<&'tcx TyS<'tcx>>
rustc_private
)fn equate<T>(&'a self,
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
rustc_private
)fn sub<T>(&'a self,
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
rustc_private
)fn lub<T>(&'a self,
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
rustc_private
)fn glb<T>(&'a self,
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
a_is_expected: bool,
trace: TypeTrace<'tcx>,
a: &T,
b: &T)
-> Result<InferOk<'tcx, T>, TypeError<'tcx>> where T: Relate<'tcx>
rustc_private
)fn save_and_restore_obligations_in_snapshot_flag<F, R>(&self, func: F) -> R where F: FnOnce(&InferCtxt<'a, 'gcx, 'tcx>) -> R
rustc_private
)fn commit_unconditionally<R, F>(&self, f: F) -> R where F: FnOnce() -> R
rustc_private
)Execute f
and commit the bindings
fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E> where F: FnOnce(&CombinedSnapshot) -> Result<T, E>
rustc_private
)Execute f
and commit the bindings if closure f
returns Ok(_)
fn in_snapshot<T, F>(&self, f: F) -> T where F: FnOnce(&CombinedSnapshot) -> T
rustc_private
)fn probe<R, F>(&self, f: F) -> R where F: FnOnce(&CombinedSnapshot) -> R
rustc_private
)Execute f
then unroll any bindings it creates
fn add_given(&self, sub: FreeRegion, sup: RegionVid)
rustc_private
)fn sub_types(&self,
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
rustc_private
)fn can_sub_types(&self,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<(), TypeError<'tcx>>
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<(), TypeError<'tcx>>
rustc_private
)fn eq_types(&self,
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: &'tcx TyS<'tcx>,
b: &'tcx TyS<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
rustc_private
)fn eq_trait_refs(&self,
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: TraitRef<'tcx>,
b: TraitRef<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: TraitRef<'tcx>,
b: TraitRef<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
rustc_private
)fn eq_impl_headers(&self,
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: &ImplHeader<'tcx>,
b: &ImplHeader<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
a_is_expected: bool,
cause: &ObligationCause<'tcx>,
a: &ImplHeader<'tcx>,
b: &ImplHeader<'tcx>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
rustc_private
)fn sub_poly_trait_refs(&self,
a_is_expected: bool,
cause: ObligationCause<'tcx>,
a: Binder<TraitRef<'tcx>>,
b: Binder<TraitRef<'tcx>>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
a_is_expected: bool,
cause: ObligationCause<'tcx>,
a: Binder<TraitRef<'tcx>>,
b: Binder<TraitRef<'tcx>>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
rustc_private
)fn sub_regions(&self,
origin: SubregionOrigin<'tcx>,
a: &'tcx Region,
b: &'tcx Region)
origin: SubregionOrigin<'tcx>,
a: &'tcx Region,
b: &'tcx Region)
rustc_private
)fn equality_predicate(&self,
cause: &ObligationCause<'tcx>,
predicate: &Binder<EquatePredicate<'tcx>>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
cause: &ObligationCause<'tcx>,
predicate: &Binder<EquatePredicate<'tcx>>)
-> Result<InferOk<'tcx, ()>, TypeError<'tcx>>
rustc_private
)fn region_outlives_predicate(&self,
cause: &ObligationCause<'tcx>,
predicate: &Binder<OutlivesPredicate<&'tcx Region, &'tcx Region>>)
-> Result<(), TypeError<'tcx>>
cause: &ObligationCause<'tcx>,
predicate: &Binder<OutlivesPredicate<&'tcx Region, &'tcx Region>>)
-> Result<(), TypeError<'tcx>>
rustc_private
)fn next_ty_var_id(&self, diverging: bool, origin: TypeVariableOrigin) -> TyVid
rustc_private
)fn next_ty_var(&self, origin: TypeVariableOrigin) -> &'tcx TyS<'tcx>
rustc_private
)fn next_diverging_ty_var(&self, origin: TypeVariableOrigin) -> &'tcx TyS<'tcx>
rustc_private
)fn next_int_var_id(&self) -> IntVid
rustc_private
)fn next_float_var_id(&self) -> FloatVid
rustc_private
)fn next_region_var(&self, origin: RegionVariableOrigin) -> &'tcx Region
rustc_private
)fn region_var_for_def(&self,
span: Span,
def: &RegionParameterDef)
-> &'tcx Region
span: Span,
def: &RegionParameterDef)
-> &'tcx Region
rustc_private
)Create a region inference variable for the given region parameter definition.
fn type_var_for_def(&self,
span: Span,
def: &TypeParameterDef,
substs: &[Kind<'tcx>])
-> &'tcx TyS<'tcx>
span: Span,
def: &TypeParameterDef,
substs: &[Kind<'tcx>])
-> &'tcx TyS<'tcx>
rustc_private
)Create a type inference variable for the given
type parameter definition. The substitutions are
for actual parameters that may be referred to by
the default of this type parameter, if it exists.
E.g. struct Foo<A, B, C = (A, B)>(...);
when
used in a path such as Foo::<T, U>::new()
will
use an inference variable for C
with [T, U]
as the substitutions for the default, (T, U)
.
fn fresh_substs_for_item(&self,
span: Span,
def_id: DefId)
-> &'tcx Slice<Kind<'tcx>>
span: Span,
def_id: DefId)
-> &'tcx Slice<Kind<'tcx>>
rustc_private
)Given a set of generics defined on a type or impl, returns a substitution mapping each type/region parameter to a fresh inference variable.
fn fresh_bound_region(&self, debruijn: DebruijnIndex) -> &'tcx Region
rustc_private
)fn is_tainted_by_errors(&self) -> bool
rustc_private
)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).
fn set_tainted_by_errors(&self)
rustc_private
)Set the "tainted by errors" flag to true. We call this when we observe an error from a prior pass.
fn node_type(&self, id: NodeId) -> &'tcx TyS<'tcx>
rustc_private
)fn expr_ty(&self, ex: &Expr) -> &'tcx TyS<'tcx>
rustc_private
)fn resolve_regions_and_report_errors(&self,
free_regions: &FreeRegionMap,
subject_node_id: NodeId)
free_regions: &FreeRegionMap,
subject_node_id: NodeId)
rustc_private
)fn ty_to_string(&self, t: &'tcx TyS<'tcx>) -> String
rustc_private
)fn tys_to_string(&self, ts: &[&'tcx TyS<'tcx>]) -> String
rustc_private
)fn trait_ref_to_string(&self, t: &TraitRef<'tcx>) -> String
rustc_private
)fn shallow_resolve(&self, typ: &'tcx TyS<'tcx>) -> &'tcx TyS<'tcx>
rustc_private
)fn resolve_type_vars_if_possible<T>(&self, value: &T) -> T where T: TypeFoldable<'tcx>
rustc_private
)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.
fn resolve_type_and_region_vars_if_possible<T>(&self, value: &T) -> T where T: TypeFoldable<'tcx>
rustc_private
)fn fully_resolve<T>(&self, value: &T) -> Result<T, FixupError> where T: TypeFoldable<'tcx>
rustc_private
)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.
fn type_error_message<M>(&self, sp: Span, mk_msg: M, actual_ty: &'tcx TyS<'tcx>) where M: FnOnce(String) -> String
rustc_private
)fn type_error_struct<M>(&self,
sp: Span,
mk_msg: M,
actual_ty: &'tcx TyS<'tcx>)
-> DiagnosticBuilder<'tcx> where M: FnOnce(String) -> String
sp: Span,
mk_msg: M,
actual_ty: &'tcx TyS<'tcx>)
-> DiagnosticBuilder<'tcx> where M: FnOnce(String) -> String
rustc_private
)fn type_error_struct_with_diag<M>(&self,
sp: Span,
mk_diag: M,
actual_ty: &'tcx TyS<'tcx>)
-> DiagnosticBuilder<'tcx> where M: FnOnce(String) -> DiagnosticBuilder<'tcx>
sp: Span,
mk_diag: M,
actual_ty: &'tcx TyS<'tcx>)
-> DiagnosticBuilder<'tcx> where M: FnOnce(String) -> DiagnosticBuilder<'tcx>
rustc_private
)fn report_mismatched_types(&self,
cause: &ObligationCause<'tcx>,
expected: &'tcx TyS<'tcx>,
actual: &'tcx TyS<'tcx>,
err: TypeError<'tcx>)
-> DiagnosticBuilder<'tcx>
cause: &ObligationCause<'tcx>,
expected: &'tcx TyS<'tcx>,
actual: &'tcx TyS<'tcx>,
err: TypeError<'tcx>)
-> DiagnosticBuilder<'tcx>
rustc_private
)fn report_conflicting_default_types(&self,
span: Span,
body_id: NodeId,
expected: Default<'tcx>,
actual: Default<'tcx>)
span: Span,
body_id: NodeId,
expected: Default<'tcx>,
actual: Default<'tcx>)
rustc_private
)fn replace_late_bound_regions_with_fresh_var<T>(&self,
span: Span,
lbrct: LateBoundRegionConversionTime,
value: &Binder<T>)
-> (T, HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>) where T: TypeFoldable<'tcx>
span: Span,
lbrct: LateBoundRegionConversionTime,
value: &Binder<T>)
-> (T, HashMap<BoundRegion, &'tcx Region, BuildHasherDefault<FxHasher>>) where T: TypeFoldable<'tcx>
rustc_private
)fn match_poly_projection_predicate(&self,
cause: ObligationCause<'tcx>,
match_a: Binder<ProjectionPredicate<'tcx>>,
match_b: TraitRef<'tcx>)
-> Result<InferOk<'tcx, HrMatchResult<&'tcx TyS<'tcx>>>, TypeError<'tcx>>
cause: ObligationCause<'tcx>,
match_a: Binder<ProjectionPredicate<'tcx>>,
match_b: TraitRef<'tcx>)
-> Result<InferOk<'tcx, HrMatchResult<&'tcx TyS<'tcx>>>, TypeError<'tcx>>
rustc_private
)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.
fn verify_generic_bound(&self,
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
a: &'tcx Region,
bound: VerifyBound<'tcx>)
origin: SubregionOrigin<'tcx>,
kind: GenericKind<'tcx>,
a: &'tcx Region,
bound: VerifyBound<'tcx>)
rustc_private
)See verify_generic_bound
method in region_inference
fn can_equate<T>(&self, a: &T, b: &T) -> Result<(), TypeError<'tcx>> where T: Relate<'tcx> + Debug
rustc_private
)fn node_ty(&self, id: NodeId) -> Result<&'tcx TyS<'tcx>, ()>
rustc_private
)fn expr_ty_adjusted(&self, expr: &Expr) -> Result<&'tcx TyS<'tcx>, ()>
rustc_private
)fn type_moves_by_default(&self, ty: &'tcx TyS<'tcx>, span: Span) -> bool
rustc_private
)fn node_method_ty(&self, method_call: MethodCall) -> Option<&'tcx TyS<'tcx>>
rustc_private
)fn node_method_id(&self, method_call: MethodCall) -> Option<DefId>
rustc_private
)fn is_method_call(&self, id: NodeId) -> bool
rustc_private
)fn upvar_capture(&self, upvar_id: UpvarId) -> Option<UpvarCapture<'tcx>>
rustc_private
)fn param_env(&self) -> &ParameterEnvironment<'gcx>
rustc_private
)fn closure_kind(&self, def_id: DefId) -> Option<ClosureKind>
rustc_private
)fn closure_type(&self, def_id: DefId) -> Binder<FnSig<'tcx>>
rustc_private
)fn report_fulfillment_errors(&self, errors: &Vec<FulfillmentError<'tcx>>)
rustc_private
)fn report_overflow_error<T>(&self,
obligation: &Obligation<'tcx, T>,
suggest_increasing_limit: bool)
-> ! where T: Display + TypeFoldable<'tcx>
obligation: &Obligation<'tcx, T>,
suggest_increasing_limit: bool)
-> ! where T: Display + TypeFoldable<'tcx>
rustc_private
)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.
fn report_overflow_error_cycle(&self,
cycle: &[Obligation<'tcx, Predicate<'tcx>>])
-> !
cycle: &[Obligation<'tcx, Predicate<'tcx>>])
-> !
rustc_private
)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).
fn report_extra_impl_obligation(&self,
error_span: Span,
item_name: Symbol,
_impl_item_def_id: DefId,
trait_item_def_id: DefId,
requirement: &Display,
lint_id: Option<NodeId>)
-> DiagnosticBuilder<'tcx>
error_span: Span,
item_name: Symbol,
_impl_item_def_id: DefId,
trait_item_def_id: DefId,
requirement: &Display,
lint_id: Option<NodeId>)
-> DiagnosticBuilder<'tcx>
rustc_private
)fn report_selection_error(&self,
obligation: &Obligation<'tcx, Predicate<'tcx>>,
error: &SelectionError<'tcx>)
obligation: &Obligation<'tcx, Predicate<'tcx>>,
error: &SelectionError<'tcx>)
rustc_private
)