assert that trait solver is only created in proper infcx
This commit is contained in:
parent
04a6fd241b
commit
7724ba7bd5
2 changed files with 10 additions and 0 deletions
|
@ -36,6 +36,11 @@ pub struct FulfillmentCtxt<'tcx> {
|
|||
|
||||
impl<'tcx> FulfillmentCtxt<'tcx> {
|
||||
pub fn new(infcx: &InferCtxt<'tcx>) -> FulfillmentCtxt<'tcx> {
|
||||
assert!(
|
||||
infcx.next_trait_solver(),
|
||||
"new trait solver fulfillment context created when \
|
||||
infcx is set up for old trait solver"
|
||||
);
|
||||
FulfillmentCtxt { obligations: Vec::new(), usable_in_snapshot: infcx.num_open_snapshots() }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,11 @@ static_assert_size!(PendingPredicateObligation<'_>, 72);
|
|||
impl<'tcx> FulfillmentContext<'tcx> {
|
||||
/// Creates a new fulfillment context.
|
||||
pub(super) fn new(infcx: &InferCtxt<'tcx>) -> FulfillmentContext<'tcx> {
|
||||
assert!(
|
||||
!infcx.next_trait_solver(),
|
||||
"old trait solver fulfillment context created when \
|
||||
infcx is set up for new trait solver"
|
||||
);
|
||||
FulfillmentContext {
|
||||
predicates: ObligationForest::new(),
|
||||
usable_in_snapshot: infcx.num_open_snapshots(),
|
||||
|
|
Loading…
Add table
Reference in a new issue