Skip to content

TAIT defining scope options #206

Closed
Closed
@tmandry

Description

@tmandry

Summary

Please describe your meeting topic here. It doesn't have to be very long, but
it's always good to try and identify a concrete question to be answered or
narrow topic for discussion. Nobody likes a rambly meeting.

There are several options around what the defining scope of a TAIT is allowed to be and whether to require an explicit #[defines] or #[defined_by] attribute. From a recent discussion in the lang team meeting (linked below), the primary tradeoffs involved are:

  • Explicitness
  • Ease of use
  • How it affects IDE performance (resolving auto traits)
  • How it affects compiler complexity (resolving cycles wrt to auto traits)

We have several possible paths forward with various amounts of conservatism involved for a "TAIT MVP". The decision takes place along two axes:

  1. Where defining uses are allowed. More allowable defining uses means supporting more use cases. Some options:
    • Restrict to "obvious" cases where the TAIT appears in the type signature in return position
    • Restrict to cases where TAIT appears anywhere in the type signature
    • Allow defining uses anywhere in the parent item/module
  2. Whether to require an explicit attribute.
    • Always require an attribute
    • Require an attribute on the "non-obvious" cases
    • Do not require an attribute

Some of these options are forward-compatible with others from a lang perspective (some through an edition), but it is possible they would require considerable complexity or performance pessimization to continue supporting in the compiler and IDE tooling.

Background reading

Include any links to material that folks ought to try to read before-hand.

There probably needs to be a doc summarizing the discussion so far, but I don't know who is prepared to write that doc.

About this issue

This issue corresponds to a lang-team design meeting proposal. It corresponds to a possible topic of discussion that may be scheduled for deeper discussion during one of our design meetings.

cc @oli-obk @cramertj @matklad

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions