-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Cleanup ty decoder #27851
Cleanup ty decoder #27851
Conversation
to store the closure in the PSState struct
r? @jroesch (rust_highfive has picked a reviewer for you, use r? to override) |
oh, one more commit coming. |
ok. |
parse_ty_data(tp.data, cdata.cnum, tp.start, tcx, | ||
|_, did| translate_def_id(cdata, did)) | ||
TyDecoder::with_doc(tcx, cdata.cnum, tp, | ||
&mut |_, did| translate_def_id(cdata, did)) |
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.
Couldn't this be created by a method on cdata
, providing the translation function to TyDecoder
?
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.
@eddyb hmm perhaps -- it's a bit tricky to get lifetime of the closure to work out I think, but I guess now that the closure is stored in a struct, we could give ownership of it instead of passing an &mut
. Would be kind of nicer anyway. Maybe I should do that.
@bors r+ |
📌 Commit 7a3a1be has been approved by |
Just a little code cleanup I was doing as part of another refactoring (which may turn out not to be needed). The main thrust of this is to cleanup the interface to `tydecode.rs` to be less ridiculously repetitive. I also purged the generic "def-id conversion" parameter in favor of a trait object, just to reduce code duplication a bit and make the signatures a bit less messy. I measured the bootstrapping time to build stage2 with these changes, it was identical. (But it'd be easy enough to restore the unboxed closure if we wanted it.)
Just a little code cleanup I was doing as part of another refactoring (which may turn out not to be needed). The main thrust of this is to cleanup the interface to
tydecode.rs
to be less ridiculously repetitive. I also purged the generic "def-id conversion" parameter in favor of a trait object, just to reduce code duplication a bit and make the signatures a bit less messy. I measured the bootstrapping time to build stage2 with these changes, it was identical. (But it'd be easy enough to restore the unboxed closure if we wanted it.)