Skip to content

Commit b90523c

Browse files
authored
Merge pull request #2129 from vorner/update-script
Include a conditional update script
2 parents 0b0fe69 + def4a26 commit b90523c

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ transparently:
180180
#[cfg_attr(feature = "cargo-clippy", allow(needless_lifetimes))]
181181
```
182182

183+
## Updating rustc
184+
185+
Sometimes, rustc moves forward without clippy catching up. Therefore updating
186+
rustc may leave clippy a non-functional state until we fix the resulting
187+
breakage.
188+
189+
You can use the [rust-update](rust-update) script to update rustc only if
190+
clippy would also update correctly.
191+
183192
## License
184193

185194
Licensed under [MPL](https://www.mozilla.org/MPL/2.0/).

rust-update

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
if [ "$1" = '-h' ] ; then
4+
echo 'Updates rustc & clippy'
5+
echo 'It first checks if clippy would compile at currentl nightly and if so, it updates.'
6+
echo 'Options:'
7+
echo '-h: This help message'
8+
echo '-f: Skips the check and just updates'
9+
exit
10+
fi
11+
12+
set -ex
13+
14+
renice -n 10 -p $$
15+
16+
export CARGO_INCREMENTAL=0
17+
export RUSTFLAGS='-C target-cpu=native'
18+
19+
try_out() {
20+
export RUSTUP_HOME=$HOME/.rustup-attempt
21+
test -d $RUSTUP_HOME || (rustup toolchain add nightly && rustup default nightly)
22+
rustup update
23+
cargo +nightly install --force clippy
24+
unset RUSTUP_HOME
25+
export RUSTUP_HOME
26+
}
27+
28+
[ "$1" = '-f' ] || try_out
29+
30+
rustup update
31+
cargo +nightly install --force clippy

0 commit comments

Comments
 (0)