use super::{ConstEvalFailure, Unimplemented};
use super::{FulfillmentError, FulfillmentErrorCode};
use super::{ObligationCause, PredicateObligation};
-use crate::traits::TraitQueryMode;
impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> {
type Predicate = ty::Predicate<'tcx>;
// a snapshot (they don't *straddle* a snapshot, so there
// is no trouble there).
usable_in_snapshot: bool,
-
- // The `TraitQueryMode` used when constructing a `SelectionContext`
- query_mode: TraitQueryMode,
}
#[derive(Clone, Debug)]
static_assert_size!(PendingPredicateObligation<'_>, 136);
impl<'a, 'tcx> FulfillmentContext<'tcx> {
- /// Creates a new fulfillment context with `TraitQueryMode::Standard`
- /// You almost always want to use this instead of `with_query_mode`
+ /// Creates a new fulfillment context.
pub fn new() -> FulfillmentContext<'tcx> {
FulfillmentContext {
predicates: ObligationForest::new(),
register_region_obligations: true,
usable_in_snapshot: false,
- query_mode: TraitQueryMode::Standard,
- }
- }
-
- /// Creates a new fulfillment context with the specified query mode.
- /// This should only be used when you want to ignore overflow,
- /// rather than reporting it as an error.
- pub fn with_query_mode(query_mode: TraitQueryMode) -> FulfillmentContext<'tcx> {
- FulfillmentContext {
- predicates: ObligationForest::new(),
- register_region_obligations: true,
- usable_in_snapshot: false,
- query_mode,
}
}
predicates: ObligationForest::new(),
register_region_obligations: true,
usable_in_snapshot: true,
- query_mode: TraitQueryMode::Standard,
}
}
predicates: ObligationForest::new(),
register_region_obligations: false,
usable_in_snapshot: false,
- query_mode: TraitQueryMode::Standard,
}
}
&mut self,
infcx: &InferCtxt<'_, 'tcx>,
) -> Result<(), Vec<FulfillmentError<'tcx>>> {
- let mut selcx = SelectionContext::with_query_mode(infcx, self.query_mode);
+ let mut selcx = SelectionContext::new(infcx);
self.select(&mut selcx)
}