tests: Add regression test for async closures involving HRTBs#154109
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Mar 20, 2026
Merged
Conversation
I suspect the original code had several issues. The last one that made
the code compile entered `nightly-2024-02-11`. The code fails to build
with `nightly-2024-02-10`:
$ rustc +nightly-2024-02-10 --edition 2018 tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs
error[E0277]: expected a `FnOnce(&u8)` closure, found `{coroutine-closure@tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9: 31:30}`
--> tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9
|
31 | foo(async move | f: &u8 | { *f });
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&u8)` closure, found `{coroutine-closure@tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9: 31:30}`
| |
| required by a bound introduced by this call
|
(Note that you must add `#![feature(async_closure)]` to test with such
old nightlies, since they are from before stabilization of async
closures.)
This was probably fixed by 3bb384a.
Collaborator
|
r? @jackh726 rustbot has assigned @jackh726. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Mar 19, 2026
…volving-hrtb, r=jackh726 tests: Add regression test for async closures involving HRTBs I suspect the original code from rust-lang#59337 had several problems. The last problem fixed that made the code compile entered `nightly-2024-02-11`. The code fails to build with `nightly-2024-02-10`: $ rustc +nightly-2024-02-10 --edition 2018 tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs error[E0277]: expected a `FnOnce(&u8)` closure, found `{coroutine-closure@tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9: 31:30}` --> tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9 | 31 | foo(async move | f: &u8 | { *f }); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&u8)` closure, found `{coroutine-closure@tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9: 31:30}` | | | required by a bound introduced by this call | (Note that you must add `#![feature(async_closure)]` to test with such old nightlies, since they are from before stabilization of async closures.) So one of the following commits made the code build: <details> <summary>git log d44e3b9..6cc4843 --no-merges --oneline</summary> 4def373 manually bless an aarch64 test 04bc624 rebless after rebase 77f8c3c detect consts that reference extern statics 9c0623f validation: descend from consts into statics 4e77e36 unstably allow constants to refer to statics and read from immutable statics a2479a4 Remove unnecessary `min_specialization` after bootstrap 7b73e4f Allow restricted trait impls in macros with `min_specialization` e6f5af9 Remove unused fn fde695a Add a helpful suggestion d7263d7 Change wording 973bbfb No more associated type bounds in dyn trait cf1096e Remove unnecessary `#![feature(min_specialization)]` 3d4a9f5 Turn the "no saved object file in work product" ICE into a translatable fatal error bb60ded Loosen an assertion to account for stashed errors. 69a5264 Move some tests 4ef1790 tidy e59d9b1 Avoid a collection and iteration on empty passes 8b6b9c5 ast_lowering: Fix regression in `use ::{}` imports. 83f3bc4 Update jobserver-rs to 0.1.28 14e0dab Unify item relative path computation in one function f3c2483 Add regression test for non local items link generation f0d002b Correctly generate path for non-local items in source code pages c94bbb2 Clarify that atomic and regular integers can differ in alignment 7057188 make it recursive 7a63d3f Add tests for untested capabilities 548929d Don't unnecessarily lower associated type bounds to impl trait 22d582a For a rigid projection, recursively look at the self type's item bounds 540be28 sort suggestions for object diagnostic 9322882 Add a couple more tests 3bb384a Prefer AsyncFn* over Fn* for coroutine-closures aa6f45e Use `ensure` when the result of the query is not needed beyond its `Result`ness 8ff1994 Fix whitespace issues that tidy caught f0c6f5a Add documentation on `str::starts_with` 63cc3c7 test `llvm_out` behaviour 7fb4512 fix `llvm_out` to use the correct LLVM root b8c93f1 Coroutine closures implement regular Fn traits, when possible 08af64e Regular closures now built-in impls for AsyncFn* 0dd4078 Harmonize blanket implementations for AsyncFn* traits f3d32f2 Flatten confirmation logic 9a819ab static mut: allow reference to arbitrary types, not just slices and arrays </details> This was probably fixed by 3bb384a (rust-lang#120712). That PR does not have a big tests diff, so I assume the test we add does not exist elsewhere. It's hard to know for sure. Closes rust-lang#59337 since we add the test from that issue. In that issue there is a [proposal](rust-lang#59337 (comment)) for two minimized versions, but they both fail to compile with `nightly-2024-02-11`, so those reproducers are for different problem(s). ### Tracking Issue - rust-lang#62290
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Mar 19, 2026
…volving-hrtb, r=jackh726 tests: Add regression test for async closures involving HRTBs I suspect the original code from rust-lang#59337 had several problems. The last problem fixed that made the code compile entered `nightly-2024-02-11`. The code fails to build with `nightly-2024-02-10`: $ rustc +nightly-2024-02-10 --edition 2018 tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs error[E0277]: expected a `FnOnce(&u8)` closure, found `{coroutine-closure@tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9: 31:30}` --> tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9 | 31 | foo(async move | f: &u8 | { *f }); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&u8)` closure, found `{coroutine-closure@tests/ui/async-await/async-closures/unifying-function-types-involving-hrtb.rs:31:9: 31:30}` | | | required by a bound introduced by this call | (Note that you must add `#![feature(async_closure)]` to test with such old nightlies, since they are from before stabilization of async closures.) So one of the following commits made the code build: <details> <summary>git log d44e3b9..6cc4843 --no-merges --oneline</summary> 4def373 manually bless an aarch64 test 04bc624 rebless after rebase 77f8c3c detect consts that reference extern statics 9c0623f validation: descend from consts into statics 4e77e36 unstably allow constants to refer to statics and read from immutable statics a2479a4 Remove unnecessary `min_specialization` after bootstrap 7b73e4f Allow restricted trait impls in macros with `min_specialization` e6f5af9 Remove unused fn fde695a Add a helpful suggestion d7263d7 Change wording 973bbfb No more associated type bounds in dyn trait cf1096e Remove unnecessary `#![feature(min_specialization)]` 3d4a9f5 Turn the "no saved object file in work product" ICE into a translatable fatal error bb60ded Loosen an assertion to account for stashed errors. 69a5264 Move some tests 4ef1790 tidy e59d9b1 Avoid a collection and iteration on empty passes 8b6b9c5 ast_lowering: Fix regression in `use ::{}` imports. 83f3bc4 Update jobserver-rs to 0.1.28 14e0dab Unify item relative path computation in one function f3c2483 Add regression test for non local items link generation f0d002b Correctly generate path for non-local items in source code pages c94bbb2 Clarify that atomic and regular integers can differ in alignment 7057188 make it recursive 7a63d3f Add tests for untested capabilities 548929d Don't unnecessarily lower associated type bounds to impl trait 22d582a For a rigid projection, recursively look at the self type's item bounds 540be28 sort suggestions for object diagnostic 9322882 Add a couple more tests 3bb384a Prefer AsyncFn* over Fn* for coroutine-closures aa6f45e Use `ensure` when the result of the query is not needed beyond its `Result`ness 8ff1994 Fix whitespace issues that tidy caught f0c6f5a Add documentation on `str::starts_with` 63cc3c7 test `llvm_out` behaviour 7fb4512 fix `llvm_out` to use the correct LLVM root b8c93f1 Coroutine closures implement regular Fn traits, when possible 08af64e Regular closures now built-in impls for AsyncFn* 0dd4078 Harmonize blanket implementations for AsyncFn* traits f3d32f2 Flatten confirmation logic 9a819ab static mut: allow reference to arbitrary types, not just slices and arrays </details> This was probably fixed by 3bb384a (rust-lang#120712). That PR does not have a big tests diff, so I assume the test we add does not exist elsewhere. It's hard to know for sure. Closes rust-lang#59337 since we add the test from that issue. In that issue there is a [proposal](rust-lang#59337 (comment)) for two minimized versions, but they both fail to compile with `nightly-2024-02-11`, so those reproducers are for different problem(s). ### Tracking Issue - rust-lang#62290
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 20, 2026
…uwer Rollup of 12 pull requests Successful merges: - #152909 (sess: `-Zbranch-protection` is a target modifier) - #153556 (`impl` restriction lowering) - #154048 (Don't emit rustdoc `missing_doc_code_examples` lint on impl items) - #153992 (bootstrap: Optionally print a backtrace if a command fails) - #154019 (two smaller feature cleanups) - #154059 (tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`) - #154075 (Rewrite `query_ensure_result`.) - #154082 (Updates derive_where and removes workaround) - #154084 (Preserve braces around `self` in use tree pretty printing) - #154086 (Insert space after float literal ending with `.` in pretty printer) - #154087 (Fix whitespace after fragment specifiers in macro pretty printing) - #154109 (tests: Add regression test for async closures involving HRTBs)
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 20, 2026
Rollup of 15 pull requests Successful merges: - #152909 (sess: `-Zbranch-protection` is a target modifier) - #153556 (`impl` restriction lowering) - #154048 (Don't emit rustdoc `missing_doc_code_examples` lint on impl items) - #150935 (Introduce #[diagnostic::on_move(message)]) - #152973 (remove -Csoft-float) - #153862 (Rename `cycle_check` to `find_cycle`) - #153992 (bootstrap: Optionally print a backtrace if a command fails) - #154019 (two smaller feature cleanups) - #154059 (tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`) - #154075 (Rewrite `query_ensure_result`.) - #154082 (Updates derive_where and removes workaround) - #154084 (Preserve braces around `self` in use tree pretty printing) - #154086 (Insert space after float literal ending with `.` in pretty printer) - #154087 (Fix whitespace after fragment specifiers in macro pretty printing) - #154109 (tests: Add regression test for async closures involving HRTBs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I suspect the original code from #59337 had several problems. The last problem fixed that made the code compile entered
nightly-2024-02-11. The code fails to build withnightly-2024-02-10:(Note that you must add
#![feature(async_closure)]to test with such old nightlies, since they are from before stabilization of async closures.)So one of the following commits made the code build:
git log d44e3b9..6cc4843 --no-merges --oneline
4def373 manually bless an aarch64 test
04bc624 rebless after rebase
77f8c3c detect consts that reference extern statics
9c0623f validation: descend from consts into statics
4e77e36 unstably allow constants to refer to statics and read from immutable statics
a2479a4 Remove unnecessary
min_specializationafter bootstrap7b73e4f Allow restricted trait impls in macros with
min_specializatione6f5af9 Remove unused fn
fde695a Add a helpful suggestion
d7263d7 Change wording
973bbfb No more associated type bounds in dyn trait
cf1096e Remove unnecessary
#![feature(min_specialization)]3d4a9f5 Turn the "no saved object file in work product" ICE into a translatable fatal error
bb60ded Loosen an assertion to account for stashed errors.
69a5264 Move some tests
4ef1790 tidy
e59d9b1 Avoid a collection and iteration on empty passes
8b6b9c5 ast_lowering: Fix regression in
use ::{}imports.83f3bc4 Update jobserver-rs to 0.1.28
14e0dab Unify item relative path computation in one function
f3c2483 Add regression test for non local items link generation
f0d002b Correctly generate path for non-local items in source code pages
c94bbb2 Clarify that atomic and regular integers can differ in alignment
7057188 make it recursive
7a63d3f Add tests for untested capabilities
548929d Don't unnecessarily lower associated type bounds to impl trait
22d582a For a rigid projection, recursively look at the self type's item bounds
540be28 sort suggestions for object diagnostic
9322882 Add a couple more tests
3bb384a Prefer AsyncFn* over Fn* for coroutine-closures
aa6f45e Use
ensurewhen the result of the query is not needed beyond itsResultness8ff1994 Fix whitespace issues that tidy caught
f0c6f5a Add documentation on
str::starts_with63cc3c7 test
llvm_outbehaviour7fb4512 fix
llvm_outto use the correct LLVM rootb8c93f1 Coroutine closures implement regular Fn traits, when possible
08af64e Regular closures now built-in impls for AsyncFn*
0dd4078 Harmonize blanket implementations for AsyncFn* traits
f3d32f2 Flatten confirmation logic
9a819ab static mut: allow reference to arbitrary types, not just slices and arrays
This was probably fixed by 3bb384a (#120712). That PR does not have a big tests diff, so I assume the test we add does not exist elsewhere. It's hard to know for sure.
Closes #59337 since we add the test from that issue. In that issue there is a proposal for two minimized versions, but they both fail to compile with
nightly-2024-02-11, so those reproducers are for different problem(s).Tracking Issue
# #62290