Skip to content
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

Merged
merged 1 commit into from Aug 23, 2023
Merged

Add generics_of to smir #115092

merged 1 commit into from Aug 23, 2023

Conversation

ouz-a
Copy link
Contributor

@ouz-a ouz-a commented Aug 22, 2023

Continuing our covering of smir.

r? @spastorino

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 22, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 22, 2023

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

This PR changes Stable MIR

cc @oli-obk, @celinval, @spastorino

host_effect_index: self.host_effect_index,
}
}
}
Copy link
Member

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.

@spastorino
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 22, 2023

📌 Commit 015b5cb has been approved by spastorino

It is now in the queue for this repository.

@bors 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 Aug 22, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 23, 2023
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
@bors bors merged commit d99466d into rust-lang:master Aug 23, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Aug 23, 2023
@ouz-a ouz-a deleted the smir_generic_of branch August 23, 2023 09:43
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 26, 2023
…-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
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 26, 2023
…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
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants