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

Publish to crates.io #48

Open
stefnotch opened this issue Jun 30, 2023 · 6 comments
Open

Publish to crates.io #48

stefnotch opened this issue Jun 30, 2023 · 6 comments

Comments

@stefnotch
Copy link

It'd be lovely if this tool were published to crates.io, like the majority of Rust tools.

Then the installation instructions might be simpler for users who already have Rust.

@RyanGlScott
Copy link
Contributor

I agree. One reason that we haven't yet uploaded mir-json to crates.io is that any given mir-json release would only be buildable with a particular rustc nightly, and I could imagine lots of bug reports from confused users who try to install mir-json with an unsupported rustc version. That being said, we could include a rust-toolchain.toml file to ensure that when a user runs cargo install mir-json, cargo will download the correct nightly before attempting to build the tool.

@RyanGlScott
Copy link
Contributor

Actually, I'm not sure if rust-toolchain.toml takes effect with cargo install or not. It would take effect if you cloned the mir-json repo and built it from source, which would simplify the current story slightly (in that you wouldn't need to manually change your Rust toolchain before building).

@stefnotch
Copy link
Author

Ah, I see. I suppose a stable mir format would be needed for it to work with multiple rustc versions.

I personally would love anything that simplifies the installation instructions. Even getting rid of a single step is frequently worth it, in my opinion.

@RyanGlScott
Copy link
Contributor

Ah, it turns out that we already have a rust-toolchain.toml file:

[toolchain]
channel = "nightly-2023-01-23"

I think that we need to add components = ["rustc-dev"] as well, but most of the ingredients are there.

Another thought that popped into my mind: there are several commands inside of mir-json that spawn rustc subprocesses. If a user installs mir-json with one rustc version (the intended version) but later changes their toolchain to have a different rustc version as the default, will mir-json's rustc subprocesses still pick the intended version? Surprisingly, some experimentation suggests that the answer is "yes". I'm not sure how that works exactly, but that is a fortunate coincidence.

@spernsteiner
Copy link
Collaborator

If a user installs mir-json with one rustc version (the intended version) but later changes their toolchain to have a different rustc version as the default, will mir-json's rustc subprocesses still pick the intended version? Surprisingly, some experimentation suggests that the answer is "yes".

I suspect this only works in certain cases. The various mir-json binaries link against a specific version of the rustc libraries and will always behave like the nightly they're built against. But we might run into trouble when invoking normal rustc instead of mir-json or one of our other binaries. In particular, using cargo crux-test in a project that uses proc macros might compile the proc macros with the default toolchain and produce proc macro crates that can't be loaded by mir-json.

We could probably fix this by setting RUSTUP_TOOLCHAIN or passing +nightly-xxx args in more places.

@RyanGlScott
Copy link
Contributor

But we might run into trouble when invoking normal rustc instead of mir-json or one of our other binaries.

To be clear, this is the scenario I was referring to in my comment in #48 (comment). Somehow, every rustc invocation that mir-json uses managed to pick the right rustc version when I tried it, even when a different rustc was selected as the default toolchain. This might have simply been a lucky fluke, however. I agree that we should be using RUSTUP_TOOLCHAIN/+nightly-xxx to make this more foolproof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants