Repository navigation
Conversation
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
These refactorings aren't the most exciting, I wanted to do more but ran out of time last Sunday as I had to dip. One "large" thing I want to do eventually is to avoid reparsing directives. AFAICT for the UI test suite, we always parse directives twice, first when "constructing" the test ( For that I could be mistaken but for the rustdoc-html test suite it seemed like we parse directives 4 times. Needs investigation. Once we only parse directives once, it should be easier to make errors in |
5f8f169 to
2c1918d
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I've addressed your comments and implemented some more checks (as alluded to in my Zulip PM):
>>> Changes since your last review <<<. @rustbot review |
b71bb77 to
edb7c1f
Compare
This comment has been minimized.
This comment has been minimized.
3bf4f7d to
f174681
Compare
And stop accepting 1. empty or "non-identifier" directive names, 2. empty values (after the `:`)
…vision conditions
| help!( | ||
| "the name has to be a non-empty sequence of alphanumeric characters, \ | ||
| `_`, `-` and `!`" | ||
| ); |
There was a problem hiding this comment.
Unfortunately there's a spanner in the works, because of how //@ ignore-$target works. You see, there are some funny targets with periods in their names, because why not:
rust/src/tools/tier-check/src/main.rs
Lines 45 to 55 in 5c9cae3
So I think right now we would reject //@ ignore-thumbv8m.base-none-eabi. I kinda hate target names that have a . in them, but... yeah.
| ErrorKind::EmptyValue => { | ||
| title("no non-empty value found after the colon `:`"); | ||
| help!("consider removing the colon"); | ||
| } |
There was a problem hiding this comment.
Hm, shouldn't we suggest providing a value? I guess it's 50/50:
- Either it's a name-only directive, so remove colon
- Or user forgor the value, so user should provide value
Maybe add another line of help for the "should provide value" case?
| // We need to allow `!` for {Html,Json}DocCk directives like `!has`. | ||
| let (name, payload) = directive | ||
| .find(|char| !is_identifier_char(char) && char != '!') | ||
| .map(|index| (&directive[..index], Some(directive[index..].trim_start()))) | ||
| .unwrap_or((directive, None)); |
There was a problem hiding this comment.
Here we split as soon as we find a non-identifier character (or !). But won't we accept other wonky forms like
//@ ignore-foo$
//@ ignore-bar.
//@ ignore-baz@
Should we enforce that if we find a name, the user must only provide:
- Only
:, so//@ name: valueform - Only whitespace, so
//@ ignore-wasm hello world - Or EOL, just
//@ ignore-wasm
|
☔ The latest upstream changes (presumably #166230) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
See individual commits for details. Follow-up to #165576 and #165483.
r? jieyouxu
(No LLM was or will be used by me during the entire creation process of this PR)