-
Notifications
You must be signed in to change notification settings - Fork 13.4k
HIR/THIR visitors should deconstruct all values #141849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
@rustbot claim |
rust/compiler/rustc_hir/src/intravisit.rs Line 1256 in 2398bd6
|
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 3, 2025
…thercote Deconstruct values in the THIR visitor Hi! I am a beginner rust developer. I'm trying to solve your problem rust-lang#141849 I see that 2 files need to be corrected, so I’m starting with a simpler step, `compiler/rustc_middle/src/thir/visit.rs` r? `@krikera`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 3, 2025
…nethercote Deconstruct values in the THIR visitor I continue to add deconstruction for task rust-lang#141849 The changes concern a more complex part of the task `compiler/rustc_hir/src/intravisit.rs` r? `@nnethercote`
rust-timer
added a commit
that referenced
this issue
Jun 3, 2025
Rollup merge of #141918 - ArtemIsmagilov:issue-141849, r=nnethercote Deconstruct values in the THIR visitor Hi! I am a beginner rust developer. I'm trying to solve your problem #141849 I see that 2 files need to be corrected, so I’m starting with a simpler step, `compiler/rustc_middle/src/thir/visit.rs` r? `@krikera`
Completed by @ArtemIsmagilov in #141918 and #141931. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
The AST visitor (in
compiler/rustc_ast/src/visit.rs
) uses struct/enum deconstruction to access fields in itswalk_*
methods, e.g.:This is good, because it's impossible to add a new field to an AST type and fail to update the appropriate visitor -- you'll get a compile error. (I swear there was a comment about this, but I can't find it right now.)
In contrast, the HIR visitor (in
compiler/rustc_hir/src/intravisit.rs
) uses field access:It would be good to change the HIR visitor to use deconstruction everywhere. This would identify any fields that are currently erroneously unvisited, and prevent future occurrences.
Likewise for the THIR visitor (in
compiler/rustc_middle/src/thir/visit.rs
) which is a lot smaller and simpler.This would be a good task for a new contributor, maybe even a good first bug.
The text was updated successfully, but these errors were encountered: