-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add fn on types for layout of variants #75552
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
Conversation
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
d130535
to
5c99cf8
Compare
5c99cf8
to
7fab4e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine to me but I'm not sure what the context is - do you intend to use this function somewhere (in which case, you can probably just include this as a commit in the PR which uses it)? is there an issue/discussion where the need for this was discussed?
@@ -884,6 +884,7 @@ rustc_queries! { | |||
query is_sized_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { | |||
desc { "computing whether `{}` is `Sized`", env.value } | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the chapter on the rustc-dev-guide on adding queries - try grepping for an existing query (e.g. unused_generic_params
since I know that one isn't used in many places) and copy the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you're probably right, I do want to add this with what I want to end up doing, so for now I'll hold off. I'll try replicating that query when I do so, as the other one I was replicating was scattered all about and hard to follow.
r? @ghost |
This creates a query(I believe?) for the variants of types, which can later be used in #54360.Edit: Looking at this again, I'm not particularly sure how to connect the query system & the actual function call.
2nd Edit: I realize that I'm missing a call to modify the
Providers
struct, but I'm not quite sure where to put it. As well, I'm not sure if this is even necessary because I can return an iterator to the layouts of each of the variants, which also contains a size field which is good enough for my use case.This just creates a function on type which returns an iterator of reference to the layouts of the types.
I have no idea who to request for review here, and/or what about this PR should watch out for.