Skip to content

Consider ZST values to be constant #1874

New issue

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

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

Already on GitHub? # to your account

Closed
torkleyy opened this issue Jan 28, 2017 · 2 comments
Closed

Consider ZST values to be constant #1874

torkleyy opened this issue Jan 28, 2017 · 2 comments
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@torkleyy
Copy link

If a value has a size of zero, there is nothing to allocate and it has no state so it should be constant and this should work:

struct Foo;

fn foo() -> &'static Foo {
    &Foo
}
@Stebalien
Copy link
Contributor

RFC: #1414
Tracking Issue: rust-lang/rust#38865

😄

@torkleyy
Copy link
Author

@Stebalien oops I didn't find this one ;)

@Centril Centril added the T-lang Relevant to the language team, which will review and decide on the RFC. label Feb 23, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

3 participants