Forbid generic parameters in types of #[type_const] items#150650
Merged
bors merged 1 commit intorust-lang:mainfrom Jan 4, 2026
Merged
Forbid generic parameters in types of #[type_const] items#150650bors merged 1 commit intorust-lang:mainfrom
bors merged 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
|
ede7804 to
e35c432
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
CI checks failed few times cause i forget to fix another tests that was here before new behavior. now everything is ok, i force pushed correct commits to keep it clear 🥇 |
BoxyUwU
reviewed
Jan 4, 2026
tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.rs
Outdated
Show resolved
Hide resolved
tests/ui/associated-consts/assoc-const-eq-esc-bound-var-in-ty.rs
Outdated
Show resolved
Hide resolved
Member
|
@rustbot author |
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
a98a54a to
88c4a95
Compare
BoxyUwU
reviewed
Jan 4, 2026
tests/ui/const-generics/mgca/type_const-generic-param-in-type.rs
Outdated
Show resolved
Hide resolved
7e2175e to
a12675b
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
Author
thanks! it was nice to cooperate, I will continue to look where I can be useful. now im waiting for CI with you, cause last one failed (stderr classic), but now i solved it |
This comment has been minimized.
This comment has been minimized.
Member
|
@bors r+ rollup thanks :) |
Collaborator
This was referenced Jan 4, 2026
bors
added a commit
that referenced
this pull request
Jan 4, 2026
Rollup of 7 pull requests Successful merges: - #150201 (compiletest: Support revisions in debuginfo (read: debugger) tests) - #150642 (mutex.rs: remove needless-maybe-unsized bounds) - #150643 (vec in-place-drop: avoid creating an intermediate slice) - #150650 (Forbid generic parameters in types of #[type_const] items) - #150658 (Clarify panic conditions in `Iterator::last`) - #150659 (Add missing translator resources for interface parse_cfg and parse_check_cfg) - #150666 (Fix ambig-unambig-ty-and-consts link) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Jan 4, 2026
Rollup merge of #150650 - enthropy7:main, r=BoxyUwU Forbid generic parameters in types of #[type_const] items fixes #150614 we enforce the same restriction on `#[type_const]` const items that already exists for const generic parameters - when `generic_const_parameter_types` feature gate is not enabled, the type of a `#[type_const]` item cannot reference generic parameters. implementation follows the same pattern used for const generic parameters. we check if the item has the `#[type_const]` attribute and if the feature gate is disabled, then we apply `RibKind::ConstParamTy` restrictions when visiting the type, which prevents the use of generic parameters. check is added in three places: - Free const items (`ItemKind::Const`) - Trait associated consts (`AssocItemKind::Const` in traits) - Impl associated consts (`AssocItemKind::Const` in impls) added tests for new feature, hope i get this task right :> r? `@BoxyUwU`
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.
fixes #150614
we enforce the same restriction on
#[type_const]const items that already exists for const generic parameters - whengeneric_const_parameter_typesfeature gate is not enabled, the type of a#[type_const]item cannot reference generic parameters. implementation follows the same pattern used for const generic parameters. we check if the item has the#[type_const]attribute and if the feature gate is disabled, then we applyRibKind::ConstParamTyrestrictions when visiting the type, which prevents the use of generic parameters.check is added in three places:
ItemKind::Const)AssocItemKind::Constin traits)AssocItemKind::Constin impls)added tests for new feature, hope i get this task right :>
r? @BoxyUwU