Skip to content

existential type can accept generic bounds that do not specify a trait #53090

Closed
@varkor

Description

@varkor
#![feature(existential_type)]

existential type Foo: 'static; // ok

fn foo() -> Foo {
    "foo"
}

fn bar() -> impl 'static { // error: at least one trait must be specified
    "foo"
}

fn main() {}

Although the RFC wasn't explicit about this, it seems that this is an oversight, as existential type should function like return-position impl Trait.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions