Add expansion info to implied bounds#157702
Conversation
|
HIR ty lowering was modified cc @fmease |
| RangeExpr, | ||
| /// Implicit `Sized` or `MetaSized` bounds. The actual source location points to just the | ||
| /// param or item for which the implicit bound was generated. | ||
| ImpliedBound { |
There was a problem hiding this comment.
I don't know that ImpliedBound is the most intuitive name for this - maybe DefaultBound instead? I think of things like the Sized bound on T: ?Sized + Clone as implied, rather than the default bound, which isn't really implied by anything other than the language rules. I guess we call it ImpliedBound in other places here like with ImpliedBoundsContext. Feel free to ignore this comment if you'd like.
| | ^ unused type parameter | ||
| | | ||
| = help: consider removing `N` or referring to it in the body of the type alias | ||
| = help: if you intended `N` to be a const parameter, use `const N: /* Type */` instead |
There was a problem hiding this comment.
Interesting to see this go away, didn't really catch which change caused that.
There was a problem hiding this comment.
It's odd given that check_type_alias_type_params_are_used was indeed updated to no longer use the old "bound.span == param.span" check.
r? @estebank maybe?
cc @davidtwco for implied bound diagnostics
We used to have various fun ways for testing whether a
Sizedbound was implicit or not (usually by checking if the span was equal to the span of a generic parameter). That felt a bit hacky, so I checked what happens if we explicitly mark the span as being desugared. Turns out a lot of diagnostics break. You can see in the diff where I changed things to make them work again.Then it became clear that we were missing out on various other implied bound sites, and we just got all of them basically for free now.
I think there are various other good refactorings we can do (probably not special casing
Sizedand not special casing implied bound desugarings, but just reporting all desugarings), but for now this PR is in a state where I'd rather merge it than add more to it