Struct rustc::traits::fulfill::FulfillmentContext [−][src]
pub struct FulfillmentContext<'tcx> { predicates: ObligationForest<PendingPredicateObligation<'tcx>>, register_region_obligations: 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?
The fulfillment context is used to drive trait resolution. It
consists of a list of obligations that must be (eventually)
satisfied. The job is to track which are satisfied, which yielded
errors, and which are still pending. At any point, users can call
select_where_possible
, and the fulfillment context will try to do
selection, retaining only those obligations that remain
ambiguous. This may be helpful in pushing type inference
along. Once all type inference constraints have been generated, the
method select_all_or_error
can be used to report any remaining
ambiguous cases as errors.
Fields
predicates: ObligationForest<PendingPredicateObligation<'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?
register_region_obligations: 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?
Methods
impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx>
[src]
impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx>
pub fn new() -> FulfillmentContext<'tcx>
[src]
pub fn new() -> FulfillmentContext<'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 new fulfillment context.
pub fn new_ignoring_regions() -> FulfillmentContext<'tcx>
[src]
pub fn new_ignoring_regions() -> FulfillmentContext<'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 select(
&mut self,
selcx: &mut SelectionContext<'a, 'gcx, 'tcx>
) -> Result<(), Vec<FulfillmentError<'tcx>>>
[src]
fn select(
&mut self,
selcx: &mut SelectionContext<'a, 'gcx, 'tcx>
) -> Result<(), Vec<FulfillmentError<'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?
Attempts to select obligations using selcx
.
Trait Implementations
impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx>
[src]
impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx>
fn normalize_projection_type<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
param_env: ParamEnv<'tcx>,
projection_ty: ProjectionTy<'tcx>,
cause: ObligationCause<'tcx>
) -> Ty<'tcx>
[src]
fn normalize_projection_type<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
param_env: ParamEnv<'tcx>,
projection_ty: ProjectionTy<'tcx>,
cause: ObligationCause<'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?
"Normalize" a projection type <SomeType as SomeTrait>::X
by
creating a fresh type variable $0
as well as a projection
predicate <SomeType as SomeTrait>::X == $0
. When the
inference engine runs, it will attempt to find an impl of
SomeTrait
or a where clause that lets us unify $0
with
something concrete. If this fails, we'll unify $0
with
projection_ty
again.
fn register_bound<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
def_id: DefId,
cause: ObligationCause<'tcx>
)
[src]
fn register_bound<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
param_env: ParamEnv<'tcx>,
ty: Ty<'tcx>,
def_id: DefId,
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?
Requires that ty
must implement the trait with def_id
in
the given environment. This trait must not have any type
parameters (except for Self
).
fn register_predicate_obligation<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
obligation: PredicateObligation<'tcx>
)
[src]
fn register_predicate_obligation<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
obligation: 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?
fn select_all_or_error<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>
) -> Result<(), Vec<FulfillmentError<'tcx>>>
[src]
fn select_all_or_error<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>
) -> Result<(), Vec<FulfillmentError<'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 select_where_possible<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>
) -> Result<(), Vec<FulfillmentError<'tcx>>>
[src]
fn select_where_possible<'a, 'gcx>(
&mut self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>
) -> Result<(), Vec<FulfillmentError<'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 pending_obligations(&self) -> Vec<PredicateObligation<'tcx>>
[src]
fn pending_obligations(&self) -> Vec<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?
Auto Trait Implementations
impl<'tcx> !Send for FulfillmentContext<'tcx>
impl<'tcx> !Send for FulfillmentContext<'tcx>
impl<'tcx> !Sync for FulfillmentContext<'tcx>
impl<'tcx> !Sync for FulfillmentContext<'tcx>