From 47563a13eba19d0fc4b56f2cd0d5645fc81e7bc3 Mon Sep 17 00:00:00 2001 From: Jeremy Fitzhardinge Date: Sat, 2 Feb 2019 11:54:18 -0800 Subject: [PATCH] Add setup-toolchain.sh script to configure the master version of rustc, and update CONTRIBUTING.md accordingly. --- .travis.yml | 5 +---- CONTRIBUTING.md | 4 ++++ ci/base-tests.sh | 4 ++-- setup-toolchain.sh | 9 +++++++++ 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100755 setup-toolchain.sh diff --git a/.travis.yml b/.travis.yml index d7b262255187..acb5b9ae0d24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,10 +90,7 @@ matrix: script: - | rm rust-toolchain - cargo install rustup-toolchain-install-master --debug || echo "rustup-toolchain-install-master already installed" - RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}') - travis_retry rustup-toolchain-install-master -f -n master $RUSTC_HASH - rustup default master + ./setup-toolchain.sh export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib - | if [ -z ${INTEGRATION} ]; then diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 415fb7ab0d74..5619ee00f8d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -73,6 +73,10 @@ an AST expression). `match_def_path()` in Clippy's `utils` module can also be us ## Writing code +Clippy depends on the current git master version of rustc, which can change rapidly. Make sure you're +working near rust-clippy's master, and use the `setup-toolchain.sh` script to configure the appropriate +toolchain for this directory. + [Llogiq's blog post on lints](https://llogiq.github.io/2015/06/04/workflows.html) is a nice primer to lint-writing, though it does get into advanced stuff. Most lints consist of an implementation of `LintPass` with one or more of its default methods overridden. See the existing lints for examples diff --git a/ci/base-tests.sh b/ci/base-tests.sh index 6675c795b3b2..3ac6bbe67258 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -29,7 +29,7 @@ cargo +nightly fmt --all -- --check # some lints are sensitive to formatting, exclude some files tests_need_reformatting="false" # switch to nightly -rustup default nightly +rustup override set nightly # avoid loop spam and allow cmds with exit status != 0 set +ex @@ -49,4 +49,4 @@ if [ "${tests_need_reformatting}" == "true" ] ; then fi # switch back to master -rustup default master +rustup override set master diff --git a/setup-toolchain.sh b/setup-toolchain.sh new file mode 100755 index 000000000000..f8d764b61327 --- /dev/null +++ b/setup-toolchain.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Set up the appropriate rustc toolchain + +cd $(dirname $0) + +cargo install rustup-toolchain-install-master --debug || echo "rustup-toolchain-install-master already installed" +RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}') +rustup-toolchain-install-master -f -n master $RUSTC_HASH +rustup override set master