File tree 3 files changed +37
-3
lines changed
3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ tex/*/out
8
8
perf.data
9
9
perf.data.old
10
10
flamegraph.svg
11
+ .auto- *
Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ install that exact version of rustc as a toolchain:
28
28
This will set up a rustup toolchain called ` miri ` and set it as an override for
29
29
the current directory.
30
30
31
+ You can also create a ` .auto-everything ` file (contents don't matter, can be empty), which
32
+ will cause any ` ./miri ` command to automatically call ` rustup-toolchain ` , ` clippy ` and ` rustfmt `
33
+ for you. If you don't want all of these to happen, you can add individual ` .auto-toolchain ` ,
34
+ ` .auto-clippy ` and ` .auto-fmt ` files respectively.
35
+
31
36
[ `rustup-toolchain-install-master` ] : https://github.com/kennytm/rustup-toolchain-install-master
32
37
33
38
## Building and testing Miri
@@ -244,6 +249,14 @@ rustup toolchain link stage2 build/x86_64-unknown-linux-gnu/stage2
244
249
rustup override set stage2
245
250
```
246
251
252
+ Note: When you are working with a locally built rustc or any other toolchain that
253
+ is not the same as the one in ` rust-version ` , you should not have ` .auto-everything ` or
254
+ ` .auto-toolchain ` as that will keep resetting your toolchain.
255
+
256
+ ```
257
+ rm -f .auto-everything .auto-toolchain
258
+ ```
259
+
247
260
Important: You need to delete the Miri cache when you change the stdlib; otherwise the
248
261
old, chached version will be used. On Linux, the cache is located at ` ~/.cache/miri ` ,
249
262
and on Windows, it is located at ` %LOCALAPPDATA%\rust-lang\miri\cache ` ; the exact
Original file line number Diff line number Diff line change @@ -48,14 +48,34 @@ Pass extra flags to all cargo invocations.
48
48
EOF
49
49
)
50
50
51
- # # Preparation
51
+ # # We need to know where we are.
52
52
# macOS does not have a useful readlink/realpath so we have to use Python instead...
53
53
MIRIDIR=$( python3 -c ' import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' " $0 " )
54
- TOOLCHAIN=$( cd " $MIRIDIR " ; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
55
54
56
- # Determine command.
55
+ # # Run the auto-things.
56
+ if [ -z " $AUTO_OPS " ]; then
57
+ export AUTO_OPS=42
58
+
59
+ # Run this first, so that the toolchain doesn't change after
60
+ # other code has run.
61
+ if [ -f " $MIRIDIR /.auto-everything" ] || [ -f " $MIRIDIR /.auto-toolchain" ] ; then
62
+ " $MIRIDIR " /rustup-toolchain
63
+ fi
64
+
65
+ if [ -f " $MIRIDIR /.auto-everything" ] || [ -f " $MIRIDIR /.auto-fmt" ] ; then
66
+ $0 fmt
67
+ fi
68
+
69
+ if [ -f " $MIRIDIR /.auto-everything" ] || [ -f " $MIRIDIR /.auto-clippy" ] ; then
70
+ $0 clippy -- -D warnings
71
+ fi
72
+ fi
73
+
74
+ # # Determine command and toolchain.
57
75
COMMAND=" $1 "
58
76
[ $# -gt 0 ] && shift
77
+ # Doing this *after* auto-toolchain logic above, since that might change the toolchain.
78
+ TOOLCHAIN=$( cd " $MIRIDIR " ; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
59
79
60
80
# # Handle some commands early, since they should *not* alter the environment.
61
81
case " $COMMAND " in
You can’t perform that action at this time.
0 commit comments