-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Document the maximum and minimum values of each number type #66099
Comments
We should also do this for some of the other constants that are floating around (like EPSILON) If we do this for usize we should make sure to mention both values Some of these are macro generated, so this could be a bit tricky to get right! |
I suspect the macro bit is actually maybe leading to the problem here -- I seem to recall something going by recently about constants getting pretty-printed into metadata, which I assumed meant we were rendering their values in rustdoc. Maybe the macros are leading to that not happening? That won't help for usize/isize I guess but I think it would be good to look into this theory for the other types at least a bit |
I don't think we ever show constant values in rustdoc. Would be nice to, but there are a bunch of tricky bits. |
Unstably, we show constant values for const generics, so we need to handle const value printing in rustdoc anyway. It's not perfect yet, but it works in most simple situations. We should be able to use the same infrastructure to print |
I would be interested in adding this for at least for the integer types listed in the book. What is the preferred way that this look like on the documentation? Something like:
Or
Or would it be similar to the documentation for the primitive type i8's |
IMHO, the former is simpler and straightforward, seems good to me. |
@rustbot claim @ohadravid |
Error: Parsing assign command in comment failed: ...tbot claim|error: expected end of command at >| @ohadravi... Please let |
@rustbot assign @ohadravid |
I wouldn't mind taking this on, if it's not already taken. |
Values such as
u8::MAX
are nice when coding because they capture the max allowed value of a number without needing to hard-code it yourself, or apply tricks to compute it.However when trying to decide which number type to use, it'd be nice to have a plain-text definition of the number types in the documentation. Because even clicking through to the source does not yield the information you're looking for.
I think this would be a small change that could make getting used to Rust's number types significantly easier. Thanks!
Screenshots
Rust's
MAX
docs don't contain much information currently. It seems like it wouldn't be too bad to add a bit more to it.The text was updated successfully, but these errors were encountered: