Skip to content

Commit e4622e0

Browse files
committed
report_mismatch did not actually report anymore
1 parent e3021eb commit e4622e0

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
154154
if prev.ty != ty {
155155
let guar = ty.error_reported().err().unwrap_or_else(|| {
156156
let (Ok(e) | Err(e)) = prev
157-
.report_mismatch(
157+
.build_mismatch_error(
158158
&OpaqueHiddenType { ty, span: concrete_type.span },
159159
opaque_type_key.def_id,
160160
infcx.tcx,

compiler/rustc_hir_analysis/src/check/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ fn sanity_check_found_hidden_type<'tcx>(
478478
} else {
479479
let span = tcx.def_span(key.def_id);
480480
let other = ty::OpaqueHiddenType { ty: hidden_ty, span };
481-
Err(ty.report_mismatch(&other, key.def_id, tcx)?.emit())
481+
Err(ty.build_mismatch_error(&other, key.def_id, tcx)?.emit())
482482
}
483483
}
484484

compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(super) fn find_opaque_ty_constraints_for_impl_trait_in_assoc_type(
5959
if !hidden.ty.references_error() {
6060
for concrete_type in locator.typeck_types {
6161
if concrete_type.ty != tcx.erase_regions(hidden.ty) {
62-
if let Ok(d) = hidden.report_mismatch(&concrete_type, def_id, tcx) {
62+
if let Ok(d) = hidden.build_mismatch_error(&concrete_type, def_id, tcx) {
6363
d.emit();
6464
}
6565
}
@@ -135,7 +135,7 @@ pub(super) fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: Local
135135
if !hidden.ty.references_error() {
136136
for concrete_type in locator.typeck_types {
137137
if concrete_type.ty != tcx.erase_regions(hidden.ty) {
138-
if let Ok(d) = hidden.report_mismatch(&concrete_type, def_id, tcx) {
138+
if let Ok(d) = hidden.build_mismatch_error(&concrete_type, def_id, tcx) {
139139
d.emit();
140140
}
141141
}
@@ -289,7 +289,7 @@ impl TaitConstraintLocator<'_> {
289289
if let Some(prev) = &mut self.found {
290290
if concrete_type.ty != prev.ty {
291291
let (Ok(guar) | Err(guar)) = prev
292-
.report_mismatch(&concrete_type, self.def_id, self.tcx)
292+
.build_mismatch_error(&concrete_type, self.def_id, self.tcx)
293293
.map(|d| d.emit());
294294
prev.ty = Ty::new_error(self.tcx, guar);
295295
}
@@ -364,7 +364,7 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>(
364364
);
365365
if let Some(prev) = &mut hir_opaque_ty {
366366
if concrete_type.ty != prev.ty {
367-
if let Ok(d) = prev.report_mismatch(&concrete_type, def_id, tcx) {
367+
if let Ok(d) = prev.build_mismatch_error(&concrete_type, def_id, tcx) {
368368
d.stash(
369369
tcx.def_span(opaque_type_key.def_id),
370370
StashKey::OpaqueHiddenTypeMismatch,
@@ -441,7 +441,9 @@ impl RpitConstraintChecker<'_> {
441441
debug!(?concrete_type, "found constraint");
442442

443443
if concrete_type.ty != self.found.ty {
444-
if let Ok(d) = self.found.report_mismatch(&concrete_type, self.def_id, self.tcx) {
444+
if let Ok(d) =
445+
self.found.build_mismatch_error(&concrete_type, self.def_id, self.tcx)
446+
{
445447
d.emit();
446448
}
447449
}

compiler/rustc_hir_typeck/src/writeback.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,11 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
589589
&& last_opaque_ty.ty != hidden_type.ty
590590
{
591591
assert!(!self.fcx.next_trait_solver());
592-
if let Ok(d) =
593-
hidden_type.report_mismatch(&last_opaque_ty, opaque_type_key.def_id, self.tcx())
594-
{
592+
if let Ok(d) = hidden_type.build_mismatch_error(
593+
&last_opaque_ty,
594+
opaque_type_key.def_id,
595+
self.tcx(),
596+
) {
595597
d.stash(
596598
self.tcx().def_span(opaque_type_key.def_id),
597599
StashKey::OpaqueHiddenTypeMismatch,

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ pub struct OpaqueHiddenType<'tcx> {
840840
}
841841

842842
impl<'tcx> OpaqueHiddenType<'tcx> {
843-
pub fn report_mismatch(
843+
pub fn build_mismatch_error(
844844
&self,
845845
other: &Self,
846846
opaque_def_id: LocalDefId,

0 commit comments

Comments
 (0)