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

Tweaks and improvements on SMIR around generics_of and predicates_of #115300

Merged
merged 7 commits into from
Aug 29, 2023

Conversation

spastorino
Copy link
Member

@spastorino spastorino commented Aug 28, 2023

r? @oli-obk

This allows an API like the following ...

    let trait_decls = stable_mir::all_trait_decls().iter().map(|trait_def| {
        let trait_decl = stable_mir::trait_decl(trait_def);
        let generics = trait_decl.generics_of();
        let predicates = trait_decl.predicates_of().predicates;

I didn't like that much trait_def.trait_decl() which is it possible but adding a method to a def_id that loads up a whole trait definition looks backwards to me.

@rustbot
Copy link
Collaborator

rustbot commented Aug 28, 2023

Could not assign reviewer from: oli-obk.
User(s) oli-obk are either the PR author, already assigned, or on vacation, and there are no other candidates.
Use r? to specify someone else to assign.

@rustbot
Copy link
Collaborator

rustbot commented Aug 28, 2023

r? @WaffleLapkin

(rustbot has picked a reviewer for you, use r? to override)

@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 28, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 28, 2023

This PR changes Stable MIR

cc @oli-obk, @celinval, @spastorino

@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the smir-tweaks branch 2 times, most recently from acee770 to b82b70f Compare August 28, 2023 13:59
@spastorino spastorino changed the title Make stable_mir::generics_of/predicates_of receive def_id::DefId Make stable_mir::generics_of/predicates_of receive stable_mir::DefId Aug 28, 2023
@oli-obk oli-obk assigned oli-obk and unassigned WaffleLapkin Aug 28, 2023
@spastorino
Copy link
Member Author

I'm leaving the PR this way for @oli-obk to check it out, but I'm going to add a macro so we can have this *Def new type wrappers defined over DefId implementing also IntoDefId automatically.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@spastorino
Copy link
Member Author

spastorino commented Aug 28, 2023

@oli-obk maybe you don't want the commit 3e854c3 or maybe we want to keep implementing Index for all the Def wrappers.

@spastorino spastorino changed the title Make stable_mir::generics_of/predicates_of receive stable_mir::DefId Remove stable_mir::generics_of/predicates_of and improve APIs to use trait_def.generics_of/predicates_of, etc Aug 28, 2023
@spastorino spastorino changed the title Remove stable_mir::generics_of/predicates_of and improve APIs to use trait_def.generics_of/predicates_of, etc Tweaks and improvements on SMIR around generics_of and predicates_of Aug 28, 2023
@spastorino spastorino force-pushed the smir-tweaks branch 2 times, most recently from 721377e to a0d49c1 Compare August 28, 2023 20:46
@oli-obk
Copy link
Contributor

oli-obk commented Aug 29, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 29, 2023

📌 Commit 5ab9616 has been approved by oli-obk

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 29, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 29, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#111580 (Don't ICE on layout computation failure)
 - rust-lang#114923 (doc: update lld-flavor ref)
 - rust-lang#115174 (tests: add test for rust-lang#67992)
 - rust-lang#115187 (Add new interface to smir)
 - rust-lang#115300 (Tweaks and improvements on SMIR around generics_of and predicates_of)
 - rust-lang#115340 (some more is_zst that should be is_1zst)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a51e830 into rust-lang:master Aug 29, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Aug 29, 2023
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.

7 participants