Skip to content

Commit 4b4673c

Browse files
committed
Match any characters in multi-revision comment matchers
Currently, the matcher `//[rev-foo,rev-bar]~` does not get selected by the regex, nor does anything that includes whitespace Change the regex matcher to be more flexible and capture anything within the `[...]` brackets, and trim the result before testing.
1 parent 3412f01 commit 4b4673c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tools/compiletest/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ fn parse_expected(
118118
// //[rev1]~
119119
// //[rev1,rev2]~^^
120120
static RE: Lazy<Regex> =
121-
Lazy::new(|| Regex::new(r"//(?:\[(?P<revs>[\w,]+)])?~(?P<adjust>\||\^*)").unwrap());
121+
Lazy::new(|| Regex::new(r"//(?:\[(?P<revs>.+)])?~(?P<adjust>\||\^*)").unwrap());
122122

123123
let captures = RE.captures(line)?;
124124

125125
match (test_revision, captures.name("revs")) {
126126
// Only error messages that contain our revision between the square brackets apply to us.
127127
(Some(test_revision), Some(revision_filters)) => {
128-
if !revision_filters.as_str().split(',').any(|r| r == test_revision) {
128+
if !revision_filters.as_str().split(',').map(str::trim).any(|r| r == test_revision) {
129129
return None;
130130
}
131131
}

0 commit comments

Comments
 (0)