Skip to content

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

@oli-obk

Description

@oli-obk
Contributor

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

Activity

added
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.
on Nov 4, 2022
V0ldek

V0ldek commented on Nov 4, 2022

@V0ldek
Contributor

Hey, looks like a good issue for a first-time contributor, I can take this.

@rustbot claim

added a commit that references this issue on Nov 4, 2022
b101f3a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Participants

    @oli-obk@V0ldek

    Issue actions

      change `mk_const` to take a ConstKind and Ty argument instead of writing out the ty::ConstS struct everywhere · Issue #103974 · rust-lang/rust