Skip to content

Commit 8d754e6

Browse files
authored
Merge pull request #485 from apoelstra/2018-10-comment-482
add some comments to clarify command-line argument munging in #482
2 parents 38ed191 + 4fa5bfa commit 8d754e6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bin/cargo-miri.rs

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ fn main() {
9999
);
100100
match (test, &kind[..]) {
101101
(true, "test") => {
102+
// For test binaries we call `cargo rustc --test target -- <rustc args>`
102103
if let Err(code) = process(
103104
vec!["--test".to_string(), target.name].into_iter().chain(
104105
args,
@@ -109,6 +110,11 @@ fn main() {
109110
}
110111
}
111112
(true, "lib") => {
113+
// For libraries we call `cargo rustc -- --test <rustc args>`
114+
// Notice now that `--test` is a rustc arg rather than a cargo arg. This tells
115+
// rustc to build a test harness which calls all #[test] functions. We don't
116+
// use the harness since we execute each #[test] function's MIR ourselves before
117+
// compilation even completes, but this option is necessary to build the library.
112118
if let Err(code) = process(
113119
vec!["--".to_string(), "--test".to_string()].into_iter().chain(
114120
args,
@@ -119,6 +125,7 @@ fn main() {
119125
}
120126
}
121127
(false, "bin") => {
128+
// For ordinary binaries we call `cargo rustc --bin target -- <rustc args>`
122129
if let Err(code) = process(
123130
vec!["--bin".to_string(), target.name].into_iter().chain(
124131
args,

0 commit comments

Comments
 (0)