Skip to content

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Oct 3, 2025


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

@rustbot
Copy link
Collaborator

rustbot commented Oct 3, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Oct 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 3, 2025

jieyouxu is currently at their maximum review capacity.
They may take a while to respond.

@rustbot

This comment has been minimized.

@Zalathar
Copy link
Contributor Author

Zalathar commented Oct 3, 2025

Fixed soft conflict with #146166.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +1031 to +1034
// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +1049 to +1062
// 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)
Copy link
Member

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.

Comment on lines +57 to +60
// 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());
Copy link
Member

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 {
Copy link
Member

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.

@jieyouxu
Copy link
Member

jieyouxu commented Oct 4, 2025

@bors r+ rollup

@jieyouxu
Copy link
Member

jieyouxu commented Oct 4, 2025

@bors ping

@jieyouxu jieyouxu closed this Oct 4, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 4, 2025
@jieyouxu jieyouxu reopened this Oct 4, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 4, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Oct 4, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Oct 4, 2025

📌 Commit e73c221 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 4, 2025
@Zalathar
Copy link
Contributor Author

Zalathar commented Oct 4, 2025

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.

@jieyouxu
Copy link
Member

jieyouxu commented Oct 4, 2025

👍 If we can get away with stricter, fantastic.

Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
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
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
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
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
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
bors added a commit that referenced this pull request Oct 4, 2025
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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 4, 2025
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
bors added a commit that referenced this pull request Oct 4, 2025
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
@matthiaskrgr
Copy link
Member

@bors r-
#147330 (comment)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 4, 2025

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.

@Zalathar
Copy link
Contributor Author

Zalathar commented Oct 4, 2025

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

rust-bors bot added a commit that referenced this pull request Oct 4, 2025
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
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Oct 5, 2025

☀️ Try build successful (CI)
Build commit: a984016 (a984016f410340123a5e61af016d0f18cd5c5a3b, parent: 2cb4e7dce84fdebc0279159f1082f92b99299d87)

@Zalathar
Copy link
Contributor Author

Zalathar commented Oct 5, 2025

@bors r=jieyouxu

@bors
Copy link
Collaborator

bors commented Oct 5, 2025

📌 Commit 33c99a0 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 5, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 5, 2025
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
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 5, 2025
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
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 5, 2025
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
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 5, 2025
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
bors added a commit that referenced this pull request Oct 5, 2025
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
bors added a commit that referenced this pull request Oct 5, 2025
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
@bors bors merged commit 59982f9 into rust-lang:master Oct 5, 2025
11 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 5, 2025
rust-timer added a commit that referenced this pull request Oct 5, 2025
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
@Zalathar Zalathar deleted the directive branch October 5, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants