Skip to content

Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait#154398

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
sandersaares:higher-ranked-auto-trait-test-phantomdata-rawptr
Jun 25, 2026
Merged

Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait#154398
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
sandersaares:higher-ranked-auto-trait-test-phantomdata-rawptr

Conversation

@sandersaares

@sandersaares sandersaares commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Add a regression test for #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 #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.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 26, 2026
@sandersaares sandersaares marked this pull request as ready for review March 26, 2026 02:47
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 26, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 26, 2026
@rustbot

rustbot commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

r? @jackh726

rustbot has assigned @jackh726.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 12 candidates

@rustbot

This comment has been minimized.

@jackh726

Copy link
Copy Markdown
Member

So, see this comment: commit message needs to be updated.

Otherwise, r=me

@jackh726 jackh726 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-review Status: Awaiting review from the assignee but also interested parties. labels Apr 12, 2026
@sandersaares sandersaares force-pushed the higher-ranked-auto-trait-test-phantomdata-rawptr branch from fddaed2 to 6089970 Compare May 11, 2026 12:36
@rustbot

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>
@sandersaares sandersaares force-pushed the higher-ranked-auto-trait-test-phantomdata-rawptr branch from 6089970 to d560d3a Compare May 11, 2026 12:37
@rustbot

rustbot commented May 11, 2026

Copy link
Copy Markdown
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.

@sandersaares

Copy link
Copy Markdown
Contributor Author

@jackh726 commit message updated to resolve the notice.

@jackh726

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d560d3a has been approved by jackh726

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@rust-bors rust-bors Bot 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, 2026
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)
@rust-bors rust-bors Bot merged commit 88f124b into rust-lang:main Jun 25, 2026
11 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 25, 2026
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.

3 participants