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

u8::MAX as usize is 2^64 when used in array syntax #22017

Closed
silven opened this issue Feb 6, 2015 · 4 comments
Closed

u8::MAX as usize is 2^64 when used in array syntax #22017

silven opened this issue Feb 6, 2015 · 4 comments
Labels
A-type-system Area: Type system

Comments

@kmcallister kmcallister added the A-type-system Area: Type system label Feb 6, 2015
@Gankra
Copy link
Contributor

Gankra commented Feb 6, 2015

Probably a consequence of the fact that these are consts and defined thusly:

pub const MIN: $T = 0 as $T;
pub const MAX: $T = 0 as $T - 1 as $T;

@daboross
Copy link
Contributor

Noting that u8::MAX as usize works fine in other places, just not in array decelerations. e.g. println!("{}", u8::MAX as usize); works as expected.

@mitaa
Copy link
Contributor

mitaa commented May 8, 2015

dup of #13768

@alexcrichton
Copy link
Member

Thanks @mitaa!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

6 participants