-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match hyphen in multi-revision comment matchers #124137
Conversation
rustbot has assigned @compiler-errors. Use |
Some changes occurred in src/tools/compiletest cc @jieyouxu |
Reasoning: https://github.com/rust-lang/rust/pull/123816/files#diff-0238262528c07a864b8aa49d6d3aa989c49b045a012b1a8e2c491c84e3ccac3b wasn't matching anything labeled |
r? @jieyouxu |
The new regex looks good, @tgross35. Would you mind adding a unit test for the |
Making revision names accept - makes sense to me, but I don't remember if the dash messes with crate names generated by revisions, could you double check if something like
isn't borked? |
IIRC revision names are used in crate names for artifact names and output, I don't immediately recall if we normalized it to become underscore. |
src/tools/compiletest/src/errors.rs
Outdated
@@ -118,14 +118,14 @@ fn parse_expected( | |||
// //[rev1]~ | |||
// //[rev1,rev2]~^^ | |||
static RE: Lazy<Regex> = | |||
Lazy::new(|| Regex::new(r"//(?:\[(?P<revs>[\w,]+)])?~(?P<adjust>\||\^*)").unwrap()); | |||
Lazy::new(|| Regex::new(r"//(?:\[(?P<revs>.+)])?~(?P<adjust>\||\^*)").unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this regex mean test.name
is accepted, along other non-alphanumeric characters? If so, that will break anything using revision name as crate names unless you also perform "name mangling" to normalize the non-alphanumeric characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another case of "silently failing" in compiletest where it really really needs to loudly report that your directives don't work and won't work as expected...
#123816 is modifying a test case that already uses However, generally restricting revision names to valid ASCII-only identifiers seems reasonable to me (as long as we give a good error message when compiletest encounters an invalid revision name 🙂) |
I think that only recently works because I added some explicit crate name mangling for revisioned run-rustfix: #123601, which modifying the accepted revision name regex luckily hits. But that only handles . and - I want to say? So if the revision name contains a $ it probably breaks? |
I think we could just only accept revision names that are crate-name-like (that is, restrict revision names to only consist of alphanumeric + underscore characters), and report an error otherwise. I don't think we want to perform any weird crate name mangling, because e.g. if you naively mangle |
I agree, the simpler the better. |
Having What would you prefer for this PR? I can leave it as-is and add a test, or change back to the original pattern and just add |
Huh, I suppose then it does work with |
But otherwise it seems like an oversight that |
4b4673c
to
23fea67
Compare
I changed this PR to just do the simplest thing and match Since there is no new rejecting behavior, is this okay as-is or do you want a test still? (if so, what would that look like - just a dummy UI test?) |
Could you still add a unit test for |
Alrightie I added a simple test, let me know if that looks fine. |
23fea67
to
feec066
Compare
Tidy failed so it didn't push before, should be up to date now |
This comment has been minimized.
This comment has been minimized.
Currently, the matcher `//[rev-foo,rev-bar]~` does not get selected by the regex. Change the matcher to also match strings that contain a `-`.h
feec066
to
282488c
Compare
Looks good to me, thanks for the patch! @bors r+ rollup |
Thanks! |
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#123409 (Implement Modified Condition/Decision Coverage) - rust-lang#124104 (Fix capturing duplicated lifetimes via parent in `precise_captures` (`impl use<'...>`)) - rust-lang#124137 (Match hyphen in multi-revision comment matchers) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124137 - tgross35:testsuite-multi-rev-regex, r=jieyouxu Match hyphen in multi-revision comment matchers Currently, the matcher `//[rev-foo,rev-bar]~` does not get selected by the regex. Change the matcher to include `-`.
Thanks for getting this fixed, everyone! |
Currently, the matcher
//[rev-foo,rev-bar]~
does not get selected by the regex. Change the matcher to include-
.