Struct rustc_trans::middle::traits::FulfillmentContextExperimental
[-]
[+]
[src]
pub struct FulfillmentContext<'tcx> {
// some fields omitted
}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 fulfilment 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.
Methods
impl<'tcx> FulfillmentContext<'tcx>
fn new() -> FulfillmentContext<'tcx>
fn register_obligation(&mut self, tcx: &ctxt<'tcx>, obligation: Obligation<'tcx>)
fn select_all_or_error(&mut self, infcx: &InferCtxt<'a, 'tcx>, param_env: &ParameterEnvironment<'tcx>, typer: &Typer<'tcx>) -> Result<(), Vec<FulfillmentError<'tcx>>>
fn select_new_obligations(&mut self, infcx: &InferCtxt<'a, 'tcx>, param_env: &ParameterEnvironment<'tcx>, typer: &Typer<'tcx>) -> Result<(), Vec<FulfillmentError<'tcx>>>
Attempts to select obligations that were registered since
the call to a selection routine. This is used by the type checker
to eagerly attempt to resolve obligations in hopes of gaining
type information. It'd be equally valid to use select_where_possible
but it results in O(n^2) performance (#18208).