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 proper support for rustfix runs #282

Open
3 tasks
pietroalbini opened this issue Jul 13, 2018 · 5 comments
Open
3 tasks

Add proper support for rustfix runs #282

pietroalbini opened this issue Jul 13, 2018 · 5 comments
Labels
C-new-feature Category: a new feature to implement

Comments

@pietroalbini
Copy link
Member

As far as I understood, we want to execute Crater runs between a nightly and the same nightly with rustfix and the edition enabled, as part of the Rust 2018 preparation. Is this right?

We can surely do this in an hackish way (by doing a quick and dirty patch on the runner), but we should also add proper support for the long term (as we did with NLL runs). My implementation plan:

  • Refactor the log handling to combine multiple tasks in the same log
    • Ideally I'd like to run rustfix as a separate task in the dependency graph, to avoid duplicating all the modes with $mode+rustfix -- this way the first toolchain works the same as before, but the second toolchain also depends on a "rustfix" task
  • Refactor the toml frobber and the directory structure to support a different Cargo.toml and source directory for each toolchain
  • Add a rustfix task and implement support for it like NLL runs

Unfortunately properly implementing this is going to take time, and I probably won't have time to do everything before the second edition preview (we could as always implement a quick one-time patch and apply it on one of the runners, executing it manually).

cc @Mark-Simulacrum @Centril @aturon

@pietroalbini pietroalbini added the C-new-feature Category: a new feature to implement label Jul 13, 2018
@Mark-Simulacrum
Copy link
Member

Note that currently I believe we need to edit not just Cargo.toml but the root files (lib.rs, main.rs) to insert the preview feature gate. That's likely quite hard to get right; we might want an alternative like a -Z flag.

@aturon
Copy link
Member

aturon commented Jul 18, 2018

cc @nikomatsakis

@nikomatsakis
Copy link

+1 to adding a -Z flag, seems useful. I see that @pietroalbini already implemented it (though it seems to be pending review). I don't really have a lot of insight when it comes to crater's internal workings, but I agree that trying to do something -- even something quick-n-dirty -- is probably a good idea. I imagine that a crater run is going to turn up lots of fun problems.

@pietroalbini
Copy link
Member Author

Well, yeah, I didn't expect to implement proper support in time for the edition preview 2. Once there is a build with the -Z flag doing some patches on the fly on the runner should not be too hard.

bors added a commit to rust-lang/rust that referenced this issue Jul 19, 2018
Add the -Zfeature=foo unstable rustc option

This PR adds a new unstable option to `rustc`: `-Zfeature=foo`. The option can be used to enable nightly features from the CLI, and it's meant to be used by tools like Crater to try enabling features without changing the crate's source code.

The exact reason I need this is to implement "edition runs" in Crater: we need to add the preview feature flag to every crate, and editing the crates' source code on the fly might produce unexpected results, while a compiler flag is more reliable. Obviously this won't be stabilized in the future.

cc rust-lang/crater#282 @Mark-Simulacrum
bors added a commit to rust-lang/rust that referenced this issue Jul 28, 2018
Add the -Zcrate-attr=foo unstable rustc option

This PR adds a new unstable option to `rustc`: `-Zcrate-attr=foo`. The option can be used to inject crate-level attributes from the CLI, and it's meant to be used by tools like Crater that needs to add their own attributes to a crate without changing the source code.

The exact reason I need this is to implement "edition runs" in Crater: we need to add the preview feature flag to every crate, and editing the crates' source code on the fly might produce unexpected results, while a compiler flag is more reliable.

cc rust-lang/crater#282 @Mark-Simulacrum
bors added a commit to rust-lang/rust that referenced this issue Jul 28, 2018
Add the -Zcrate-attr=foo unstable rustc option

This PR adds a new unstable option to `rustc`: `-Zcrate-attr=foo`. The option can be used to inject crate-level attributes from the CLI, and it's meant to be used by tools like Crater that needs to add their own attributes to a crate without changing the source code.

The exact reason I need this is to implement "edition runs" in Crater: we need to add the preview feature flag to every crate, and editing the crates' source code on the fly might produce unexpected results, while a compiler flag is more reliable.

cc rust-lang/crater#282 @Mark-Simulacrum
@pietroalbini
Copy link
Member Author

I left some notes to run rustfix runs with the temporary branch. It's not possible to run them at the moment since enabling the rust_2018_preview feature flag breaks rustfix while trying to compile serde (so almost every crate will fail).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-new-feature Category: a new feature to implement
Projects
None yet
Development

No branches or pull requests

4 participants