Skip to content

Conversation

fmease
Copy link
Member

@fmease fmease commented Feb 1, 2025

The compiletest DSL still features a historical remnant from the time when its directives were merely prefixed with // instead of //@ when unknown directive names weren't rejected since they could just as well be part of prose:

As an "optimization", it stops looking for directives once it stumbles upon a line which starts with either fn or mod. This is super footgun-y as it obviously leads to any seeming compiletest directives below fn and mod items getting completely ignored.

See #136403 for a practical example. As well the assembly test updated in this PR.

Blocked on #136403. (merged)

@fmease fmease added S-blocked Status: Blocked on something else such as an RFC or other implementation work. rla-silenced Silences rust-log-analyzer postings to the PR it's added on. labels Feb 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 1, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Feb 1, 2025
Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

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

This doesn't seem to be an optimization with a warm page cache. Maybe with a cold one.

lol

(cc @jieyouxu)

@jieyouxu
Copy link
Member

jieyouxu commented Feb 2, 2025

Yes this is known, I'll double-check why we didn't remove this a bit later today

@fmease
Copy link
Member Author

fmease commented Feb 2, 2025

double-check why we didn't remove this

Prolly cuz of the long time window in which we kept trying to detect directives in non-//@ comments in order to direct people to the new syntax. If we had removed it while that was still in place, compiletest would've likely started misinterpreting a lot of normal comments as directives where it wouldn't've done so before

@jieyouxu
Copy link
Member

jieyouxu commented Feb 2, 2025

Prolly cuz of the long time window in which we kept trying to detect directives in non-//@ comments in order to direct people to the new syntax. If we had removed it while that was still in place, compiletest would've likely started misinterpreting a lot of normal comments as directives where it wouldn't've done so before

It's actually very simple (since the comment says // FIXME(jieyouxu)). The reason is that the PR which removed some // detection was authored by me, and then this person @jieyouxu forgot about the follow-up (which is actually what this PR does). Oops. It was left as a follow-up because at the time I didn't do any benchmarking.

#131392 (comment)

@jieyouxu
Copy link
Member

jieyouxu commented Feb 2, 2025

r? jieyouxu

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.

I added a temp commit to fix the test, then benchmarked locally on x86_64-unknown-linux-gnu1:

hyperfine --runs 5 --ignore-failure "./x test tests/ui --stage 1 --force-rerun" --show-output

Before removing this "optimization" (by reverting this PR):

Build completed successfully in 0:01:16
  Time (mean ± σ):     67.854 s ±  0.822 s    [User: 918.613 s, System: 309.796 s]
  Range (min … max):   67.287 s … 69.307 s    5 runs

After removing this "optimization":

Build completed successfully in 0:01:14
  Time (mean ± σ):     67.683 s ±  0.332 s    [User: 909.790 s, System: 305.177 s]
  Range (min … max):   67.196 s … 68.064 s    5 runs

Looks good to me as well. Thanks for removing this!

Footnotes

  1. This benchmark is very very coarse, I was only looking for big regressions. This obviously doesn't test cold page cache, but I don't think that's super worth to optimize for, versus actual problems of ignoring //@ in tests.

@jieyouxu jieyouxu removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 2, 2025
@fmease fmease force-pushed the rm-compiletest-relic-of-the-past branch from 3e0242c to b7860f0 Compare February 3, 2025 03:14
@fmease fmease force-pushed the rm-compiletest-relic-of-the-past branch from b7860f0 to f88f0a8 Compare February 3, 2025 04:45
@fmease fmease removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. rla-silenced Silences rust-log-analyzer postings to the PR it's added on. labels Feb 3, 2025
@fmease
Copy link
Member Author

fmease commented Feb 3, 2025

I had to update tests/assembly/small_data_threshold.rs which needlessly/confusingly used //@ for those LLVM CHECK directives. It's good that we're rejecting it now (until "compiletest"/… uses //@ for real for FileCheck, cc #125813). Waiting on CI.

@fmease fmease marked this pull request as ready for review February 3, 2025 04:49
@rustbot
Copy link
Collaborator

rustbot commented Feb 3, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@jieyouxu
Copy link
Member

jieyouxu commented Feb 3, 2025

I had to update tests/assembly/small_data_threshold.rs which needlessly/confusingly used //@ for those LLVM CHECK directives. It's good that we're rejecting it now (until "compiletest"/… uses //@ for real for FileCheck, cc #125813). Waiting on CI.

Fortunately (or unfortunately) FileCheck doesn't care about the comment prefix

@fmease
Copy link
Member Author

fmease commented Feb 3, 2025

@bors r=Noratrieb,jieyouxu rollup

@bors
Copy link
Collaborator

bors commented Feb 3, 2025

📌 Commit f88f0a8 has been approved by Noratrieb,jieyouxu

It is now in the queue for this repository.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 3, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 3, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang#136356 (Docs for f16 and f128: correct a typo and add details)
 - rust-lang#136404 (Remove a footgun-y feature / relic of the past from the compiletest DSL)
 - rust-lang#136432 (LTA: Actually check where-clauses for well-formedness at the def site)
 - rust-lang#136438 (miri: improve error when offset_from preconditions are violated)
 - rust-lang#136441 ([`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic)
 - rust-lang#136455 (Remove some `Clone` bounds and derives.)
 - rust-lang#136464 (Remove hook calling via `TyCtxtAt`.)
 - rust-lang#136467 (override default config profile on tarballs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ca23707 into rust-lang:master Feb 3, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 3, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 3, 2025
Rollup merge of rust-lang#136404 - fmease:rm-compiletest-relic-of-the-past, r=Noratrieb,jieyouxu

Remove a footgun-y feature / relic of the past from the compiletest DSL

The compiletest DSL still features a historical remnant from the time when its directives were merely prefixed with `//` instead of `//`@`` when unknown directive names weren't rejected since they could just as well be part of prose:

As an "optimization", it stops looking for directives once it stumbles upon a line which starts with either `fn` or `mod`. This is super footgun-y as it obviously leads to any seeming compiletest directives below `fn` and `mod` items getting completely ignored.

See rust-lang#136403 for a practical example. As well the assembly test updated in this PR.

~~Blocked on rust-lang#136403.~~ (merged)
@fmease fmease deleted the rm-compiletest-relic-of-the-past branch February 3, 2025 23:55
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.

6 participants