Skip to content

compiletest: Support matching diagnostics on lines below#139100

Merged
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:errbelow
Mar 30, 2025
Merged

compiletest: Support matching diagnostics on lines below#139100
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:errbelow

Conversation

@petrochenkov

Copy link
Copy Markdown
Contributor

Using //~vvv ERROR.

This is not needed often, but it's easy to support, and it allows to eliminate a class of error-patterns that cannot be eliminated in any other way.

See the diff for the examples of such patterns coming from parser.
Some of them can be matched by //~ ERROR or //~^ ERROR as well (when the final newline is allowed), but it changes the shape of reported spans, so I chose to keep the spans by using //~v ERROR.

@rustbot

rustbot commented Mar 29, 2025

Copy link
Copy Markdown
Collaborator

r? @estebank

rustbot has assigned @estebank.
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-rustc-dev-guide Area: rustc-dev-guide 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 29, 2025
@rustbot

rustbot commented Mar 29, 2025

Copy link
Copy Markdown
Collaborator

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

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@jieyouxu

Copy link
Copy Markdown
Member

r? jieyouxu

@rustbot rustbot assigned jieyouxu and unassigned estebank Mar 29, 2025
@jieyouxu

Copy link
Copy Markdown
Member

I'll take a look tmrw

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually nvm I looked at this today.

Thanks, this is a very nice improvement!

Comment on lines -1 to -2
//@ error-pattern: this file contains an unclosed delimiter
//@ error-pattern: mismatched closing delimiter: `]`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is very nice 👍

@jieyouxu

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Mar 29, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit cf451f0 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 Mar 29, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 29, 2025
compiletest: Support matching diagnostics on lines below

Using `//~vvv ERROR`.

This is not needed often, but it's easy to support, and it allows to eliminate a class of `error-pattern`s that cannot be eliminated in any other way.

See the diff for the examples of such patterns coming from parser.
Some of them can be matched by `//~ ERROR` or `//~^ ERROR` as well (when the final newline is allowed), but it changes the shape of reported spans, so I chose to keep the spans by using `//~v ERROR`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 29, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#137928 (stabilize const_cell)
 - rust-lang#138431 (Fix `uclibc` LLVM target triples)
 - rust-lang#138832 (Start using `with_native_path` in `std::sys::fs`)
 - rust-lang#139060 (replace commit placeholder in vendor status with actual commit)
 - rust-lang#139081 (std: deduplicate `errno` accesses)
 - rust-lang#139100 (compiletest: Support matching diagnostics on lines below)
 - rust-lang#139105 (`BackendRepr::is_signed`: comment why this may panics)
 - rust-lang#139106 (Mark .pp files as Rust)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 29, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#137928 (stabilize const_cell)
 - rust-lang#138431 (Fix `uclibc` LLVM target triples)
 - rust-lang#138832 (Start using `with_native_path` in `std::sys::fs`)
 - rust-lang#139081 (std: deduplicate `errno` accesses)
 - rust-lang#139100 (compiletest: Support matching diagnostics on lines below)
 - rust-lang#139105 (`BackendRepr::is_signed`: comment why this may panics)
 - rust-lang#139106 (Mark .pp files as Rust)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a584cc7 into rust-lang:master Mar 30, 2025
@rustbot rustbot added this to the 1.88.0 milestone Mar 30, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 30, 2025
Rollup merge of rust-lang#139100 - petrochenkov:errbelow, r=jieyouxu

compiletest: Support matching diagnostics on lines below

Using `//~vvv ERROR`.

This is not needed often, but it's easy to support, and it allows to eliminate a class of `error-pattern`s that cannot be eliminated in any other way.

See the diff for the examples of such patterns coming from parser.
Some of them can be matched by `//~ ERROR` or `//~^ ERROR` as well (when the final newline is allowed), but it changes the shape of reported spans, so I chose to keep the spans by using `//~v ERROR`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2025
compiletest: Require `//~` annotations even if `error-pattern` is specified

This is continuation of rust-lang#138865 with some help from rust-lang#139100.

`error-pattern` annotations that duplicate the newly added `//~` annotations are removed, other `error-pattern`s are not touched yet.

In exceptional cases `//@ compile-flags: --error-format=human` can be used to opt out of these checks.
In this PR I only had to use the opt out 3 times:
- `tests/ui/parser/utf16-{be,le}-without-bom.rs` - there are too many errors that are nearly identical (modulo location), because an error is reported on every second symbol
- `tests/ui-fulldeps/missing-rustc-driver-error.rs` - the errors list various rustc crate dependencies and may unexpectedly invalidate on random rustc changes
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2025
compiletest: Require `//~` annotations even if `error-pattern` is specified

This is continuation of rust-lang#138865 with some help from rust-lang#139100.

`error-pattern` annotations that duplicate the newly added `//~` annotations are removed, other `error-pattern`s are not touched yet.

In exceptional cases `//@ compile-flags: --error-format=human` can be used to opt out of these checks.
In this PR I only had to use the opt out 3 times:
- `tests/ui/parser/utf16-{be,le}-without-bom.rs` - there are too many errors that are nearly identical (modulo location), because an error is reported on every second symbol
- `tests/ui-fulldeps/missing-rustc-driver-error.rs` - the errors list various rustc crate dependencies and may unexpectedly invalidate on random rustc changes
github-actions Bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 2, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#137928 (stabilize const_cell)
 - rust-lang#138431 (Fix `uclibc` LLVM target triples)
 - rust-lang#138832 (Start using `with_native_path` in `std::sys::fs`)
 - rust-lang#139081 (std: deduplicate `errno` accesses)
 - rust-lang#139100 (compiletest: Support matching diagnostics on lines below)
 - rust-lang#139105 (`BackendRepr::is_signed`: comment why this may panics)
 - rust-lang#139106 (Mark .pp files as Rust)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2025
compiletest: Require `//~` annotations even if `error-pattern` is specified

This is continuation of rust-lang#138865 with some help from rust-lang#139100.

`error-pattern` annotations that duplicate the newly added `//~` annotations are removed, other `error-pattern`s are not touched yet.

In exceptional cases `//@ compile-flags: --error-format=human` can be used to opt out of these checks.
In this PR I only had to use the opt out 3 times:
- `tests/ui/parser/utf16-{be,le}-without-bom.rs` - there are too many errors that are nearly identical (modulo location), because an error is reported on every second symbol
- `tests/ui-fulldeps/missing-rustc-driver-error.rs` - the errors list various rustc crate dependencies and may unexpectedly invalidate on random rustc changes
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2025
compiletest: Require `//~` annotations even if `error-pattern` is specified

This is continuation of rust-lang#138865 with some help from rust-lang#139100.

`error-pattern` annotations that duplicate the newly added `//~` annotations are removed, other `error-pattern`s are not touched yet.

In exceptional cases `//@ compile-flags: --error-format=human` can be used to opt out of these checks.
In this PR I only had to use the opt out 3 times:
- `tests/ui/parser/utf16-{be,le}-without-bom.rs` - there are too many errors that are nearly identical (modulo location), because an error is reported on every second symbol
- `tests/ui-fulldeps/missing-rustc-driver-error.rs` - the errors list various rustc crate dependencies and may unexpectedly invalidate on random rustc changes
@petrochenkov petrochenkov deleted the errbelow branch June 17, 2026 14:56
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-rustc-dev-guide Area: rustc-dev-guide 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants