Add expansion info to implied bounds#157702
Conversation
|
HIR ty lowering was modified cc @fmease |
| | ^ 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.
There was a problem hiding this comment.
Considering N has an explicit ?Sized bound, it makes sense not to suggest turning it into a const. This is another improvement from this PR's change.
The change was intentional, that logic was checking whether there were any bounds that aren't implicit default bounds.
44d45cf to
16c1bf4
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=davidtwco,estebank |
…info, r=davidtwco,estebank Add expansion info to implied bounds r? @estebank maybe? cc @davidtwco for implied bound diagnostics We used to have various fun ways for testing whether a `Sized` bound 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 `Sized` and 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
…uwer Rollup of 10 pull requests Successful merges: - #155535 (export symbols: support macos/windows(32/64)) - #156538 (Refactor `AliasTy`. `AliasTerm` & `UnevaluatedConst` to use `Alias`) - #156807 (Add `T: PartialEq` bounds to derived `StructuralPartialEq` impls.) - #156950 (Staticlib rename internal symbols) - #157702 (Add expansion info to implied bounds) - #155616 (constify `TryFrom<Vec>` for array) - #156226 (diagnostics: point to coroutine body on higher-ranked auto trait errors) - #157873 (mips: set llvm_args -mno-check-zero-division for all mips targets) - #157953 (fix(rustc_codegen_ssa): Use cg_operand for Freeze check) - #157958 (doc: Document `-Zlint-rust-version`)
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