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

Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things #115934

Merged
merged 6 commits into from
Sep 27, 2023

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Sep 18, 2023

Some groundwork for being able to work on rust-lang/project-stable-mir#27 at all

r? @spastorino

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 18, 2023
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 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

- `stable_mir`: Public crate, to be published on crates.io, which will contain
the stable data structure as well as proxy APIs to make calls to the
compiler.
- `rustc_smir`: The compiler crate that will translate from internal MIR to
Copy link
Member

@Noratrieb Noratrieb Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to continue the parallels to proc macros here. Is this crate like proc_macro, exposing a stable but not super nice API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure yet. We may add a proc-macro style intermediate API at some point

for now this is just a "we don't break you that often, and if we do, we have a transition API so you have a few months of grace period"-crate

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How exactly is that supposed to work? I don't entirely follow. So rustc_smir will try to maintain a compat when things change in rustc? And only change things after a while? And stable_mir will access this compat layer but then after a toolchain upgrade with notice it will stop working because rustc_smir changed? What's the point of having stable_mir on crates.io then if it depends on the compiler version anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to figure this out. As the initial version I will add derives to the 0.1 release that then do 1:1 conversions from the unstable rustc version to the 0.1 version. When we plan a breaking change, we create a 0.2 version that does 1:1 conversion with an unstable equivalent. The 0.1 crate will get its compat layer changed to instead refer to the 0.2 crate and convert from 0.2 to 0.1 (semver trick).

Very vague and handwavy I know.

The alternative is to go the proc-macro route and just have a bunch of extern "C" functions to communicate with the compiler in a stable way, but I haven't given that too much thought yet, as the above mentioned system would be enough for most folk currently using unstable MIR

Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this!

Cargo.lock Outdated Show resolved Hide resolved
compiler/smir/README.md Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Sep 25, 2023

☔ The latest upstream changes (presumably #116117) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@spastorino
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 26, 2023

📌 Commit 411e431 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 Sep 26, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2023
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#115934 (Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things)
 - rust-lang#116149 (Anonymize binders for `refining_impl_trait` check)
 - rust-lang#116178 (Add test for `const async fn`)
 - rust-lang#116187 (Add context to `let: Ty = loop { break };`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d485887 into rust-lang:master Sep 27, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 27, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2023
Rollup merge of rust-lang#115934 - oli-obk:smir_identity, r=spastorino

Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things

Some groundwork for being able to work on rust-lang/project-stable-mir#27 at all

r? `@spastorino`
@oli-obk oli-obk deleted the smir_identity branch September 27, 2023 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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