Skip to content

Commit 1d834c2

Browse files
committed
Avoid wrapping fn sig in a fn pointer when we want to just print the sig
1 parent 1c7d54e commit 1d834c2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
33
use rustc_errors::ErrorGuaranteed;
44
use rustc_hir as hir;
5-
use rustc_hir::def::Res;
5+
use rustc_hir::def::{Namespace, Res};
66
use rustc_hir::def_id::DefId;
77
use rustc_hir::intravisit::Visitor;
88
use rustc_middle::hir::nested_filter;
99
use rustc_middle::traits::ObligationCauseCode;
1010
use rustc_middle::ty::error::ExpectedFound;
1111
use rustc_middle::ty::print::RegionHighlightMode;
12-
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitable};
12+
use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
1313
use rustc_span::Span;
1414
use tracing::debug;
1515

1616
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
17+
use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted;
1718
use crate::errors::{ConsiderBorrowingParamHelp, RelationshipHelp, TraitImplDiff};
1819
use crate::infer::{RegionResolutionError, Subtype, ValuePairs};
1920

@@ -81,18 +82,17 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
8182

8283
let expected_highlight = HighlightBuilder::build(expected);
8384
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();
9192
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();
9696

9797
// Get the span of all the used type parameters in the method.
9898
let assoc_item = self.tcx().associated_item(trait_item_def_id);

0 commit comments

Comments
 (0)