Rollup merge of #139374 - oli-obk:const-trait-bound, r=compiler-errors

Use the span of the whole bound when the diagnostic talks about a bound

While it makes sense that the host predicate only points to the `~const` part, as whether the actual trait bound is satisfied is checked separately, the user facing diagnostic is talking about the entire trait bound, at which point it makes more sense to just highlight the entire bound

r? `@compiler-errors` or `@fee1-dead`
This commit is contained in:
Matthias Krüger 2025-04-04 21:55:00 +02:00 committed by GitHub
commit f074bbff7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 33 additions and 33 deletions

View file

@ -838,7 +838,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
| PredicateFilter::SelfOnly
| PredicateFilter::SelfAndAssociatedTypeBounds => {
match constness {
hir::BoundConstness::Always(span) => {
hir::BoundConstness::Always(_) => {
if polarity == ty::PredicatePolarity::Positive {
bounds.push((
poly_trait_ref
@ -864,7 +864,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// in `lower_assoc_item_constraint`.
PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => {
match constness {
hir::BoundConstness::Maybe(span) => {
hir::BoundConstness::Maybe(_) => {
if polarity == ty::PredicatePolarity::Positive {
bounds.push((
poly_trait_ref