-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest changing type to const parameters if we encounter a type in the trait bound position #120570
Conversation
* Get rid of a typo in a function name * Rename `currently_processing_generics`: The old name confused me at first since I assumed it referred to generic *parameters* when it was in fact referring to generic *arguments*. Generics are typically short for generic params. * Get rid of a few unwraps by properly leveraging slice patterns
This comment was marked as outdated.
This comment was marked as outdated.
r? compiler (b-naber has been inactive for more than two months) |
caba949
to
a4a13ce
Compare
a4a13ce
to
5906237
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cool
// const generics. Of course, `Struct` and `Enum` may contain ty params, too, but the | ||
// benefits of including them here outweighs the small number of false positives. | ||
Some(Res::Def(DefKind::Struct | DefKind::Enum, _)) | ||
if self.r.tcx.features().adt_const_params => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
@bors r+ rollup |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#119543 (add avx512fp16 to x86 target features) - rust-lang#120004 (Release notes for 1.76) - rust-lang#120562 (Revert unsound libcore changes) - rust-lang#120566 (coverage: Use normal `edition:` headers in coverage tests) - rust-lang#120570 (Suggest changing type to const parameters if we encounter a type in the trait bound position) - rust-lang#120571 (Miscellaneous diagnostics cleanups) - rust-lang#120573 (Remove `BorrowckErrors::tainted_by_errors`) - rust-lang#120592 (Remove unnecessary `.to_string()`/`.as_str()`s) - rust-lang#120610 (hir: Remove the generic type parameter from `MaybeOwned`) - rust-lang#120616 (Fix ICE on field access on a tainted type after const-eval failure) Failed merges: - rust-lang#120569 (coverage: Improve handling of function/closure spans) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#119543 (add avx512fp16 to x86 target features) - rust-lang#120004 (Release notes for 1.76) - rust-lang#120562 (Revert unsound libcore changes) - rust-lang#120566 (coverage: Use normal `edition:` headers in coverage tests) - rust-lang#120570 (Suggest changing type to const parameters if we encounter a type in the trait bound position) - rust-lang#120571 (Miscellaneous diagnostics cleanups) - rust-lang#120573 (Remove `BorrowckErrors::tainted_by_errors`) - rust-lang#120592 (Remove unnecessary `.to_string()`/`.as_str()`s) - rust-lang#120610 (hir: Remove the generic type parameter from `MaybeOwned`) - rust-lang#120616 (Fix ICE on field access on a tainted type after const-eval failure) Failed merges: - rust-lang#120569 (coverage: Improve handling of function/closure spans) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#120570 - fmease:change-ty-to-ct-param-sugg, r=compiler-errors Suggest changing type to const parameters if we encounter a type in the trait bound position The first commit is just drive-by cleanup. Provide a structured suggestion if the user forgot to prefix a “const parameter” with `const`, e.g., in `struct Tagged<TAG: u64>;`. This happens to me from time to time. Maybe C++ devs are also prone to this mistake given template syntax looks like `template<typename T, uint32_t N>`.
…in-pat, r=estebank Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved Fixes rust-lang#120591. ~~Will conflict with rust-lang#120570~~ (rebased). r? estebank or compiler
…in-pat, r=estebank Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved Fixes rust-lang#120591. ~~Will conflict with rust-lang#120570~~ (rebased). r? estebank or compiler
…in-pat, r=estebank Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved Fixes rust-lang#120591. ~~Will conflict with rust-lang#120570~~ (rebased). r? estebank or compiler
Rollup merge of rust-lang#120597 - fmease:sugg-on-js-style-spread-op-in-pat, r=estebank Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved Fixes rust-lang#120591. ~~Will conflict with rust-lang#120570~~ (rebased). r? estebank or compiler
The first commit is just drive-by cleanup.
Provide a structured suggestion if the user forgot to prefix a “const parameter” with
const
, e.g., instruct Tagged<TAG: u64>;
. This happens to me from time to time. Maybe C++ devs are also prone to this mistake given template syntax looks liketemplate<typename T, uint32_t N>
.