rust/compiler/rustc_resolve
Stuart Cook 05dce482d3
Rollup merge of #150650 - enthropy7:main, r=BoxyUwU
Forbid generic parameters in types of #[type_const] items

fixes rust-lang/rust#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`
2026-01-04 21:37:04 +11:00
..
src Rollup merge of #150650 - enthropy7:main, r=BoxyUwU 2026-01-04 21:37:04 +11:00
Cargo.toml resolve: Preserve binding scopes in ambiguity errors 2025-12-27 22:50:02 +03:00
messages.ftl Move more early buffered lints to dyn lint diagnostics (6/N) 2025-11-30 17:59:42 +01:00