Skip to content

Commit bc345d7

Browse files
Move fallback_has_occurred to FnCtxt
1 parent e6fead4 commit bc345d7

File tree

21 files changed

+52
-64
lines changed

21 files changed

+52
-64
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
299299
if errors.is_empty() {
300300
definition_ty
301301
} else {
302-
infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
302+
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
303303
self.tcx.ty_error()
304304
}
305305
}

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
765765

766766
let errors = ocx.select_all_or_error();
767767
if !errors.is_empty() {
768-
infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
768+
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
769769
}
770770
}
771771

@@ -831,7 +831,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
831831
obligation.clone(),
832832
&obligation,
833833
&e,
834-
false,
835834
);
836835
}
837836

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ fn check_opaque_meets_bounds<'tcx>(
471471
// version.
472472
let errors = ocx.select_all_or_error();
473473
if !errors.is_empty() {
474-
infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
474+
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
475475
}
476476
match origin {
477477
// Checked when type checking the function containing them.

compiler/rustc_hir_analysis/src/check/compare_method.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ fn compare_predicate_entailment<'tcx>(
405405
// version.
406406
let errors = ocx.select_all_or_error();
407407
if !errors.is_empty() {
408-
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
408+
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
409409
return Err(reported);
410410
}
411411

@@ -538,7 +538,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
538538
// RPITs.
539539
let errors = ocx.select_all_or_error();
540540
if !errors.is_empty() {
541-
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
541+
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
542542
return Err(reported);
543543
}
544544

@@ -1431,7 +1431,7 @@ pub(crate) fn raw_compare_const_impl<'tcx>(
14311431
// version.
14321432
let errors = ocx.select_all_or_error();
14331433
if !errors.is_empty() {
1434-
return Err(infcx.err_ctxt().report_fulfillment_errors(&errors, None, false));
1434+
return Err(infcx.err_ctxt().report_fulfillment_errors(&errors, None));
14351435
}
14361436

14371437
// FIXME return `ErrorReported` if region obligations error?
@@ -1549,7 +1549,7 @@ fn compare_type_predicate_entailment<'tcx>(
15491549
// version.
15501550
let errors = ocx.select_all_or_error();
15511551
if !errors.is_empty() {
1552-
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
1552+
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
15531553
return Err(reported);
15541554
}
15551555

@@ -1769,7 +1769,7 @@ pub fn check_type_bounds<'tcx>(
17691769
// version.
17701770
let errors = ocx.select_all_or_error();
17711771
if !errors.is_empty() {
1772-
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
1772+
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
17731773
return Err(reported);
17741774
}
17751775

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
104104
f(&mut wfcx);
105105
let errors = wfcx.select_all_or_error();
106106
if !errors.is_empty() {
107-
infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
107+
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
108108
return;
109109
}
110110

compiler/rustc_hir_analysis/src/coherence/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx>, impl_did:
321321
}),
322322
);
323323
if !errors.is_empty() {
324-
infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
324+
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
325325
}
326326

327327
// Finally, resolve all regions.
@@ -561,7 +561,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
561561
predicate_for_trait_def(tcx, param_env, cause, trait_def_id, 0, source, &[target.into()]);
562562
let errors = traits::fully_solve_obligation(&infcx, predicate);
563563
if !errors.is_empty() {
564-
infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
564+
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
565565
}
566566

567567
// Finally, resolve all regions.

compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ fn get_impl_substs<'tcx>(
155155

156156
let errors = ocx.select_all_or_error();
157157
if !errors.is_empty() {
158-
ocx.infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
158+
ocx.infcx.err_ctxt().report_fulfillment_errors(&errors, None);
159159
return None;
160160
}
161161

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ fn require_same_types<'tcx>(
173173
match &errors[..] {
174174
[] => true,
175175
errors => {
176-
infcx.err_ctxt().report_fulfillment_errors(errors, None, false);
176+
infcx.err_ctxt().report_fulfillment_errors(errors, None);
177177
false
178178
}
179179
}
@@ -336,7 +336,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
336336
ocx.register_bound(cause, param_env, norm_return_ty, term_did);
337337
let errors = ocx.select_all_or_error();
338338
if !errors.is_empty() {
339-
infcx.err_ctxt().report_fulfillment_errors(&errors, None, false);
339+
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
340340
error = true;
341341
}
342342
// now we can take the return type of the given main function

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,12 +705,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
705705

706706
// Object safety violations or miscellaneous.
707707
Err(err) => {
708-
self.err_ctxt().report_selection_error(
709-
obligation.clone(),
710-
&obligation,
711-
&err,
712-
false,
713-
);
708+
self.err_ctxt().report_selection_error(obligation.clone(), &obligation, &err);
714709
// Treat this like an obligation and follow through
715710
// with the unsizing - the lack of a coercion should
716711
// be silent, as it causes a type mismatch later.

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
843843
{
844844
// Point any obligations that were registered due to opaque type
845845
// inference at the return expression.
846-
self.select_obligations_where_possible(false, |errors| {
846+
self.select_obligations_where_possible(|errors| {
847847
self.point_at_return_for_opaque_ty_error(errors, span, return_expr_ty);
848848
});
849849
}
@@ -2738,7 +2738,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
27382738
Some((index_ty, element_ty)) => {
27392739
// two-phase not needed because index_ty is never mutable
27402740
self.demand_coerce(idx, idx_t, index_ty, None, AllowTwoPhase::No);
2741-
self.select_obligations_where_possible(false, |errors| {
2741+
self.select_obligations_where_possible(|errors| {
27422742
self.point_at_index_if_possible(errors, idx.span)
27432743
});
27442744
element_ty

0 commit comments

Comments
 (0)