diagnostics: suggest generic_const_args for const ops#156968
Conversation
|
HIR ty lowering was modified cc @fmease |
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use Why was this reviewer chosen?The reviewer was selected based on:
|
a43c40b to
d890018
Compare
This comment has been minimized.
This comment has been minimized.
d890018 to
f883d0e
Compare
This comment has been minimized.
This comment has been minimized.
f883d0e to
a9b91d1
Compare
This comment has been minimized.
This comment has been minimized.
|
@wesleywiser, hi! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c02ce98 to
bf4bad2
Compare
generic_const_args + type const items in const operation diagnostics|
@rustbot reroll |
|
@bors r+ |
|
This pull request was unapproved. This PR was contained in a rollup (#158909), which was unapproved. |
bf4bad2 to
7958796
Compare
This comment has been minimized.
This comment has been minimized.
|
@JonathanBrouwer @petrochenkov i pushed a fix for the rollup failure from the i rebased the pr on current imo this was just a stale ui fixture after the rollup picked up a newer test from main. the compiler output looked right to me, the expected stderr was the part that was out of date. i also ran could one of you re-trigger the failed job / try job for that same builder? i don't have permission to do it from here. ltm if you want anything else changed. |
|
This soft conflicts with #158617 which is in the current rollup, please rebase on that after it's merged |
…stics Point users at `#![feature(generic_const_args)]` and `type const` items when they hit the "generic parameters may not be used in const operations" error, not just `generic_const_exprs`.
7958796 to
c394716
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. |
This comment has been minimized.
This comment has been minimized.
c394716 to
382f1a0
Compare
This comment has been minimized.
This comment has been minimized.
382f1a0 to
9211a89
Compare
Hi, @JonathanBrouwer! |
|
@bors r=petrochenkov rollup=iffy |
…gnostic-156729, r=petrochenkov diagnostics: suggest generic_const_args for const ops fixes rust-lang#156729 when const ops hit generic params, like `[u8; size_of::<self>()]`, the diagnostic only points at `generic_const_exprs`. imo that's a stale nudge now that `generic_const_args` and `type const` items are the path we want people trying. add help for `generic_const_args` and `type const` items in the resolve and hir_ty_lowering paths. also skip the old gce suggestion once `min_generic_const_args` is enabled, and emit both suggestions for the `self` alias path so the "alternatively" wording doesn't hang there by itself. includes the regression test from the issue. lgtm.
…uwer Rollup of 8 pull requests Successful merges: - #159126 (Fix PR number in bootstrap's change tracker) - #156968 (diagnostics: suggest generic_const_args for const ops) - #159012 (Shrink mir::Statement to 40 bytes) - #158182 (std: use `OnceLock` for SGX argument storage) - #159114 (Add regression test for $-prefixed fragment specifier in repetition) - #159060 (Look for the cdb architecture that corresponds to the target triple) - #159089 (riscv: update c-variadic test for LLVM changes) - #159093 (pretty-print: use inline asm's actual macro name)
…uwer Rollup of 8 pull requests Successful merges: - #159126 (Fix PR number in bootstrap's change tracker) - #156968 (diagnostics: suggest generic_const_args for const ops) - #159012 (Shrink mir::Statement to 40 bytes) - #158182 (std: use `OnceLock` for SGX argument storage) - #159114 (Add regression test for $-prefixed fragment specifier in repetition) - #159060 (Look for the cdb architecture that corresponds to the target triple) - #159089 (riscv: update c-variadic test for LLVM changes) - #159093 (pretty-print: use inline asm's actual macro name)
…uwer Rollup of 14 pull requests Successful merges: - #159126 (Fix PR number in bootstrap's change tracker) - #155811 (Include AtomicU128/AtomicI128 in docs for any target) - #156968 (diagnostics: suggest generic_const_args for const ops) - #159012 (Shrink mir::Statement to 40 bytes) - #156618 (rustdoc: test ignoring rustc lints in CLI) - #158182 (std: use `OnceLock` for SGX argument storage) - #159114 (Add regression test for $-prefixed fragment specifier in repetition) - #158523 (Fix feature gate for `repr(simd)`) - #158876 (Fix multiple logic bugs in `Arc::make_mut`) - #158928 (std: fix Xous UDP send_to length mismatch and truncation) - #159060 (Look for the cdb architecture that corresponds to the target triple) - #159089 (riscv: update c-variadic test for LLVM changes) - #159093 (pretty-print: use inline asm's actual macro name) - #159122 (doc: use ptr::addr in offset_from docs) Failed merges: - #158732 (Apply MCP 1003 and move diagnostics.rs into its own module)
Rollup merge of #156968 - Dnreikronos:fix/gca-const-item-diagnostic-156729, r=petrochenkov diagnostics: suggest generic_const_args for const ops fixes #156729 when const ops hit generic params, like `[u8; size_of::<self>()]`, the diagnostic only points at `generic_const_exprs`. imo that's a stale nudge now that `generic_const_args` and `type const` items are the path we want people trying. add help for `generic_const_args` and `type const` items in the resolve and hir_ty_lowering paths. also skip the old gce suggestion once `min_generic_const_args` is enabled, and emit both suggestions for the `self` alias path so the "alternatively" wording doesn't hang there by itself. includes the regression test from the issue. lgtm.
View all comments
fixes #156729
when const ops hit generic params, like
[u8; size_of::<self>()], the diagnostic only points atgeneric_const_exprs. imo that's a stale nudge now thatgeneric_const_argsandtype constitems are the path we want people trying.add help for
generic_const_argsandtype constitems in the resolve and hir_ty_lowering paths. also skip the old gce suggestion oncemin_generic_const_argsis enabled, and emit both suggestions for theselfalias path so the "alternatively" wording doesn't hang there by itself. includes the regression test from the issue. lgtm.