Skip to content

Allow refinement of existing method types in subtraits #5236

Description

@thestinger

You're currently allowed to implement stronger guarantees in the impl of a trait, like adding regions to borrowed pointers. It would be very useful to be able to do the same thing with users of the trait, as in requiring a stricter version of the trait. At the moment you can't write generic code that requires the stronger guarantee provided by a subset of the implementations.

A good example of this is the each method for iterators, since some containers or generators don't actually store the values they're returning references to. For example, SmallIntMap doesn't actually store the keys.

Activity

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

    A-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions