Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
oli-obk opened this issue Nov 4, 2022 · 1 comment · Fixed by #103984
Assignees
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Nov 4, 2022

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
@oli-obk oli-obk added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Nov 4, 2022
@V0ldek
Copy link
Contributor

V0ldek commented Nov 4, 2022

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

@rustbot claim

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants