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

Move rustc_smir to driver #116806

Closed
wants to merge 1 commit into from
Closed

Conversation

ouz-a
Copy link
Contributor

@ouz-a ouz-a commented Oct 16, 2023

With this change this will allow us to call rustc_smir function from rustc_driver and few other places. So things like being able to implement --emit=smir will be possible.

r? @oli-obk

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

rustbot commented Oct 16, 2023

This PR changes Stable MIR

cc @oli-obk, @celinval, @spastorino

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.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

I don't understand why this motivation:

With this change this will allow us to call rustc_smir function from rustc_driver and few other places.

Results in this change. You should be able to just make rustc_driver depend on rustc_smir via its Cargo.toml instead of actually moving the source into that crate.

@celinval
Copy link
Contributor

celinval commented Oct 16, 2023

I would also prefer keeping these two crates separate.

@ouz-a
Copy link
Contributor Author

ouz-a commented Oct 16, 2023

I don't understand why this motivation:

With this change this will allow us to call rustc_smir function from rustc_driver and few other places.

Results in this change. You should be able to just make rustc_driver depend on rustc_smir via its Cargo.toml instead of actually moving the source into that crate.

rustc_smir is fundamentally dependent on rustc_driver, I can't add cyclic dependency, also should've put prior discussion of this in my message: https://rust-lang.zulipchat.com/#narrow/stream/320896-project-stable-mir/topic/should.20we.20have.20--emit.3Dsmir

@oli-obk
Copy link
Contributor

oli-obk commented Oct 16, 2023

I was thinking that we could either

  • move only the StableMir type to rustc_driver (as that is its own driver),
  • or if we want to keep all logic in rustc_smir, add a macro that imports and invokes rustc_driver, so that smir drivers can just do that but rustc_smir doesn't actually depend on rustc_driver.

@rust-log-analyzer

This comment has been minimized.

@ouz-a
Copy link
Contributor Author

ouz-a commented Oct 18, 2023

Since this is done better via in #116837 I'm closing this.

@ouz-a ouz-a closed this Oct 18, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 18, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 18, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? ``@spastorino``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 19, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? ```@spastorino```
@ouz-a ouz-a deleted the move_rustc_smir branch October 19, 2023 13:39
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 20, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 20, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 20, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 20, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 21, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 23, 2023
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`

This is done by moving all the logic into a macro that performs the entire "run" operation in one go.

This makes rust-lang#116806 obsolete

as a follow up we should make the macro usable without manually having to write

```rust
#[macro_use]
extern crate rustc_smir;
extern crate stable_mir;
extern crate rustc_driver;
extern crate rustc_interface;
use rustc_smir::rustc_internal;
```

in every crate that uses the macro.

r? `@spastorino`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants