Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
huonw opened this issue Mar 16, 2015 · 3 comments
Closed

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

huonw opened this issue Mar 16, 2015 · 3 comments
Labels
A-DSTs Area: Dynamically-sized types (DSTs) A-trait-system Area: Trait system

Comments

@huonw
Copy link
Member

huonw commented Mar 16, 2015

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.

@huonw huonw added A-trait-system Area: Trait system I-nominated A-DSTs Area: Dynamically-sized types (DSTs) labels Mar 16, 2015
@ben0x539
Copy link
Contributor

Isn't this RFC 599?

@nikomatsakis
Copy link
Contributor

I agree this is RFC 599.

@pnkfelix
Copy link
Member

not-a-bug, (as designed), closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-DSTs Area: Dynamically-sized types (DSTs) A-trait-system Area: Trait system
Projects
None yet
Development

No branches or pull requests

4 participants