diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index d2fa72c2e3faa..b000f24efa26f 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -2994,9 +2994,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { (s, " +") } else { ( - if let GenericParamKind::Type { default: Some(default), synthetic: _ } = param.kind - { - span.data().with_hi(default.span.lo() - rustc_span::BytePos(3)) + if let GenericParamKind::Type { default: Some(_), synthetic: _ } = param.kind { + param.name.ident().span } else { span }