about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2024-12-16 15:38:32 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2024-12-16 16:02:05 +0000
commit1d834c2257f0ff9a7d1dbf9212909b7335e3d0ce (patch)
treecc49f5a980c2cdb6c3853330c265a77765d9f4b9
parent1c7d54eb7bb79ebe8223ee4d292c6e091e4ac8c0 (diff)
downloadrust-1d834c2257f0ff9a7d1dbf9212909b7335e3d0ce.tar.gz
rust-1d834c2257f0ff9a7d1dbf9212909b7335e3d0ce.zip
Avoid wrapping fn sig in a fn pointer when we want to just print the sig
-rw-r--r--compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs
index 26334d53f43..95dd1b28a39 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs
@@ -2,18 +2,19 @@
 
 use rustc_errors::ErrorGuaranteed;
 use rustc_hir as hir;
-use rustc_hir::def::Res;
+use rustc_hir::def::{Namespace, Res};
 use rustc_hir::def_id::DefId;
 use rustc_hir::intravisit::Visitor;
 use rustc_middle::hir::nested_filter;
 use rustc_middle::traits::ObligationCauseCode;
 use rustc_middle::ty::error::ExpectedFound;
 use rustc_middle::ty::print::RegionHighlightMode;
-use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitable};
+use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
 use rustc_span::Span;
 use tracing::debug;
 
 use crate::error_reporting::infer::nice_region_error::NiceRegionError;
+use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted;
 use crate::errors::{ConsiderBorrowingParamHelp, RelationshipHelp, TraitImplDiff};
 use crate::infer::{RegionResolutionError, Subtype, ValuePairs};
 
@@ -81,18 +82,17 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
 
         let expected_highlight = HighlightBuilder::build(expected);
         let tcx = self.cx.tcx;
-        let expected = self
-            .cx
-            .extract_inference_diagnostics_data(
-                Ty::new_fn_ptr(tcx, expected).into(),
-                expected_highlight,
-            )
-            .name;
+        let expected = Highlighted {
+            highlight: expected_highlight,
+            ns: Namespace::TypeNS,
+            tcx,
+            value: expected,
+        }
+        .to_string();
         let found_highlight = HighlightBuilder::build(found);
-        let found = self
-            .cx
-            .extract_inference_diagnostics_data(Ty::new_fn_ptr(tcx, found).into(), found_highlight)
-            .name;
+        let found =
+            Highlighted { highlight: found_highlight, ns: Namespace::TypeNS, tcx, value: found }
+                .to_string();
 
         // Get the span of all the used type parameters in the method.
         let assoc_item = self.tcx().associated_item(trait_item_def_id);