|
2 | 2 |
|
3 | 3 | use rustc_errors::ErrorGuaranteed; |
4 | 4 | use rustc_hir as hir; |
5 | | -use rustc_hir::def::Res; |
| 5 | +use rustc_hir::def::{Namespace, Res}; |
6 | 6 | use rustc_hir::def_id::DefId; |
7 | 7 | use rustc_hir::intravisit::Visitor; |
8 | 8 | use rustc_middle::hir::nested_filter; |
9 | 9 | use rustc_middle::traits::ObligationCauseCode; |
10 | 10 | use rustc_middle::ty::error::ExpectedFound; |
11 | 11 | use rustc_middle::ty::print::RegionHighlightMode; |
12 | | -use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitable}; |
| 12 | +use rustc_middle::ty::{self, TyCtxt, TypeVisitable}; |
13 | 13 | use rustc_span::Span; |
14 | 14 | use tracing::debug; |
15 | 15 |
|
16 | 16 | use crate::error_reporting::infer::nice_region_error::NiceRegionError; |
| 17 | +use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted; |
17 | 18 | use crate::errors::{ConsiderBorrowingParamHelp, RelationshipHelp, TraitImplDiff}; |
18 | 19 | use crate::infer::{RegionResolutionError, Subtype, ValuePairs}; |
19 | 20 |
|
@@ -81,18 +82,17 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { |
81 | 82 |
|
82 | 83 | let expected_highlight = HighlightBuilder::build(expected); |
83 | 84 | let tcx = self.cx.tcx; |
84 | | - let expected = self |
85 | | - .cx |
86 | | - .extract_inference_diagnostics_data( |
87 | | - Ty::new_fn_ptr(tcx, expected).into(), |
88 | | - expected_highlight, |
89 | | - ) |
90 | | - .name; |
| 85 | + let expected = Highlighted { |
| 86 | + highlight: expected_highlight, |
| 87 | + ns: Namespace::TypeNS, |
| 88 | + tcx, |
| 89 | + value: expected, |
| 90 | + } |
| 91 | + .to_string(); |
91 | 92 | let found_highlight = HighlightBuilder::build(found); |
92 | | - let found = self |
93 | | - .cx |
94 | | - .extract_inference_diagnostics_data(Ty::new_fn_ptr(tcx, found).into(), found_highlight) |
95 | | - .name; |
| 93 | + let found = |
| 94 | + Highlighted { highlight: found_highlight, ns: Namespace::TypeNS, tcx, value: found } |
| 95 | + .to_string(); |
96 | 96 |
|
97 | 97 | // Get the span of all the used type parameters in the method. |
98 | 98 | let assoc_item = self.tcx().associated_item(trait_item_def_id); |
|
0 commit comments