Get rid of some sub_exp and eq_exp
This commit is contained in:
parent
801dd1d061
commit
61daee66a8
12 changed files with 48 additions and 60 deletions
|
@ -904,7 +904,6 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
&ObligationCause::dummy(),
|
||||
param_env,
|
||||
hidden_ty,
|
||||
true,
|
||||
&mut obligations,
|
||||
)?;
|
||||
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
|
||||
|
|
|
@ -116,24 +116,6 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
|
|||
self.infcx.at(cause, param_env).deeply_normalize(value, &mut **self.engine.borrow_mut())
|
||||
}
|
||||
|
||||
/// Makes `expected <: actual`.
|
||||
pub fn eq_exp<T>(
|
||||
&self,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
a_is_expected: bool,
|
||||
a: T,
|
||||
b: T,
|
||||
) -> Result<(), TypeError<'tcx>>
|
||||
where
|
||||
T: ToTrace<'tcx>,
|
||||
{
|
||||
self.infcx
|
||||
.at(cause, param_env)
|
||||
.eq_exp(DefineOpaqueTypes::Yes, a_is_expected, a, b)
|
||||
.map(|infer_ok| self.register_infer_ok_obligations(infer_ok))
|
||||
}
|
||||
|
||||
pub fn eq<T: ToTrace<'tcx>>(
|
||||
&self,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
|
|
|
@ -1528,6 +1528,12 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
| ObligationCauseCode::Coercion { .. }
|
||||
);
|
||||
|
||||
let (expected, actual) = if is_normalized_term_expected {
|
||||
(normalized_term, data.term)
|
||||
} else {
|
||||
(data.term, normalized_term)
|
||||
};
|
||||
|
||||
// constrain inference variables a bit more to nested obligations from normalize so
|
||||
// we can have more helpful errors.
|
||||
//
|
||||
|
@ -1535,12 +1541,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
// since the normalization is just done to improve the error message.
|
||||
let _ = ocx.select_where_possible();
|
||||
|
||||
if let Err(new_err) = ocx.eq_exp(
|
||||
if let Err(new_err) = ocx.eq(
|
||||
&obligation.cause,
|
||||
obligation.param_env,
|
||||
is_normalized_term_expected,
|
||||
normalized_term,
|
||||
data.term,
|
||||
expected,
|
||||
actual,
|
||||
) {
|
||||
(Some((data, is_normalized_term_expected, normalized_term, data.term)), new_err)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue