-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Compiletest: Simplify {Html,Json}DocCk directive handling #143850
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
base: master
Are you sure you want to change the base?
Conversation
The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. cc @BoxyUwU, @jieyouxu, @Kobzol, @tshepang Some changes occurred in src/tools/compiletest cc @jieyouxu |
if args and not args[:1].isspace(): | ||
print_err(lineno, line, "Invalid template syntax") | ||
continue |
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.
In a roundabout way this used to check that the separator between the directive and its args was a space because the capture group args
used to immediately follow the directive name.
This comment has been minimized.
This comment has been minimized.
src/etc/htmldocck.py
Outdated
LINE_PATTERN = re.compile( | ||
r""" | ||
//@\s+ | ||
(?P<negated>!?)(?P<cmd>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*) | ||
(?P<negated>!?)(?P<cmd>.+?) | ||
[\s:] |
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.
I basically had to extend the grammar of {Html,Json}DocCk directives to admit :
as a legal separator besides whitespace.
Otherwise it would've either been included in the args if I hadn't relaxed cmd
's grammar (so //@ has: ...
would've meant [has
, : ...
]) which would've lead to bad diagnostics down the line like "unexpected argument" (because : ...
would've been further split into [:
, ...
] by shlex) or it would've been accepted by compiletest but rejected ignored by HtmlDocCk (remember, we can't reject any unknown or malformed directives in HtmlDocCk since it no longer knows if it's a compiletest directive or not).
Disregarding the technical reasons, {Html,Json}DocCk directives should be extensions to regular compiletest directives, so it only makes sense that :
is allowed as a separator.
c9870d8
to
48c3962
Compare
48c3962
to
60471e3
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
1be2c85
to
917171a
Compare
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.
Thanks, two comment nits, otherwise LGTM.
Feel free to r=me with or without the comment nits. |
917171a
to
e3ead19
Compare
@bors r=jieyouxu rollup (meta) |
Rollup of 12 pull requests Successful merges: - #143776 (std: move NuttX to use arc4random for random number generation) - #143778 (Some const_trait_impl test cleanups) - #143782 (Disambiguate between rustc vs std having debug assertions in `run-make-support` and `run-make` tests) - #143791 (Update sysinfo version to `0.36.0`) - #143796 (Fix ICE for parsed attributes with longer path not handled by CheckAttribute) - #143798 (Remove format short command trait) - #143803 (New tracking issues for const_ops and const_cmp) - #143814 (htmldocck: better error messages for some negative directives) - #143817 (Access `wasi_sdk_path` instead of reading environment variable in bootstrap) - #143822 (./x test miri: fix cleaning the miri_ui directory) - #143823 ([COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups) - #143841 (Label clippy changes with `T-clippy`) Failed merges: - #143850 (Compiletest: Simplify {Html,Json}DocCk directive handling) r? `@ghost` `@rustbot` modify labels: rollup
This comment was marked as resolved.
This comment was marked as resolved.
e3ead19
to
25794b1
Compare
@bors r=jieyouxu |
…g, r=jieyouxu Compiletest: Simplify {Html,Json}DocCk directive handling So much more maintainable and extensible. r? `@jieyouxu` as discussed
Rollup of 8 pull requests Successful merges: - #142885 (core: Add `BorrowedCursor::with_unfilled_buf`) - #143217 (Port #[link_ordinal] to the new attribute parsing infrastructure) - #143355 (wrapping shift: remove first bitmask and table) - #143448 (remote-test-client: Exit code `128 + <signal-number>` instead of `3`) - #143724 (Tidy cleanup) - #143820 (Fixed a core crate compilation failure when enabling the `optimize_for_size` feature on some targets) - #143850 (Compiletest: Simplify {Html,Json}DocCk directive handling) - #143880 (tests: Test line debuginfo for linebreaked function parameters) Failed merges: - #143630 (Drop `./x suggest`) - #143733 (Change bootstrap's `tool.TOOL_NAME.features` to work on any subcommand) r? `@ghost` `@rustbot` modify labels: rollup
So much more maintainable and extensible.
r? @jieyouxu as discussed