Skip to content

dyn* does not support trait upcasting #104800

Closed

Description

@compiler-errors

Currently trait upcasting is done via the Unsize/CoerceUnsized traits -- however, since CoerceUnsized works structurally, implementing dyn* upcasting via the same codepaths allows this erroneous code to make it to codegen and ICE:

https://github.com/rust-lang/rust/blob/d8cb8c37adfbfb641a1b30d3a2de3ba7226bb744/src/test/ui/dyn-star/no-unsize-coerce-dyn-trait.rs#L1-L13

That's why although dyn* trait upcasting was implemented in #101832, I removed it in #104594 due to introduced ICEs.

  1. We should decide first whether we actually want the burden of implementing dyn* upcasting first, since dyn* is not currently intended to be user-facing syntax. Due to this, the feature is not currently needed even if it is interesting and possible theoretically.
  2. If we decide that we do want dyn* upcasting, then it needs to be implemented separately from dyn Trait upcasting with a much narrower scope.

Activity

  1. added
    T-typesRelevant to the types team, which will review and decide on the PR/issue.
    F-dyn_star`#![feature(dyn_star)]`
    on Nov 24, 2022
  2. added a commit that references this issue on Jun 27, 2025
    760c666
  3. added a commit that references this issue on Jul 1, 2025
    085c247
  4. added a commit that references this issue on Jul 2, 2025
    ae9fc91
  5. added a commit that references this issue on Jul 10, 2025
    a51c494
  6. added a commit that references this issue on Dec 29, 2025
    7e00c00
  7. added 2 commits that reference this issue on Jan 27, 2026
    cf015b2
    775d902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-dyn_star`#![feature(dyn_star)]`T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions