Add cycle errors to ScrubbedTraitError to remove a couple more calls to new_with_diagnostics
This commit is contained in:
@@ -9,8 +9,8 @@ use rustc_middle::traits::CodegenObligationError;
|
||||
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
|
||||
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt;
|
||||
use rustc_trait_selection::traits::{
|
||||
FulfillmentErrorCode, ImplSource, Obligation, ObligationCause, ObligationCtxt,
|
||||
SelectionContext, Unimplemented,
|
||||
ImplSource, Obligation, ObligationCause, ObligationCtxt, ScrubbedTraitError, SelectionContext,
|
||||
Unimplemented,
|
||||
};
|
||||
use tracing::debug;
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn codegen_select_candidate<'tcx>(
|
||||
// all nested obligations. This is because they can inform the
|
||||
// inference of the impl's type parameters.
|
||||
// FIXME(-Znext-solver): Doesn't need diagnostics if new solver.
|
||||
let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
|
||||
let ocx = ObligationCtxt::new(&infcx);
|
||||
let impl_source = selection.map(|obligation| {
|
||||
ocx.register_obligation(obligation);
|
||||
});
|
||||
@@ -65,7 +65,7 @@ pub fn codegen_select_candidate<'tcx>(
|
||||
// Cycle errors are the only post-monomorphization errors possible; emit them now so
|
||||
// `rustc_ty_utils::resolve_associated_item` doesn't return `None` post-monomorphization.
|
||||
for err in errors {
|
||||
if let FulfillmentErrorCode::Cycle(cycle) = err.code {
|
||||
if let ScrubbedTraitError::Cycle(cycle) = err {
|
||||
infcx.err_ctxt().report_overflow_obligation_cycle(&cycle);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user