|
1 | | -use rustc_errors::StashKey; |
2 | 1 | use rustc_hir::def::DefKind; |
3 | 2 | use rustc_hir::def_id::LocalDefId; |
4 | 3 | use rustc_hir::intravisit::{self, Visitor}; |
@@ -45,7 +44,7 @@ pub(super) fn find_opaque_ty_constraints_for_impl_trait_in_assoc_type( |
45 | 44 | if !hidden.ty.references_error() { |
46 | 45 | for concrete_type in locator.typeck_types { |
47 | 46 | if concrete_type.ty != tcx.erase_regions(hidden.ty) { |
48 | | - if let Ok(d) = hidden.build_mismatch_error(&concrete_type, def_id, tcx) { |
| 47 | + if let Ok(d) = hidden.build_mismatch_error(&concrete_type, tcx) { |
49 | 48 | d.emit(); |
50 | 49 | } |
51 | 50 | } |
@@ -121,7 +120,7 @@ pub(super) fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: Local |
121 | 120 | if !hidden.ty.references_error() { |
122 | 121 | for concrete_type in locator.typeck_types { |
123 | 122 | if concrete_type.ty != tcx.erase_regions(hidden.ty) { |
124 | | - if let Ok(d) = hidden.build_mismatch_error(&concrete_type, def_id, tcx) { |
| 123 | + if let Ok(d) = hidden.build_mismatch_error(&concrete_type, tcx) { |
125 | 124 | d.emit(); |
126 | 125 | } |
127 | 126 | } |
@@ -285,9 +284,8 @@ impl TaitConstraintLocator<'_> { |
285 | 284 | debug!(?concrete_type, "found constraint"); |
286 | 285 | if let Some(prev) = &mut self.found { |
287 | 286 | if concrete_type.ty != prev.ty { |
288 | | - let (Ok(guar) | Err(guar)) = prev |
289 | | - .build_mismatch_error(&concrete_type, self.def_id, self.tcx) |
290 | | - .map(|d| d.emit()); |
| 287 | + let (Ok(guar) | Err(guar)) = |
| 288 | + prev.build_mismatch_error(&concrete_type, self.tcx).map(|d| d.emit()); |
291 | 289 | prev.ty = Ty::new_error(self.tcx, guar); |
292 | 290 | } |
293 | 291 | } else { |
@@ -361,11 +359,8 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>( |
361 | 359 | ); |
362 | 360 | if let Some(prev) = &mut hir_opaque_ty { |
363 | 361 | if concrete_type.ty != prev.ty { |
364 | | - if let Ok(d) = prev.build_mismatch_error(&concrete_type, def_id, tcx) { |
365 | | - d.stash( |
366 | | - tcx.def_span(opaque_type_key.def_id), |
367 | | - StashKey::OpaqueHiddenTypeMismatch, |
368 | | - ); |
| 362 | + if let Ok(d) = prev.build_mismatch_error(&concrete_type, tcx) { |
| 363 | + d.emit(); |
369 | 364 | } |
370 | 365 | } |
371 | 366 | } else { |
@@ -435,9 +430,7 @@ impl RpitConstraintChecker<'_> { |
435 | 430 | debug!(?concrete_type, "found constraint"); |
436 | 431 |
|
437 | 432 | if concrete_type.ty != self.found.ty { |
438 | | - if let Ok(d) = |
439 | | - self.found.build_mismatch_error(&concrete_type, self.def_id, self.tcx) |
440 | | - { |
| 433 | + if let Ok(d) = self.found.build_mismatch_error(&concrete_type, self.tcx) { |
441 | 434 | d.emit(); |
442 | 435 | } |
443 | 436 | } |
|
0 commit comments