Store a LocalDefId in hir::GenericParam.
This commit is contained in:
@@ -2619,11 +2619,10 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
let Some(param) = generics.params.iter().find(|param| param.span == span) else {
|
||||
return;
|
||||
};
|
||||
let param_def_id = self.tcx.hir().local_def_id(param.hir_id);
|
||||
// Check that none of the explicit trait bounds is `Sized`. Assume that an explicit
|
||||
// `Sized` bound is there intentionally and we don't need to suggest relaxing it.
|
||||
let explicitly_sized = generics
|
||||
.bounds_for_param(param_def_id)
|
||||
.bounds_for_param(param.def_id)
|
||||
.flat_map(|bp| bp.bounds)
|
||||
.any(|bound| bound.trait_ref().and_then(|tr| tr.trait_def_id()) == sized_trait);
|
||||
if explicitly_sized {
|
||||
@@ -2646,7 +2645,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
_ => {}
|
||||
};
|
||||
// Didn't add an indirection suggestion, so add a general suggestion to relax `Sized`.
|
||||
let (span, separator) = if let Some(s) = generics.bounds_span_for_suggestions(param_def_id)
|
||||
let (span, separator) = if let Some(s) = generics.bounds_span_for_suggestions(param.def_id)
|
||||
{
|
||||
(s, " +")
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user