-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Forbid generic parameters in types of #[type_const] items #150650
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
Conversation
|
|
ede7804 to
e35c432
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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 🥇 |
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.
thanks! the logic looks correct, just a few small comments about the tests and then this can be merged
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
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
a98a54a to
88c4a95
Compare
tests/ui/const-generics/mgca/type_const-generic-param-in-type.rs
Outdated
Show resolved
Hide resolved
7e2175e to
a12675b
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.
This comment has been minimized.
This comment has been minimized.
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.
|
@bors r+ rollup thanks :) |
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
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`
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