Conversation
Collaborator
|
HIR ty lowering was modified cc @fmease |
Collaborator
|
|
Member
Author
BoxyUwU
approved these changes
Sep 16, 2026
| tcx.require_lang_item(LangItem::ConstParamTy, span), | ||
| ); | ||
| } | ||
| if !tcx.features().generic_const_parameter_types() && item_ty.has_param() { |
Member
There was a problem hiding this comment.
can you add a FIXME about how we might want to move this to type_of so we can return Error from type_of if it references invalid params
Member
Author
There was a problem hiding this comment.
// FIXME(min_generic_const_args): We *might* want to move this check to `type_of`, so we can
// return `ty::Error` if it references invalid params. However, doing so is hard, because
// `type_of` doesn't know if it's a direct const - `const_of_item` determines that, and
// `const_of_item` calls `type_of`.
khyperia
force-pushed
the
ConstParamTy-check
branch
from
September 16, 2026 10:20
defba82 to
9dce1fc
Compare
Member
Author
|
@bors r=BoxyUwU rollup |
Contributor
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 17, 2026
…yUwU reintroduce check RibKind::ConstParamTy did in direct consts The ConstParamTy nameres rib checks were never implemented for `gca!`-rhs direct consts. So, when `type const` got removed in rust-lang#162517 and we now only have `gca!`-rhs direct consts, the lack of checks became very apparent This PR adds the check again for `gca!`-rhs direct consts. When implementing this and updating `tests/ui/const-generics/mgca/type_const-generic-param-in-type.rs`, I ran into rust-lang#160553 which caused a glaringly obvious issue - the following succeeds compilation: ```rust #![feature(min_generic_const_args, generic_const_items, generic_const_parameter_types)] const BAR<const N: usize>: [(); N] = core::direct_const_arg!([]); ``` This is already tracked in `tests/crashes/160553.rs` so I have not added a test for it. This is the reason I changed the test from `[(); N]` to `StructWithConstParam<const N: usize>`, the RHS has to, like, y'know, actually typecheck :P r? @BoxyUwU
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 17, 2026
Rollup of 16 pull requests Successful merges: - #161596 (coretests: Add more pattern tests.) - #162796 (libtest: do not early exit from test runners) - #162844 (Add loan reachability traces to polonius MIR dumps) - #162876 (Move operations out of `rustc_middle::query::job`) - #160108 (Stabilize `windows_process_extensions_main_thread_handle`) - #160212 (traits: Fix rigid alias liveness matching) - #160544 (Stabilize `feature(trim_prefix_suffix)` (`{str, [T], Path}::trim_prefix` and `{str, [T]}::trim_suffix`)) - #161246 (Normalize non-rigid aliases in ty_known_to_outlive) - #161305 (Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha) - #161838 (tests: accept LLVM 24 optimization in this test) - #162805 (Add `must_use` lint to `ExitCode`) - #162825 (core: Add examples for `debug_closure_helpers`) - #162841 (enable asm tests for xtensa targets) - #162842 (reintroduce check RibKind::ConstParamTy did in direct consts) - #162845 (mgca: fix issue with mismatched array valtree/valtree tys) - #162856 (Stabilize CommandExt::show_window)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 17, 2026
…yUwU reintroduce check RibKind::ConstParamTy did in direct consts The ConstParamTy nameres rib checks were never implemented for `gca!`-rhs direct consts. So, when `type const` got removed in rust-lang#162517 and we now only have `gca!`-rhs direct consts, the lack of checks became very apparent This PR adds the check again for `gca!`-rhs direct consts. When implementing this and updating `tests/ui/const-generics/mgca/type_const-generic-param-in-type.rs`, I ran into rust-lang#160553 which caused a glaringly obvious issue - the following succeeds compilation: ```rust #![feature(min_generic_const_args, generic_const_items, generic_const_parameter_types)] const BAR<const N: usize>: [(); N] = core::direct_const_arg!([]); ``` This is already tracked in `tests/crashes/160553.rs` so I have not added a test for it. This is the reason I changed the test from `[(); N]` to `StructWithConstParam<const N: usize>`, the RHS has to, like, y'know, actually typecheck :P r? @BoxyUwU
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 17, 2026
…uwer Rollup of 24 pull requests Successful merges: - #161596 (coretests: Add more pattern tests.) - #162177 (Properly implement the gpu-kernel ABI for amdgpu) - #162411 (Make Receiver `#[rustc_dyn_incompatible_trait]`) - #162760 (yeet alias new_from_def_id) - #162796 (libtest: do not early exit from test runners) - #162844 (Add loan reachability traces to polonius MIR dumps) - #162876 (Move operations out of `rustc_middle::query::job`) - #160108 (Stabilize `windows_process_extensions_main_thread_handle`) - #160212 (traits: Fix rigid alias liveness matching) - #160544 (Stabilize `feature(trim_prefix_suffix)` (`{str, [T], Path}::trim_prefix` and `{str, [T]}::trim_suffix`)) - #161305 (Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha) - #161838 (tests: accept LLVM 24 optimization in this test) - #162312 (core: Rewrite docs for try_as_dyn) - #162785 (Avoid creating overlapping assignments in MatchBranchSimplification) - #162805 (Add `must_use` lint to `ExitCode`) - #162825 (core: Add examples for `debug_closure_helpers`) - #162841 (enable asm tests for xtensa targets) - #162842 (reintroduce check RibKind::ConstParamTy did in direct consts) - #162845 (mgca: fix issue with mismatched array valtree/valtree tys) - #162856 (Stabilize CommandExt::show_window) - #162865 (Complex conjugate, negation and default) - #162874 (Add support for `annotate_snippets::snippet::AnnotationKind::Visible`) - #162881 (Simplify the macro for forwarding Decoder methods ) - #162888 (Fix a typo on the Armv7-R platform docs page)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ConstParamTy nameres rib checks were never implemented for
gca!-rhs direct consts. So, whentype constgot removed in #162517 and we now only havegca!-rhs direct consts, the lack of checks became very apparentThis PR adds the check again for
gca!-rhs direct consts.When implementing this and updating
tests/ui/const-generics/mgca/type_const-generic-param-in-type.rs, I ran into #160553 which caused a glaringly obvious issue - the following succeeds compilation:This is already tracked in
tests/crashes/160553.rsso I have not added a test for it.This is the reason I changed the test from
[(); N]toStructWithConstParam<const N: usize>, the RHS has to, like, y'know, actually typecheck :Pr? @BoxyUwU