Review comments
This commit is contained in:
parent
83ce1aad42
commit
9cc7bd7692
@ -151,9 +151,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
if mention_capture {
|
||||
spans.push(sup_origin.span());
|
||||
}
|
||||
// We sort the spans *ignoring* expansion context. Below, the closure logic is repeated
|
||||
// because one method expects a closure taking `&Span` and the other `&mut Span`.
|
||||
spans.sort_by_key(|span| (span.lo(), span.hi()));
|
||||
// We dedup the spans *ignoring* expansion context.
|
||||
spans.sort();
|
||||
spans.dedup_by_key(|span| (span.lo(), span.hi()));
|
||||
|
||||
// We try to make the output have fewer overlapping spans if possible.
|
||||
@ -183,7 +182,9 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
err.span_note(*bound, "`'static` lifetime requirement introduced by this bound");
|
||||
}
|
||||
if let SubregionOrigin::Subtype(box TypeTrace { cause, .. }) = sub_origin {
|
||||
if let ObligationCauseCode::BlockTailExpression(hir_id) = &cause.code {
|
||||
if let ObligationCauseCode::ReturnValue(hir_id)
|
||||
| ObligationCauseCode::BlockTailExpression(hir_id) = &cause.code
|
||||
{
|
||||
let parent_id = tcx.hir().get_parent_item(*hir_id);
|
||||
if let Some(fn_decl) = tcx.hir().fn_decl_by_hir_id(parent_id) {
|
||||
let mut span: MultiSpan = fn_decl.output.span().into();
|
||||
|
@ -97,7 +97,7 @@ pub enum RegionResolutionError<'tcx> {
|
||||
Region<'tcx>,
|
||||
SubregionOrigin<'tcx>,
|
||||
Region<'tcx>,
|
||||
Vec<Span>,
|
||||
Vec<Span>, // All the influences on a given value that didn't meet its constraints.
|
||||
),
|
||||
|
||||
/// Indicates a `'b: 'a` constraint where `'a` is in a universe that
|
||||
@ -570,9 +570,10 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
||||
// have to revisit this portion of the code and
|
||||
// think hard about it. =) -- nikomatsakis
|
||||
|
||||
// Obtain the spans for all the capture points for
|
||||
// Obtain the spans for all the places that can
|
||||
// influence the constraints on this value for
|
||||
// richer diagnostics in `static_impl_trait`.
|
||||
let captures: Vec<Span> = self
|
||||
let influences: Vec<Span> = self
|
||||
.data
|
||||
.constraints
|
||||
.iter()
|
||||
@ -590,7 +591,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
||||
&mut dup_vec,
|
||||
node_vid,
|
||||
errors,
|
||||
captures,
|
||||
influences,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -645,7 +646,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
||||
dup_vec: &mut IndexVec<RegionVid, Option<RegionVid>>,
|
||||
node_idx: RegionVid,
|
||||
errors: &mut Vec<RegionResolutionError<'tcx>>,
|
||||
captures: Vec<Span>,
|
||||
influences: Vec<Span>,
|
||||
) {
|
||||
// Errors in expanding nodes result from a lower-bound that is
|
||||
// not contained by an upper-bound.
|
||||
@ -700,7 +701,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
||||
lower_bound.region,
|
||||
upper_bound.origin.clone(),
|
||||
upper_bound.region,
|
||||
captures,
|
||||
influences,
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user