move implicit Sized
predicate to end of list
In `Bounds::predicates()`, move the implicit `Sized` predicate to the end of the generated list. This means that if there is an explicit `Sized` bound, it will be checked first, and any resulting diagnostics will have a more useful span.
This commit is contained in:
parent
485ced56b8
commit
df03b083c9
@ -64,16 +64,16 @@ impl<'tcx> Bounds<'tcx> {
|
||||
})
|
||||
});
|
||||
|
||||
sized_predicate
|
||||
.into_iter()
|
||||
.chain(self.region_bounds.iter().map(|&(region_bound, span)| {
|
||||
self.region_bounds
|
||||
.iter()
|
||||
.map(|&(region_bound, span)| {
|
||||
(
|
||||
region_bound
|
||||
.map_bound(|region_bound| ty::OutlivesPredicate(param_ty, region_bound))
|
||||
.to_predicate(tcx),
|
||||
span,
|
||||
)
|
||||
}))
|
||||
})
|
||||
.chain(self.trait_bounds.iter().map(|&(bound_trait_ref, span, constness)| {
|
||||
let predicate = bound_trait_ref.with_constness(constness).to_predicate(tcx);
|
||||
(predicate, span)
|
||||
@ -83,6 +83,7 @@ impl<'tcx> Bounds<'tcx> {
|
||||
.iter()
|
||||
.map(|&(projection, span)| (projection.to_predicate(tcx), span)),
|
||||
)
|
||||
.chain(sized_predicate.into_iter())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user