Skip to content

Eliminate const_field query #72264

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 May 16, 2020 · 2 comments · Fixed by #72538
Closed

Eliminate const_field query #72264

oli-obk opened this issue May 16, 2020 · 2 comments · Fixed by #72538
Assignees
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-cleanup Category: PRs that clean code up or issues documenting cleanup. 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented May 16, 2020

Followup to #67901

I think we only have one use site of const_field left:

let field = bx.tcx().const_field(
and it iterates over all fields anyway. So we can call destructure_const instead and iterate over the resulting fields.

There should be no more results for searching const_field in the rust source after this, so some comments may need updating to mentioning destructure_const instead of const_field.

These mentoring instructions are a bit vague, I do realize that, so if you encounter any hickup of any magnitude, don't hesitate to write here or contact me via discord/zulip.

This issue has been assigned to @rakshith-ravi via this comment.

@oli-obk oli-obk added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) labels May 16, 2020
@rakshith-ravi
Copy link
Contributor

@rustbot claim

@rustbot rustbot self-assigned this May 16, 2020
@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 16, 2020
@RalfJung
Copy link
Member

RalfJung commented May 21, 2020

destructure_const

I don't think "destructure" is a word. The term I have seen for that (and the term that is commonly used for this operation in the theorem prover community) is "destruct".

EDIT: Okay, it is a word. Still, to me "destruct" sounds better. But maybe that's just because I am used to theorem provers?

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 25, 2020
…-query, r=oli-obk

Removed all instances of const_field.

Fixes rust-lang#72264

r? @oli-obk
@bors bors closed this as completed in b6a8915 May 26, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-cleanup Category: PRs that clean code up or issues documenting cleanup. 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants