Add setup-toolchain.sh script to configure the master version of rustc,

and update CONTRIBUTING.md accordingly.
This commit is contained in:
Jeremy Fitzhardinge 2019-02-02 11:54:18 -08:00
parent 27b5dd8886
commit 47563a13eb
4 changed files with 16 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

9
setup-toolchain.sh Executable file
View File

@ -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