Skip to content

Commit 9703133

Browse files
committed
Error on trying to use revisions in run-make tests
Currently `run-make` tests do not support revisions.
1 parent 8f8bee4 commit 9703133

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/tools/compiletest/src/header.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl EarlyProps {
5959
rdr,
6060
&mut |HeaderLine { directive: ln, .. }| {
6161
parse_and_update_aux(config, ln, &mut props.aux);
62-
config.parse_and_update_revisions(ln, &mut props.revisions);
62+
config.parse_and_update_revisions(testfile, ln, &mut props.revisions);
6363
},
6464
);
6565

@@ -391,7 +391,7 @@ impl TestProps {
391391
has_edition = true;
392392
}
393393

394-
config.parse_and_update_revisions(ln, &mut self.revisions);
394+
config.parse_and_update_revisions(testfile, ln, &mut self.revisions);
395395

396396
if let Some(flags) = config.parse_name_value_directive(ln, RUN_FLAGS) {
397397
self.run_flags.extend(split_flags(&flags));
@@ -907,12 +907,21 @@ fn iter_header(
907907
}
908908

909909
impl Config {
910-
fn parse_and_update_revisions(&self, line: &str, existing: &mut Vec<String>) {
910+
fn parse_and_update_revisions(&self, testfile: &Path, line: &str, existing: &mut Vec<String>) {
911911
if let Some(raw) = self.parse_name_value_directive(line, "revisions") {
912+
if self.mode == Mode::RunMake {
913+
panic!("`run-make` tests do not support revisions: {}", testfile.display());
914+
}
915+
912916
let mut duplicates: HashSet<_> = existing.iter().cloned().collect();
913917
for revision in raw.split_whitespace().map(|r| r.to_string()) {
914918
if !duplicates.insert(revision.clone()) {
915-
panic!("Duplicate revision: `{}` in line `{}`", revision, raw);
919+
panic!(
920+
"duplicate revision: `{}` in line `{}`: {}",
921+
revision,
922+
raw,
923+
testfile.display()
924+
);
916925
}
917926
existing.push(revision);
918927
}

0 commit comments

Comments
 (0)