Skip to content

Add edition checks for some tests that had divergent output #142255

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jun 9, 2025

In order to expose edition dependent divergences in some tests in the test suite, add explicit edition annotations. Some of these tests might require additional work to avoid the divergences, as they might have been unintentional. These are not exhaustive changes, purely opportunistic while I was looking at something else.

@rustbot
Copy link
Collaborator

rustbot commented Jun 9, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 9, 2025
@rust-log-analyzer

This comment has been minimized.

@estebank
Copy link
Contributor Author

estebank commented Jun 9, 2025

cc rust-lang/compiler-team#861

@estebank estebank force-pushed the edition-diagnostic-changes branch from 85c28a9 to ce7480d Compare June 9, 2025 18:20
Comment on lines +1 to +23
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
--> $DIR/issue-54895.rs:18:40
|
LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> {
| ^^^^^^^^^^^^^^^ `impl Trait` implicitly captures all lifetimes in scope
|
note: lifetime declared here
--> $DIR/issue-54895.rs:18:20
|
LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> {
| ^^

error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
--> $DIR/issue-54895.rs:18:53
|
LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> {
| ^^
|
note: lifetime declared here
--> $DIR/issue-54895.rs:18:20
|
LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> {
| ^^
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These duplicated errors are unfortunate and quite common throughout the test suite.

Comment on lines +4 to +5
LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
| -- this generic parameter must be used with a generic lifetime parameter
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The last edition changes the span being pointed at in such a way that the wording should change (or get the span from previous editions back).

@fee1-dead
Copy link
Member

The parts about bare trait names in type position LGTM, but it would probably be better if someone else who knew about RPITs better to assess the changes in those tests

r? compiler

@rustbot rustbot assigned BoxyUwU and unassigned fee1-dead Jun 11, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Jun 23, 2025

r? compiler

@rustbot rustbot assigned WaffleLapkin and unassigned BoxyUwU Jun 23, 2025
Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

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

Some diagnostics are bad, but that's a pre-existing issue. @estebank would you mind opening issues for the bad cases here?

This improves test coverage, which seems like a good idea.

Comment on lines +1 to +3
//@revisions: edition2015 edition2021
//@[edition2015] edition:2015
//@[edition2021] edition:2021
Copy link
Member

Choose a reason for hiding this comment

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

maybe we should have a shorthand for this 🤔

@WaffleLapkin
Copy link
Member

@bors r=fee1-dead,WaffleLapkin rollup

@bors
Copy link
Collaborator

bors commented Jun 24, 2025

📌 Commit ce7480d has been approved by fee1-dead,WaffleLapkin

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 Jun 24, 2025
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 25, 2025
…s, r=fee1-dead,WaffleLapkin

Add edition checks for some tests that had divergent output

In order to expose edition dependent divergences in some tests in the test suite, add explicit `edition` annotations. Some of these tests might require additional work to *avoid* the divergences, as they might have been unintentional. These are not exhaustive changes, purely opportunistic while I was looking at something else.
@rustbot

This comment has been minimized.

@workingjubilee
Copy link
Member

This needs to be rebased and blessed.

@bors r-

@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 Jun 25, 2025
@workingjubilee
Copy link
Member

@bors rollup=iffy

@rust-log-analyzer

This comment has been minimized.

estebank added 2 commits June 25, 2025 16:52
If we ever start testing every edition, using a new keyword unnecessarily will cause divergent output, so pre-emptively change `gen` into `generator`.
In order to expose edition dependent divergences in some tests in the test suite, add explicit `edition` annotations. Some of these tests might require additional work to *avoid* the divergences, as they might have been unintentional. These are not exhaustive changes, purely opportunistic while looking at something else.
@estebank
Copy link
Contributor Author

@bors r=fee1-dead,WaffleLapkin

@bors
Copy link
Collaborator

bors commented Jun 25, 2025

📌 Commit 8c3a033 has been approved by fee1-dead,WaffleLapkin

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 Jun 25, 2025
@workingjubilee
Copy link
Member

@bors p=5

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 26, 2025
…s, r=fee1-dead,WaffleLapkin

Add edition checks for some tests that had divergent output

In order to expose edition dependent divergences in some tests in the test suite, add explicit `edition` annotations. Some of these tests might require additional work to *avoid* the divergences, as they might have been unintentional. These are not exhaustive changes, purely opportunistic while I was looking at something else.
bors added a commit that referenced this pull request Jun 26, 2025
Rollup of 17 pull requests

Successful merges:

 - #124595 (Suggest cloning `Arc` moved into closure)
 - #139594 (Simplify `ObligationCauseCode::IfExpression`)
 - #141311 (make `tidy-alphabetical` use a natural sort)
 - #141648 ([rustdoc] Do not emit redundant_explicit_links lint if the doc comment comes from expansion)
 - #142255 (Add edition checks for some tests that had divergent output)
 - #142285 (tests: Do not run afoul of asm.validity.non-exhaustive in input-stats)
 - #142549 (small iter.intersperse.fold() optimization)
 - #142637 (Remove some glob imports from the type system)
 - #142647 ([perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation)
 - #142700 (Remove incorrect comments in `Weak`)
 - #142884 (StableMIR: Add method to retrieve body of coroutine)
 - #142925 (Rewrite `.gitattributes` CRLF ui tests into run-make tests)
 - #143001 (Rename run always )
 - #143010 (Update `browser-ui-test` version to `0.20.7`)
 - #143015 (Add `sym::macro_pin` diagnostic item for `core::pin::pin!()`)
 - #143020 (codegen_fn_attrs: make comment more precise)
 - #143033 (Expand const-stabilized API links in relnotes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Jun 26, 2025

⌛ Testing commit 8c3a033 with merge 3b9d04c...

bors added a commit that referenced this pull request Jun 26, 2025
…ead,WaffleLapkin

Add edition checks for some tests that had divergent output

In order to expose edition dependent divergences in some tests in the test suite, add explicit `edition` annotations. Some of these tests might require additional work to *avoid* the divergences, as they might have been unintentional. These are not exhaustive changes, purely opportunistic while I was looking at something else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants