Skip to content

mGCA: consolidate type const checks on tcx.is_type_const #152124

@BoxyUwU

Description

@BoxyUwU

Under feature(min_generic_const_args) const items have been split into two, "const items" and "type const items". Type const items are written with the #[type_const] attribute applied to the syntax of a normal const item.

In some places in the compiler we check whether a DefId is a type const by looking at its attributes, in other places we call tcx.is_type_const. Everywhere that currently looks at attributes to determine if a const item is a type const item should be changed to use .is_type_const.

This should make it easier to read some of the logic and also make it easier to switch out the type_const attribute for some other means of determining whether a const item is a type const or not. Searching for AttributeKind::TypeConst in the compiler should yield all the places that need updating.

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.F-min_generic_const_args`#![feature(min_generic_const_args)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions