-
Notifications
You must be signed in to change notification settings - Fork 13.8k
compiletest: Make DirectiveLine
responsible for name/value splitting
#147288
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
Conversation
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
This comment has been minimized.
This comment has been minimized.
Fixed soft conflict with #146166. |
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.
// FIXME(Zalathar): Ideally, this should raise an error if a name-only | ||
// directive is followed by a colon, since that's the wrong syntax. | ||
// But we would need to fix tests that rely on the current behaviour. | ||
line.name == directive |
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.
👍
// FIXME(Zalathar): This silently discards directives with a matching | ||
// name but no colon. Unfortunately, some directives (e.g. "pp-exact") | ||
// currently rely on _not_ panicking here. | ||
let value = line.value_after_colon()?; | ||
debug!("{}: {}", directive, value); | ||
let value = expand_variables(value.to_owned(), self); | ||
|
||
if value.is_empty() { | ||
error!("{testfile}:{line_number}: empty value for directive `{directive}`"); | ||
help!("expected syntax is: `{directive}: value`"); | ||
panic!("empty directive value detected"); | ||
} | ||
|
||
Some(value) |
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.
Remark: yeah, I would honestly vote for hard reject eventually.
// FIXME(Zalathar): This currently allows either a space or a colon, and | ||
// treats any "value" after a colon as though it were a remark. | ||
// We should instead forbid the colon syntax for these directives. | ||
let comment = line.remark_after_space().or_else(|| line.value_after_colon()); |
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.
Remark: agreed, we should reject the colon
case eventually
// delineate value. | ||
if name == "needs-target-has-atomic" { | ||
let Some(rest) = rest else { | ||
let Some(rest) = ln.value_after_colon() else { |
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.
Remark: hm, I suppose we don't have any tests relying on the old
behavior? In any case, this is stricter so.
@bors r+ rollup |
@bors ping |
@bors r+ rollup |
Yeah, I ended up doing a mixture of “same behaviour” and ”stricter behaviour” changes, depending on what was easier in context and what I could get away with. |
👍 If we can get away with stricter, fantastic. |
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
Rollup of 14 pull requests Successful merges: - #142670 (Document fully-qualified syntax in `as`' keyword doc) - #145685 (add CloneFromCell and Cell::get_cloned) - #146330 (Bump unicode_data and printables to version 17.0.0) - #146451 (Fix atan2 inaccuracy in documentation) - #146479 (add mem::conjure_zst) - #146874 (compiler: Hint at multiple crate versions if trait impl is for wrong ADT ) - #147117 (interpret `#[used]` as `#[used(compiler)]` on illumos) - #147190 (std: `sys::net` cleanups) - #147251 (Do not assert that a change in global cache only happens when concurrent) - #147280 (Return to needs-llvm-components being info-only) - #147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting) - #147309 (Add documentation about unwinding to wasm targets) - #147315 (bless autodiff batching test) - #147323 (Fix top level ui tests check in tidy) r? `@ghost` `@rustbot` modify labels: rollup
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
Rollup of 11 pull requests Successful merges: - #142670 (Document fully-qualified syntax in `as`' keyword doc) - #145685 (add CloneFromCell and Cell::get_cloned) - #146330 (Bump unicode_data and printables to version 17.0.0) - #146451 (Fix atan2 inaccuracy in documentation) - #146479 (add mem::conjure_zst) - #147117 (interpret `#[used]` as `#[used(compiler)]` on illumos) - #147190 (std: `sys::net` cleanups) - #147251 (Do not assert that a change in global cache only happens when concurrent) - #147280 (Return to needs-llvm-components being info-only) - #147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting) - #147315 (bless autodiff batching test) r? `@ghost` `@rustbot` modify labels: rollup
This PR was rebased onto a different master 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. |
Linking to items in docs is always a mistake. Anyway, let's run a few try jobs to make sure that this doesn't accidentally break anything in exotic places. @bors try jobs=x86_64-msvc-1,i686-msvc-1,x86_64-mingw-1,test-various,armhf-gnu,aarch64-apple |
compiletest: Make `DirectiveLine` responsible for name/value splitting try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1 try-job: test-various try-job: armhf-gnu try-job: aarch64-apple
This comment has been minimized.
This comment has been minimized.
@bors r=jieyouxu |
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
Rollup of 8 pull requests Successful merges: - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition) - #147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting) - #147309 (Add documentation about unwinding to wasm targets) - #147310 (Mark `PatternTypo` suggestion as maybe incorrect) - #147320 (Avoid to suggest pattern match on the similarly named in fn signature) - #147328 (Implement non-poisoning `Mutex::with_mut`, `RwLock::with` and `RwLock::with_mut`) - #147337 (Make `fmt::Write` a diagnostic item) - #147349 (Improve the advice given by panic_immediate_abort) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - #147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting) - #147309 (Add documentation about unwinding to wasm targets) - #147310 (Mark `PatternTypo` suggestion as maybe incorrect) - #147320 (Avoid to suggest pattern match on the similarly named in fn signature) - #147328 (Implement non-poisoning `Mutex::with_mut`, `RwLock::with` and `RwLock::with_mut`) - #147337 (Make `fmt::Write` a diagnostic item) - #147349 (Improve the advice given by panic_immediate_abort) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #147288 - Zalathar:directive, r=jieyouxu compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to #147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
DirectiveLine
instead of bare strings #147170.Now that all of the directive-parsing functions have access to a
DirectiveLine
, we can move all of the ad-hoc name/value splitting code intoDirectiveLine
itself, making directive parsing simpler and more consistent.The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits.
r? jieyouxu