about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorDavid Knaack <davidkna@users.noreply.github.com>2022-06-26 10:51:23 +0200
committerDavid Knaack <davidkna@users.noreply.github.com>2022-06-26 23:15:47 +0200
commit93d3359d37bd4f0c5e4a73617ee554f536582a50 (patch)
tree653384e0eccbd6610a851d31ae2c94da0aa6c441 /src/tools/compiletest
parent788ddedb0d88e40db9cd62b6163d5a471813044b (diff)
downloadrust-93d3359d37bd4f0c5e4a73617ee554f536582a50.tar.gz
rust-93d3359d37bd4f0c5e4a73617ee554f536582a50.zip
compiletest: add issue number param to `known-bug`
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/header.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 5352f7c6fe0..31e979a574b 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -395,7 +395,29 @@ impl TestProps {
                 );
                 config.set_name_directive(ln, STDERR_PER_BITWIDTH, &mut self.stderr_per_bitwidth);
                 config.set_name_directive(ln, INCREMENTAL, &mut self.incremental);
-                config.set_name_directive(ln, KNOWN_BUG, &mut self.known_bug);
+
+                // Unlike the other `name_value_directive`s this needs to be handled manually,
+                // because it sets a `bool` flag.
+                if let Some(known_bug) = config.parse_name_value_directive(ln, KNOWN_BUG) {
+                    let known_bug = known_bug.trim();
+                    if known_bug == "unknown"
+                        || known_bug.split(',').all(|issue_ref| {
+                            issue_ref
+                                .trim()
+                                .split_once('#')
+                                .filter(|(_, number)| {
+                                    number.chars().all(|digit| digit.is_numeric())
+                                })
+                                .is_some()
+                        })
+                    {
+                        self.known_bug = true;
+                    } else {
+                        panic!(
+                            "Invalid known-bug value: {known_bug}\nIt requires comma-separated issue references (`#000` or `chalk#000`) or `unknown`."
+                        );
+                    }
+                }
                 config.set_name_value_directive(ln, MIR_UNIT_TEST, &mut self.mir_unit_test, |s| {
                     s.trim().to_string()
                 });