Skip to content

change mk_const to take a ConstKind and Ty argument instead of writing out the ty::ConstS struct everywhere #103974

Closed
@oli-obk

Description

@oli-obk

We keep repeating this, but it adds no helpful information for readers of the call site, it's just boilerplate and noise.

Steps:

  1. change https://github.com/rust-lang/rust/blob/b66cf6fe168e10dcbfed4320a5e84c0c28eee814/compiler/rustc_middle/src/ty/context.rs#L2302 to use mk_const_internal instead of mk_const. This is what generates the current mk_const function.
  2. Create a mk_const function next to https://github.com/rust-lang/rust/blob/b66cf6fe168e10dcbfed4320a5e84c0c28eee814/compiler/rustc_middle/src/ty/context.rs#L2644 that takes two arguments and forwards them to a mk_const_internal(ty::ConstS { val, kind }
  3. fix up all the mk_const call sites to make them stop using ty::ConstS and instead pass the two fields as arguments

Metadata

Metadata

Assignees

Labels

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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions