-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Point at source of trait bound obligations in more places #89580
Changes from all commits
6b9d910
d8a3d7d
446b466
563db42
8f433ad
9fa165d
cecbd76
55d50a9
e30e47f
d5e982d
2a2621d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2113,10 +2113,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { | |
None | ||
}, | ||
self.tcx.generics_of(owner.to_def_id()), | ||
hir.span(hir_id), | ||
) | ||
}); | ||
|
||
let span = match generics { | ||
// This is to get around the trait identity obligation, that has a `DUMMY_SP` as signal | ||
// for other diagnostics, so we need to recover it here. | ||
Some((_, _, node)) if span.is_dummy() => node, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this test be performed around the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about it, but because it is in a nested match doing that would have meant making |
||
_ => span, | ||
}; | ||
|
||
let type_param_span = match (generics, bound_kind) { | ||
(Some((_, ref generics)), GenericKind::Param(ref param)) => { | ||
(Some((_, ref generics, _)), GenericKind::Param(ref param)) => { | ||
// Account for the case where `param` corresponds to `Self`, | ||
// which doesn't have the expected type argument. | ||
if !(generics.has_self && param.index == 0) { | ||
|
@@ -2153,7 +2162,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { | |
}; | ||
let new_lt = generics | ||
.as_ref() | ||
.and_then(|(parent_g, g)| { | ||
.and_then(|(parent_g, g, _)| { | ||
let mut possible = (b'a'..=b'z').map(|c| format!("'{}", c as char)); | ||
let mut lts_names = g | ||
.params | ||
|
@@ -2175,7 +2184,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { | |
.unwrap_or("'lt".to_string()); | ||
let add_lt_sugg = generics | ||
.as_ref() | ||
.and_then(|(_, g)| g.params.first()) | ||
.and_then(|(_, g, _)| g.params.first()) | ||
.and_then(|param| param.def_id.as_local()) | ||
.map(|def_id| { | ||
( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we say something like
": ".len()
presuming I've guessed correctly as to the meaning of this 2? (Or just a comment on at least one of these).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
2
belongs to the two[
]
surrounding thecode
. There's another2
below for the": "
. Kept these magic numbers very close to their causes to try and make them obvious, but I guess they aren't?