Skip to content

Unboxed trait object can be stored in struct without lifetime #23410

@huonw

Description

@huonw
trait Foo { fn method(&self); }

struct Wrapper(Foo);

fn main() {}

It seems to me that this should be requiring a lifetime, e.g. struct Wrapper<'a>(Foo + 'a); or struct Wrapper(Foo + 'static);. However, it may be the intended behaviour too, nominating for clarification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)A-trait-systemArea: Trait system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions