Skip to content

Commit 0790f75

Browse files
committed
make cargo-miri a separate crate in a workspace
1 parent b334004 commit 0790f75

File tree

6 files changed

+53
-34
lines changed

6 files changed

+53
-34
lines changed

Cargo.lock

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
[package]
2-
authors = ["Scott Olson <scott@solson.me>"]
3-
description = "An experimental interpreter for Rust MIR."
2+
authors = ["Miri Team"]
3+
description = "An experimental interpreter for Rust MIR (core driver)."
44
license = "MIT/Apache-2.0"
55
name = "miri"
66
repository = "https://github.com/rust-lang/miri"
77
version = "0.1.0"
88
default-run = "miri"
99
edition = "2018"
1010

11+
[workspace]
12+
members = ["cargo-miri"]
13+
1114
[lib]
1215
test = true # we have unit tests
1316
doctest = false # but no doc tests
@@ -17,24 +20,13 @@ name = "miri"
1720
test = false # we have no unit tests
1821
doctest = false # and no doc tests
1922

20-
[[bin]]
21-
name = "cargo-miri"
22-
test = false # we have no unit tests
23-
doctest = false # and no doc tests
24-
required-features = ["cargo_miri"]
25-
2623
[[bin]]
2724
name = "miri-rustc-tests"
2825
test = false # we have no unit tests
2926
doctest = false # and no doc tests
3027
required-features = ["rustc_tests"]
3128

3229
[dependencies]
33-
cargo_metadata = { version = "0.9.0", optional = true }
34-
directories = { version = "2.0", optional = true }
35-
rustc_version = { version = "0.2.3", optional = true }
36-
serde_json = { version = "1.0.40", optional = true }
37-
3830
getrandom = { version = "0.1.8", features = ["std"] }
3931
byteorder = "1.3"
4032
env_logger = "0.7.1"
@@ -48,19 +40,10 @@ rand = "0.7"
4840
# for more information.
4941
rustc-workspace-hack = "1.0.0"
5042

51-
# Some extra dependency for better feature control to avoid having to rebuild
52-
# between "cargo build" and "cargo intall".
53-
num-traits = "*"
54-
serde = { version = "*", features = ["derive"] }
55-
56-
[build-dependencies]
57-
vergen = "3"
58-
5943
[dev-dependencies]
6044
compiletest_rs = { version = "0.5", features = ["tmp"] }
45+
rustc_version = "0.2.3"
6146
colored = "1.6"
6247

6348
[features]
64-
default = ["cargo_miri"]
65-
cargo_miri = ["cargo_metadata", "directories", "rustc_version", "serde_json"]
6649
rustc_tests = []

cargo-miri/Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
authors = ["Miri Team"]
3+
description = "An experimental interpreter for Rust MIR (cargo wrapper)."
4+
license = "MIT/Apache-2.0"
5+
name = "cargo-miri"
6+
repository = "https://github.com/rust-lang/miri"
7+
version = "0.1.0"
8+
edition = "2018"
9+
10+
[[bin]]
11+
name = "cargo-miri"
12+
path = "bin.rs"
13+
test = false # we have no unit tests
14+
doctest = false # and no doc tests
15+
16+
[dependencies]
17+
cargo_metadata = "0.9.0"
18+
directories = "2.0"
19+
rustc_version = "0.2.3"
20+
serde_json = "1.0.40"
21+
22+
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
23+
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
24+
# for more information.
25+
rustc-workspace-hack = "1.0.0"
26+
27+
[build-dependencies]
28+
vergen = "3"
File renamed without changes.
File renamed without changes.

miri

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ fi
5959
# Build a sysroot and set MIRI_SYSROOT to use it. Arguments are passed to `cargo miri setup`.
6060
build_sysroot() {
6161
# Build once, for the user to see.
62-
cargo run $CARGO_BUILD_FLAGS --bin cargo-miri -- miri setup "$@"
62+
cargo run $CARGO_BUILD_FLAGS -p cargo-miri -- miri setup "$@"
6363
# Call again, to just set env var.
64-
export MIRI_SYSROOT="$(cargo run $CARGO_BUILD_FLAGS -q --bin cargo-miri -- miri setup --print-sysroot "$@")"
64+
export MIRI_SYSROOT="$(cargo run $CARGO_BUILD_FLAGS -q -p cargo-miri -- miri setup --print-sysroot "$@")"
6565
}
6666

6767
# Prepare and set MIRI_SYSROOT. Respects `MIRI_TEST_TARGET` and takes into account
@@ -104,21 +104,23 @@ case "$COMMAND" in
104104
install|install-debug)
105105
# "--locked" to respect the Cargo.lock file if it exists,
106106
# "--offline" to avoid querying the registry (for yanked packages).
107-
exec cargo install $CARGO_INSTALL_FLAGS --path "$(dirname "$0")" --force --locked --offline "$@"
107+
cargo install $CARGO_INSTALL_FLAGS --path "$(dirname "$0")" --force --locked --offline "$@"
108+
cargo install $CARGO_INSTALL_FLAGS --path "$(dirname "$0")"/cargo-miri --force --locked --offline "$@"
108109
;;
109110
check|check-debug)
110111
# Check, and let caller control flags.
111-
exec cargo check $CARGO_BUILD_FLAGS "$@"
112+
exec cargo check $CARGO_BUILD_FLAGS --all "$@"
112113
;;
113114
build|build-debug)
114115
# Build, and let caller control flags.
115-
exec cargo build $CARGO_BUILD_FLAGS "$@"
116+
exec cargo build $CARGO_BUILD_FLAGS --all "$@"
116117
;;
117118
test|test-debug)
118119
# First build and get a sysroot.
119120
cargo build $CARGO_BUILD_FLAGS
120121
find_sysroot
121122
# Then test, and let caller control flags.
123+
# No `--all` as `cargo-miri` has no tests.
122124
exec cargo test $CARGO_BUILD_FLAGS "$@"
123125
;;
124126
run|run-debug)

0 commit comments

Comments
 (0)