Reorder fullfillment errors to keep more interesting ones first
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed` and coercion errors to the end of the list. The pre-existing deduplication logic eliminates redundant errors better that way, keeping the resulting output with fewer errors than before, while also having more detail.
This commit is contained in:
parent
2817ece19c
commit
91b9ffeab0
76 changed files with 337 additions and 431 deletions
|
@ -327,7 +327,7 @@ fn check_opaque_meets_bounds<'tcx>(
|
|||
// version.
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
let guar = infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
let guar = infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return Err(guar);
|
||||
}
|
||||
match origin {
|
||||
|
@ -1512,6 +1512,6 @@ pub(super) fn check_generator_obligations(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
let errors = fulfillment_cx.select_all_or_error(&infcx);
|
||||
debug!(?errors);
|
||||
if !errors.is_empty() {
|
||||
infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ fn compare_method_predicate_entailment<'tcx>(
|
|||
// FIXME(-Ztrait-solver=next): Not needed when the hack below is removed.
|
||||
let errors = ocx.select_where_possible();
|
||||
if !errors.is_empty() {
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return Err(reported);
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ fn compare_method_predicate_entailment<'tcx>(
|
|||
});
|
||||
}
|
||||
CheckImpliedWfMode::Skip => {
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return Err(reported);
|
||||
}
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
|||
// RPITs.
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return Err(reported);
|
||||
}
|
||||
|
||||
|
@ -2050,7 +2050,7 @@ fn compare_const_predicate_entailment<'tcx>(
|
|||
// version.
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
return Err(infcx.err_ctxt().report_fulfillment_errors(&errors));
|
||||
return Err(infcx.err_ctxt().report_fulfillment_errors(errors));
|
||||
}
|
||||
|
||||
let outlives_env = OutlivesEnvironment::new(param_env);
|
||||
|
@ -2143,7 +2143,7 @@ fn compare_type_predicate_entailment<'tcx>(
|
|||
// version.
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return Err(reported);
|
||||
}
|
||||
|
||||
|
@ -2358,7 +2358,7 @@ pub(super) fn check_type_bounds<'tcx>(
|
|||
// version.
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return Err(reported);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
|
|||
ocx.register_bound(cause, param_env, norm_return_ty, term_did);
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
error = true;
|
||||
}
|
||||
// now we can take the return type of the given main function
|
||||
|
|
|
@ -588,7 +588,7 @@ pub fn check_function_signature<'tcx>(
|
|||
Ok(()) => {
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
|
|||
|
||||
let errors = wfcx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
|
|||
}
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
}
|
||||
|
||||
// Finally, resolve all regions.
|
||||
|
@ -470,7 +470,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) -> Coe
|
|||
ocx.register_obligation(obligation);
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
}
|
||||
|
||||
// Finally, resolve all regions.
|
||||
|
|
|
@ -196,7 +196,7 @@ fn get_impl_args(
|
|||
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
let guar = ocx.infcx.err_ctxt().report_fulfillment_errors(&errors);
|
||||
let guar = ocx.infcx.err_ctxt().report_fulfillment_errors(errors);
|
||||
return Err(guar);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue