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 rustc version check to build script #2733

merged 1 commit into from May 7, 2018


Copy link

@phansch phansch commented May 7, 2018

This extends the build script with a few version checks, as a first step towards autopublishing.

As it is right now, the current checks will stop the compilation if the used rust version is older than the one specified in min_version.txt or if stable or beta were used to compile Clippy.

min_version.txt contains the output of rustc -vV as that's currently the only format that rustc-version-rs understands. It was the quickest way to get it working, without writing a custom rust version parser.

I committed the min_version.txt manually, but with #2717 that should only be done through travis, so I added it to the .gitignore to prevent manual commits with that file. Until #2717 is done, we will have to update the min_version.txt manually with rustc -vV > min_version.txt when we are supporting a new nightly release.


If Clippy is compiled on beta or stable it will show the following error:

error: clippy requires a nightly version of Rust.
> Installed rustc version is: 1.25.0 (2018-03-25). Minimum required rustc version: 1.27.0-nightly (2018-05-03).

If Clippy is compiled with a nightly older than specified in min_version.txt:

error: clippy does not support this version of rustc nightly.
> Use `rustup update` or your preferred method to update Rust.
> Installed rustc version is: 1.27.0-nightly (2018-05-02). Minimum required rustc version: 1.27.0-nightly (2018-05-03).

Screenshot with colors:

Closes #2716

Copy link
Member Author

phansch commented May 7, 2018

Checking why this works locally but not on travis/appveyor.
Looks like I have to implement my own commit date comparison, because currently it only checks for string equality.

Copy link
Member Author

phansch commented May 7, 2018

I took the date comparison from and it works properly now.

Copy link

oli-obk commented May 7, 2018

I like the setup with the full rustc -vV output. We should keep it.

@oli-obk oli-obk merged commit ad438b3 into rust-lang:master May 7, 2018
@phansch phansch deleted the build_script branch May 8, 2018 17:32
Copy link

cesarb commented May 12, 2018

This change breaks compilation on a rustc compiled directly from git:

   Compiling clippy v0.0.198 (file:///home/cesarb/opt/rust-git/src/rust-clippy)
error: failed to run custom build command for `clippy v0.0.198 (file:///home/cesarb/opt/rust-git/src/rust-clippy)`
process didn't exit successfully: `/home/cesarb/opt/rust-git/src/rust-clippy/target/release/build/clippy-bea81a14b521375c/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'current rustc version information does not contain a rustc commit date', libcore/
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
$ rustc -vV
rustc 1.27.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.27.0-dev
LLVM version: 6.0

This rustc was compiled today from git master (e6db79f2ca0), with the following config.toml:

extended = true
sanitizers = true
profiler = true

prefix = "/home/cesarb/opt/rust-git"
sysconfdir = "etc"

Copy link

cesarb commented May 12, 2018

Probably related to rust-lang/rust#43771, the commit hash and commit date aren't available by default in the "dev" channel, which seems to be the default when compiling from git.

Copy link
Member Author

phansch commented May 12, 2018

Thanks for the report! I opened #2750 and will look into this now. Probably we should always allow to build with the dev channel.

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

Successfully merging this pull request may close these issues.

None yet

3 participants