-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc_metadata: Deduplicate code between encode_info_for_item
and encode_info_for_foreign_item
#77393
Comments
Relevant code: rust/compiler/rustc_metadata/src/rmeta/encoder.rs Line 1223 in d902752
rust/compiler/rustc_metadata/src/rmeta/encoder.rs Line 1725 in d902752
rust/compiler/rustc_metadata/src/rmeta/encoder.rs Line 1054 in d902752
|
I'd like to give this a try if mentoring is available! |
Is it 'just' refactoring the methods all together? |
The goal is to make the code nicer and less error-prone, but I'm not sure which exactly refactoring to apply to do that. |
Hi I'd like to try my hand at this so I made a small change to align the contents of self.encode_ident_span(def_id, ...);
record!(self.tables.visibility[def_id] <-
ty::Visibility::from_hir(...));
record!(self.tables.attributes[def_id] <- ...);
self.encode_stability(def_id);
self.encode_const_stability(def_id);
self.encode_deprecation(def_id);
self.encode_item_type_when(def_id, ...);
self.encode_inherent_implementations(def_id);
self.encode_function_signature_when(
def_id,
matches!(...),
);
self.encode_generics(def_id);
self.encode_variances_when(def_id, matches!(...));
self.encode_explicit_predicates(def_id);
self.encode_generics_explicit_predicates_inferred_outlives_when(def_id, ...); I'd then pull those calls out into a single helper method. Am I headed in the right direction? If so I'll keep going. My strategy is to dedupe Couple questions:
|
No, it shouldn't matter.
For functions |
@rustbot claim |
This is no longer relevant with the recent metadata encoding changes in #80347 and related PRs. |
The set of data to record for regular items and foreign items is pretty similar, but slightly different.
When metadata encoding is done independently for them, issues like #77375 arise.
encode_info_for_trait_item
andencode_info_for_impl_item
are also similar, and also slightly different (all in different directions), so they may be included into the refactoring as well.The text was updated successfully, but these errors were encountered: