Skip to content

Commit 188f7ce

Browse files
committed
Use the same AuxProps parser for EarlyProps
1 parent 78fd3b5 commit 188f7ce

File tree

3 files changed

+9
-28
lines changed

3 files changed

+9
-28
lines changed

src/tools/compiletest/src/header.rs

+5-26
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ impl HeadersCache {
3535
/// the test.
3636
#[derive(Default)]
3737
pub struct EarlyProps {
38-
pub aux: Vec<String>,
39-
pub aux_bin: Vec<String>,
40-
pub aux_crate: Vec<(String, String)>,
38+
/// Auxiliary crates that should be built and made available to this test.
39+
/// Included in [`EarlyProps`] so that the indicated files can participate
40+
/// in up-to-date checking. Building happens via [`TestProps::aux`] instead.
41+
pub(crate) aux: AuxProps,
4142
pub revisions: Vec<String>,
4243
}
4344

@@ -57,21 +58,7 @@ impl EarlyProps {
5758
testfile,
5859
rdr,
5960
&mut |HeaderLine { directive: ln, .. }| {
60-
config.push_name_value_directive(ln, directives::AUX_BUILD, &mut props.aux, |r| {
61-
r.trim().to_string()
62-
});
63-
config.push_name_value_directive(
64-
ln,
65-
directives::AUX_BIN,
66-
&mut props.aux_bin,
67-
|r| r.trim().to_string(),
68-
);
69-
config.push_name_value_directive(
70-
ln,
71-
directives::AUX_CRATE,
72-
&mut props.aux_crate,
73-
Config::parse_aux_crate,
74-
);
61+
parse_and_update_aux(config, ln, &mut props.aux);
7562
config.parse_and_update_revisions(ln, &mut props.revisions);
7663
},
7764
);
@@ -920,14 +907,6 @@ fn iter_header(
920907
}
921908

922909
impl Config {
923-
fn parse_aux_crate(r: String) -> (String, String) {
924-
let mut parts = r.trim().splitn(2, '=');
925-
(
926-
parts.next().expect("missing aux-crate name (e.g. log=log.rs)").to_string(),
927-
parts.next().expect("missing aux-crate value (e.g. log=log.rs)").to_string(),
928-
)
929-
}
930-
931910
fn parse_and_update_revisions(&self, line: &str, existing: &mut Vec<String>) {
932911
if let Some(raw) = self.parse_name_value_directive(line, "revisions") {
933912
let mut duplicates: HashSet<_> = existing.iter().cloned().collect();

src/tools/compiletest/src/header/tests.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ fn aux_build() {
242242
//@ aux-build: b.rs
243243
"
244244
)
245-
.aux,
245+
.aux
246+
.builds,
246247
vec!["a.rs", "b.rs"],
247248
);
248249
}

src/tools/compiletest/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,8 @@ fn files_related_to_test(
862862
related.push(testpaths.file.clone());
863863
}
864864

865-
for aux in &props.aux {
865+
for aux in &props.aux.builds {
866+
// FIXME(Zalathar): Perform all `auxiliary` path resolution in one place.
866867
let path = testpaths.file.parent().unwrap().join("auxiliary").join(aux);
867868
related.push(path);
868869
}

0 commit comments

Comments
 (0)