Skip to content
5 changes: 3 additions & 2 deletions src/librustc_infer/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
terr: &TypeError<'tcx>,
) {
let span = cause.span(self.tcx);
debug!("note_type_err cause={:?} values={:?}, terr={:?}", cause, values, terr);

// For some types of errors, expected-found does not make
// sense, so just ignore the values we were given.
Expand Down Expand Up @@ -1599,11 +1600,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
self.tcx.hir().body_owner_def_id(hir::BodyId { hir_id: cause.body_id })
});
self.check_and_note_conflicting_crates(diag, terr);
self.tcx.note_and_explain_type_err(diag, terr, span, body_owner_def_id.to_def_id());
self.tcx.note_and_explain_type_err(diag, terr, cause, span, body_owner_def_id.to_def_id());

// It reads better to have the error origin as the final
// thing.
self.note_error_origin(diag, &cause, exp_found);
self.note_error_origin(diag, cause, exp_found);
}

/// When encountering a case where `.as_ref()` on a `Result` or `Option` would be appropriate,
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_middle/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ pub enum ObligationCauseCode<'tcx> {

DerivedObligation(DerivedObligationCause<'tcx>),

/// Error derived when matching traits/impls; see ObligationCause for more details
CompareImplConstObligation,

/// Error derived when matching traits/impls; see ObligationCause for more details
CompareImplMethodObligation {
item_name: ast::Name,
Expand Down
1 change: 1 addition & 0 deletions src/librustc_middle/traits/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
tcx.lift(cause).map(super::ImplDerivedObligation)
}
super::DerivedObligation(ref cause) => tcx.lift(cause).map(super::DerivedObligation),
super::CompareImplConstObligation => Some(super::CompareImplConstObligation),
super::CompareImplMethodObligation {
item_name,
impl_item_def_id,
Expand Down
Loading