-
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
Add generics_of to smir #115092
Add generics_of to smir #115092
Conversation
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino |
host_effect_index: self.host_effect_index, | ||
} | ||
} | ||
} |
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.
I'd implement this more like:
fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
use stable_mir::ty::Generics;
let params: Vec<_> = self.params.iter().map(|param| {
param.stable(tables)
}).collect();
let param_def_id_to_index = params.iter().map(|param| (param.def_id, param.index)).collect();
Generics {
parent: self.parent.map(|did| tables.generic_def(did)),
parent_count: self.parent_count,
params,
param_def_id_to_index,
has_self: self.has_self,
has_late_bound_regions: self.has_late_bound_regions.as_ref().map(|late_bound_regions| late_bound_regions.stable(tables)),
host_effect_index: self.host_effect_index,
}
}
Then you can remove FxHashMap
requirement, remove the rustc::potential_query_instability
attribute and the dependency of rustc_data_structures
. Would need to implement stable for Span and would need GenericDef
to be Copy
, just make all these Defs copy. Otherwise just call opaque
directly for now.
@bors r+ rollup |
Rollup of 7 pull requests Successful merges: - rust-lang#114930 (Automatically add OS labels to std PRs) - rust-lang#115053 (docs: Add example, reference link for `type` keyword.) - rust-lang#115092 (Add generics_of to smir) - rust-lang#115096 (Add regression test for not `memcpy`ing padding bytes) - rust-lang#115100 (Add support for `ptr::write`s for the `invalid_reference_casting` lint) - rust-lang#115114 (Contents of reachable statics is reachable) - rust-lang#115122 (Fix clippy lint for identical `if`/`else` contraining `?` expressions) r? `@ghost` `@rustbot` modify labels: rollup
…-of, r=compiler-errors Add missing high-level stable_mir::generics_of fn We forgot to add this function in rust-lang#115092, as we have done on rust-lang#115084 and other high level APIs. At some point I think we should re-organize the structure of the code but this is what we have for now. r? `@compiler-errors` Would have assigned `@oli-obk` but he is still on vacations
…mpiler-errors Add missing high-level stable_mir::generics_of fn We forgot to add this function in rust-lang/rust#115092, as we have done on rust-lang/rust#115084 and other high level APIs. At some point I think we should re-organize the structure of the code but this is what we have for now. r? `@compiler-errors` Would have assigned `@oli-obk` but he is still on vacations
Continuing our covering of smir.
r? @spastorino