Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait#154398
Merged
rust-bors[bot] merged 1 commit intoJun 25, 2026
Conversation
Collaborator
|
r? @jackh726 rustbot has assigned @jackh726. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
Member
|
So, see this comment: commit message needs to be updated. Otherwise, r=me |
fddaed2 to
6089970
Compare
This comment has been minimized.
This comment has been minimized.
…impl Send + dyn Trait Add a regression test covering the case where a type uses PhantomData<*mut ()> to opt out of Sync, restores Send via an unsafe impl, and is then captured across an .await point with a trait object type parameter (Box<dyn Trait>). The compiler currently erases lifetimes in MIR coroutine witnesses, losing the 'static bound needed to apply the unsafe impl Send. The test verifies this is fixed by -Zhigher-ranked-assumptions and documents the PhantomData<Cell<()>> workaround as a comparison. See the PR description for links to the relevant issues. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6089970 to
d560d3a
Compare
Collaborator
|
This PR was rebased onto a different main 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. |
Contributor
Author
|
@jackh726 commit message updated to resolve the notice. |
Member
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 25, 2026
…ait-test-phantomdata-rawptr, r=jackh726 Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait Add a regression test for rust-lang#154397, covering the case where: - A type uses `PhantomData<*mut ()>` to opt out of `Sync` - `Send` is restored via `unsafe impl<T: Send + 'static> Send` - The type is captured across an `.await` in an async block - The type parameter is a trait object (`Box<dyn Trait>`) This is an instance of rust-lang#110338. The test includes both revisions: - `assumptions`: compiles with `-Zhigher-ranked-assumptions` (check-pass) - `no_assumptions`: documents the current failure as a known-bug Also includes a `PhantomData<Cell<()>>` comparison showing the workaround compiles in all cases.
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 25, 2026
…ait-test-phantomdata-rawptr, r=jackh726 Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait Add a regression test for rust-lang#154397, covering the case where: - A type uses `PhantomData<*mut ()>` to opt out of `Sync` - `Send` is restored via `unsafe impl<T: Send + 'static> Send` - The type is captured across an `.await` in an async block - The type parameter is a trait object (`Box<dyn Trait>`) This is an instance of rust-lang#110338. The test includes both revisions: - `assumptions`: compiles with `-Zhigher-ranked-assumptions` (check-pass) - `no_assumptions`: documents the current failure as a known-bug Also includes a `PhantomData<Cell<()>>` comparison showing the workaround compiles in all cases.
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 25, 2026
…ait-test-phantomdata-rawptr, r=jackh726 Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait Add a regression test for rust-lang#154397, covering the case where: - A type uses `PhantomData<*mut ()>` to opt out of `Sync` - `Send` is restored via `unsafe impl<T: Send + 'static> Send` - The type is captured across an `.await` in an async block - The type parameter is a trait object (`Box<dyn Trait>`) This is an instance of rust-lang#110338. The test includes both revisions: - `assumptions`: compiles with `-Zhigher-ranked-assumptions` (check-pass) - `no_assumptions`: documents the current failure as a known-bug Also includes a `PhantomData<Cell<()>>` comparison showing the workaround compiles in all cases.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 17 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #158294 (Use .drectve for MSVC DLL exports) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158355 (Fixup the refactoring errors in #156246) - #158390 (Fix: auto trait, const trait bound) Failed merges: - #155535 (export symbols: support macos/windows(32/64))
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 25, 2026
…ait-test-phantomdata-rawptr, r=jackh726 Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait Add a regression test for rust-lang#154397, covering the case where: - A type uses `PhantomData<*mut ()>` to opt out of `Sync` - `Send` is restored via `unsafe impl<T: Send + 'static> Send` - The type is captured across an `.await` in an async block - The type parameter is a trait object (`Box<dyn Trait>`) This is an instance of rust-lang#110338. The test includes both revisions: - `assumptions`: compiles with `-Zhigher-ranked-assumptions` (check-pass) - `no_assumptions`: documents the current failure as a known-bug Also includes a `PhantomData<Cell<()>>` comparison showing the workaround compiles in all cases.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 17 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158355 (Fixup the refactoring errors in #156246) - #158390 (Fix: auto trait, const trait bound)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 17 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158355 (Fixup the refactoring errors in #156246) - #158390 (Fix: auto trait, const trait bound)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 17 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158355 (Fixup the refactoring errors in #156246) - #158390 (Fix: auto trait, const trait bound)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 25, 2026
…ait-test-phantomdata-rawptr, r=jackh726 Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait Add a regression test for rust-lang#154397, covering the case where: - A type uses `PhantomData<*mut ()>` to opt out of `Sync` - `Send` is restored via `unsafe impl<T: Send + 'static> Send` - The type is captured across an `.await` in an async block - The type parameter is a trait object (`Box<dyn Trait>`) This is an instance of rust-lang#110338. The test includes both revisions: - `assumptions`: compiles with `-Zhigher-ranked-assumptions` (check-pass) - `no_assumptions`: documents the current failure as a known-bug Also includes a `PhantomData<Cell<()>>` comparison showing the workaround compiles in all cases.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 16 pull requests Successful merges: - #153697 (Add arg splat experiment initial tuple impl) - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158390 (Fix: auto trait, const trait bound) Failed merges: - #158355 (Fixup the refactoring errors in #156246)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 15 pull requests Successful merges: - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158390 (Fix: auto trait, const trait bound)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 15 pull requests Successful merges: - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158390 (Fix: auto trait, const trait bound)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 15 pull requests Successful merges: - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158390 (Fix: auto trait, const trait bound)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
…uwer Rollup of 15 pull requests Successful merges: - #155535 (export symbols: support macos/windows(32/64)) - #158253 (codegen_ssa: multiply scalable vec size by `vscale`) - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected") - #158345 (Use `transmute_neo` in `assume_init`) - #158369 (std: abort when `resume_unwind` is called inside the panic hook) - #158374 (disallow tail calling extern "rust-call" functions) - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes") - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait) - #157181 (autodiff: stop always needing an alloca) - #158278 (autodiff - typtree cleanups) - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag) - #158318 (Make normalization in a test case resilient to dist compilation) - #158338 (Reorganize `tests/ui/issues` [14/N]) - #158343 (Include `Item::const_stability` info in rustdoc JSON.) - #158390 (Fix: auto trait, const trait bound)
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.
Add a regression test for #154397, covering the case where:
PhantomData<*mut ()>to opt out ofSyncSendis restored viaunsafe impl<T: Send + 'static> Send.awaitin an async blockBox<dyn Trait>)This is an instance of #110338. The test includes both revisions:
assumptions: compiles with-Zhigher-ranked-assumptions(check-pass)no_assumptions: documents the current failure as a known-bugAlso includes a
PhantomData<Cell<()>>comparison showing the workaround compiles in all cases.