about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-06-03 15:27:34 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-06-30 08:04:11 +0000
commitcca072ca151d766bc9a40b82b1fc5e67ef5fee1e (patch)
treeb06cbb3cd86c2856463e07314e1ad38404d817d1 /compiler/rustc_trait_selection/src
parent215009bd0c54e261be003d30e4123df484a64656 (diff)
downloadrust-cca072ca151d766bc9a40b82b1fc5e67ef5fee1e.tar.gz
rust-cca072ca151d766bc9a40b82b1fc5e67ef5fee1e.zip
Make check_param_wf only go through the HIR in the error path
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
index 02edf482795..c72eff1d231 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
@@ -1186,7 +1186,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
         ty: Ty<'tcx>,
         obligation: &PredicateObligation<'tcx>,
     ) -> Diag<'a> {
-        let span = obligation.cause.span;
+        let param = obligation.cause.body_id;
+        let hir::GenericParamKind::Const { ty: &hir::Ty { span, .. }, .. } =
+            self.tcx.hir_node_by_def_id(param).expect_generic_param().kind
+        else {
+            bug!()
+        };
 
         let mut diag = match ty.kind() {
             ty::Float(_) => {