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

max_value() vs MAX #29841

Closed
snowe2010 opened this issue Nov 15, 2015 · 7 comments
Closed

max_value() vs MAX #29841

snowe2010 opened this issue Nov 15, 2015 · 7 comments

Comments

@snowe2010
Copy link
Contributor

I'm not sure if I'm calling this wrong, but when I try to use

let inf = std::u32::max_value();

I get the error:

src\main.rs:3:13: 3:32 error: unresolved name `std::u32::max_value` [E0425]
src\main.rs:3   let inf = std::u32::max_value();

, but following PR #11790 it looks like it should be

let inf = std::u32::MAX;

which of course works. None of this is a problem, except the documentation says to use max_value()

https://doc.rust-lang.org/std/primitive.u32.html

Please let me know if I'm doing something wrong though.

@Gankra
Copy link
Contributor

Gankra commented Nov 15, 2015

The problem is that u32::max_value is on the u32 type, but std::u32 is the u32 module.

let inf = u32::max_value();

works.

@snowe2010
Copy link
Contributor Author

oh great! Thank you. I guess I'll close this then.

@Gankra
Copy link
Contributor

Gankra commented Nov 15, 2015

This is definitely a problematic thing, though. @steveklabnik do you think there's anything that can be done here?

@snowe2010 snowe2010 reopened this Nov 15, 2015
@bluss
Copy link
Member

bluss commented Nov 16, 2015

Can we remove the std::u32 module and its relatives? It's so useless.. http://doc.rust-lang.org/nightly/std/u32/index.html

Maybe just hide it?

@Gankra
Copy link
Contributor

Gankra commented Nov 16, 2015

It's waiting on associated consts, iirc.

@steveklabnik
Copy link
Member

We link to the module from primitive pages and vice versa, so I'm not really sure there's much to do. I mean, other than add examples, which will happen as part of #29358

@Gankra
Copy link
Contributor

Gankra commented Nov 16, 2015

SGTM, closing in favour of that.

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

No branches or pull requests

4 participants