Skip to content

Tracking issue for trait aliases #41517

@withoutboats

Description

@withoutboats

View all comments

This is a tracking issue for the feature trait aliases (originally specified in RFC 1733).
The feature gate for the issue is #![feature(trait_alias)].

Important

The implementation of this feature is tracked separately in #55628.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Unresolved questions

  • Should we really imply bounds on generic parameters other than the self type Self? Or rather, should we really imply bounds whose self type isn't Self or a projection thereof?
  • Should we keep the current behaviour of "shallow-banning" ?Sized bounds in trait objects, ban them "deeply" (through trait alias expansion), or permit them everywhere with no effect?
    • NOTE(fmease): The phrasing of that question is imprecise & confusing.
      1. First of all, ?Sized bounds in trait alias bounds makes no sense whatsoever since we don't perform Sized elaboration there (i.e., we don't implicitly add a Sized bound to trait aliases). For that reason PR RUST-147734 made them a hard error.
      2. Second of all, regarding "deep v shallow": Relaxed bounds like ?Sized don't get "inherited"; Sized elaboration happens in the relevant places without regard for any supertrait bounds
      3. Last of all, I wonder if that question actually meant to say "Should dyn EmptyTraitAlias be legal where trait EmptyTraitAlias =;?" In the current implementation, trait aliases get eagerly expanded inside trait object types and thus dyn EmptyTraitAlias ends up getting rejected just like dyn (sic!). I guess it could behave like trait EmptyTrait {} instead and thus get accepted. It's unclear if that's how one should interpret that question but it doesn't seem implausible.
  • Insufficient flexibility
  • Inconvenient syntax
  • Misleading naming
  • Which of constraint/bound/type aliases are desirable

Implementation history

See #55628 instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-trait_alias`#![feature(trait_alias)]`S-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions