From 4b4673c61cfed82018763028a20529d48c02b315 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 18 Apr 2024 17:17:47 -0400 Subject: [PATCH] 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. --- src/tools/compiletest/src/errors.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs index 140c3aa0a64ec..06836f52d19e2 100644 --- a/src/tools/compiletest/src/errors.rs +++ b/src/tools/compiletest/src/errors.rs @@ -118,14 +118,14 @@ fn parse_expected( // //[rev1]~ // //[rev1,rev2]~^^ static RE: Lazy = - Lazy::new(|| Regex::new(r"//(?:\[(?P[\w,]+)])?~(?P\||\^*)").unwrap()); + Lazy::new(|| Regex::new(r"//(?:\[(?P.+)])?~(?P\||\^*)").unwrap()); let captures = RE.captures(line)?; match (test_revision, captures.name("revs")) { // Only error messages that contain our revision between the square brackets apply to us. (Some(test_revision), Some(revision_filters)) => { - if !revision_filters.as_str().split(',').any(|r| r == test_revision) { + if !revision_filters.as_str().split(',').map(str::trim).any(|r| r == test_revision) { return None; } }