-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Improve comments about type folding/visiting. #93758
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rustbot
added
the
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Feb 8, 2022
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Feb 8, 2022
BoxyUwU
reviewed
Feb 14, 2022
nnethercote
force-pushed
the
improve-folding-comments
branch
from
February 15, 2022 04:36
2509a87
to
2e56c02
Compare
@BoxyUwU Thanks for the comments. I have addressed them and updated the code. |
@bors r+ |
📌 Commit 2e56c02 has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Feb 16, 2022
@bors rollup=always |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 16, 2022
…s, r=BoxyUwU Improve comments about type folding/visiting. I have found this code confusing for years. I've always roughly understood it, but never exactly. I just made my fourth(?) attempt and finally cracked it. This commit improves the comments. In particular, it explicitly describes how you can't do a custom fold/visit of any type; there are actually a handful of "types of interest" (e.g. `Ty`, `Predicate`, `Region`, `Const`) that can be custom folded/visted, and all other types just get a generic traversal. I think this was the part that eluded me on all my prior attempts at understanding. The commit also updates comments to account for some newer changes such as the fallible/infallible folding distinction, does some minor reorderings, and moves one `impl` to a better place. r? `@BoxyUwU`
doctest failure #94065 (comment) |
bors
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Feb 17, 2022
intra doc link checker stuff really ought to go into normal CI :( |
I have found this code confusing for years. I've always roughly understood it, but never exactly. I just made my fourth(?) attempt and finally cracked it. This commit improves the comments. In particular, it explicitly describes how you can't do a custom fold/visit of any type; there are actually a handful of "types of interest" (e.g. `Ty`, `Predicate`, `Region`, `Const`) that can be custom folded/visted, and all other types just get a generic traversal. I think this was the part that eluded me on all my prior attempts at understanding. The commit also updates comments to account for some newer changes such as the fallible/infallible folding distinction, does some minor reorderings, and moves one `impl` to a better place.
nnethercote
force-pushed
the
improve-folding-comments
branch
from
February 17, 2022 12:16
2e56c02
to
94f0849
Compare
I fixed the link bustage. @bors r=BoxyUwU |
📌 Commit 94f0849 has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Feb 17, 2022
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 17, 2022
…askrgr Rollup of 9 pull requests Successful merges: - rust-lang#93337 (Update tracking issue numbers for inline assembly sub-features) - rust-lang#93758 (Improve comments about type folding/visiting.) - rust-lang#93780 (Generate list instead of div items in sidebar) - rust-lang#93976 (Add MAIN_SEPARATOR_STR) - rust-lang#94011 (Even more let_else adoptions) - rust-lang#94041 (Add a `try_collect()` helper method to `Iterator`) - rust-lang#94043 (Fix ICE when using Box<T, A> with pointer sized A) - rust-lang#94082 (Remove CFG_PLATFORM) - rust-lang#94085 (Clippy: Don't lint `needless_borrow` in method receiver positions) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have found this code confusing for years. I've always roughly
understood it, but never exactly. I just made my fourth(?) attempt and
finally cracked it.
This commit improves the comments. In particular, it explicitly
describes how you can't do a custom fold/visit of any type; there are
actually a handful of "types of interest" (e.g.
Ty
,Predicate
,Region
,Const
) that can be custom folded/visted, and all other typesjust get a generic traversal. I think this was the part that eluded me
on all my prior attempts at understanding.
The commit also updates comments to account for some newer changes such
as the fallible/infallible folding distinction, does some minor
reorderings, and moves one
impl
to a better place.r? @BoxyUwU