Skip to content

Commit 95b6d19

Browse files
committed
chore: explain why out-dir in build_lib
1 parent 3d9db6b commit 95b6d19

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bootstrap/src/test.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ pub struct TestCase {
110110

111111
impl TestCase {
112112
pub fn build(&self, manifest: &Manifest) {
113-
std::fs::create_dir_all(self.output.parent().unwrap()).unwrap();
113+
let output_dir = self.output.parent().unwrap();
114+
std::fs::create_dir_all(output_dir).unwrap();
114115
let mut command = manifest.rustc();
115116
command
116117
.args(["--crate-type", "bin"])
@@ -123,14 +124,15 @@ impl TestCase {
123124
}
124125

125126
pub fn build_lib(&self, manifest: &Manifest) {
126-
std::fs::create_dir_all(self.output.parent().unwrap()).unwrap();
127+
let output_dir = self.output.parent().unwrap();
128+
std::fs::create_dir_all(output_dir).unwrap();
127129
let mut command = manifest.rustc();
128130
command
129131
.args(["--crate-type", "lib"])
130132
.arg("-O")
131133
.arg(&self.source)
132-
.arg("--out-dir")
133-
.arg(self.output.parent().unwrap());
134+
.arg("--out-dir") // we use `--out-dir` to integrate with the default name convention
135+
.arg(output_dir); // so here we ignore the filename and just use the directory
134136
log::debug!("running {:?}", command);
135137
command.status().unwrap();
136138
}

0 commit comments

Comments
 (0)