Skip to content
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

Array type should say size expression is a *const* expression. #582

Closed
ehuss opened this issue Apr 21, 2019 · 2 comments · Fixed by #867
Closed

Array type should say size expression is a *const* expression. #582

ehuss opened this issue Apr 21, 2019 · 2 comments · Fixed by #867

Comments

@ehuss
Copy link
Contributor

ehuss commented Apr 21, 2019

The array size expression needs to be a const expression (I believe). Currently types/array.md only says that it needs to evaluate to usize.

@Centril
Copy link
Contributor

Centril commented Apr 21, 2019

Yep, that's right. Moreover, currently, the const expression acts as an anonymous constant, so:

fn foo<T>() { let x: [u8; core::mem::size_of::<T>()]; }

is not valid (but this may change...)

@ehuss
Copy link
Contributor Author

ehuss commented Jun 11, 2019

cc rust-lang/rust#43408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants