Skip to content

Allow refinement of existing method types in subtraits #5236

Closed
@thestinger

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.

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