Register obligations from type relation
This commit is contained in:
parent
9a8e1eea7a
commit
f42e490d6f
@ -155,7 +155,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
|
||||
true
|
||||
}
|
||||
|
||||
fn register_opaque_type_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
self.type_checker
|
||||
.fully_perform_op(
|
||||
self.locations,
|
||||
|
@ -740,7 +740,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
|
||||
true
|
||||
}
|
||||
|
||||
fn register_opaque_type_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
self.obligations.extend(obligations);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ use crate::infer::combine::ConstEquateRelation;
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::infer::{ConstVarValue, ConstVariableValue};
|
||||
use crate::infer::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use crate::traits::PredicateObligation;
|
||||
use crate::traits::{Obligation, PredicateObligation};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::error::TypeError;
|
||||
@ -93,7 +93,7 @@ pub trait TypeRelatingDelegate<'tcx> {
|
||||
);
|
||||
|
||||
fn const_equate(&mut self, a: ty::Const<'tcx>, b: ty::Const<'tcx>);
|
||||
fn register_opaque_type_obligations(&mut self, obligations: Vec<PredicateObligation<'tcx>>);
|
||||
fn register_obligations(&mut self, obligations: Vec<PredicateObligation<'tcx>>);
|
||||
|
||||
/// Creates a new universe index. Used when instantiating placeholders.
|
||||
fn create_next_universe(&mut self) -> ty::UniverseIndex;
|
||||
@ -416,7 +416,7 @@ where
|
||||
.infcx
|
||||
.handle_opaque_type(a, b, true, &cause, self.delegate.param_env())?
|
||||
.obligations;
|
||||
self.delegate.register_opaque_type_obligations(obligations);
|
||||
self.delegate.register_obligations(obligations);
|
||||
trace!(a = ?a.kind(), b = ?b.kind(), "opaque type instantiated");
|
||||
Ok(a)
|
||||
}
|
||||
@ -545,7 +545,14 @@ where
|
||||
}
|
||||
|
||||
fn mark_ambiguous(&mut self) {
|
||||
bug!()
|
||||
let cause = ObligationCause::dummy_with_span(self.delegate.span());
|
||||
let param_env = self.delegate.param_env();
|
||||
self.delegate.register_obligations(vec![Obligation::new(
|
||||
self.tcx(),
|
||||
cause,
|
||||
param_env,
|
||||
ty::Binder::dummy(ty::PredicateKind::Ambiguous),
|
||||
)]);
|
||||
}
|
||||
|
||||
#[instrument(skip(self, info), level = "trace", ret)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user