-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Encourage fixed-size integer #16446
Comments
cc #11831 |
Can you be more specific? I also feel like #15526 is related, this may just be a superset of that issue. |
The documentations (i.e. tutorial, guide…) part is definitely #15526. The strict rule about removing |
I don't think the suffixes should be removed. Fixed-size integers are a better choice for anything not being used for sizes / indexing, but I have a feeling that the most common case is tied to container lengths. I didn't like the fallback because it was prone to causing mistakes, but I don't think we should go out of the way to make things more painful. |
Currently the documentation teaches new users to use |
cc #16736 |
cc #14758 |
@thestinger, could you please change the label for "metabug" (if appropriate)? |
Other |
Another related bug: |
Integer overflow bug: |
@l0kod #17795 doesn't seem to be caused by the names/sizes/conventions of integers in Rust. At some point in the past |
We've gone through and made a lot of changes related to this, and so I'm gonna give it a close. If we find anything else, it should also be fixed. |
Implement `literal_from_str` for proc macro server Closes rust-lang#16233 Todos and unanswered questions: - [x] Is this the correct approach? Can both the legacy and `rust_analyzer_span` servers depend on the `syntax` crate? - [ ] How should we handle suffixes for string literals? It doesn't seem like `rust-analyzer` preservers suffix information after parsing. - [x] Why are the `expect` tests failing? Specifically `test_fn_like_macro_clone_literals`
The #6023 force to use a type suffix for integers. As discussed in rust-lang/rfcs#115 and #9940, the
int
anduint
should only be used for memory-related values (e.g. length).The documentations mostly use
i
suffix examples. It should encourage the use of fixed-size integer (e.g.u32
) for common uses.A more strict rule could be to remove the
u
andi
from allowed suffixes, but to rely on full explicit typing (e.g.: int
) when really needed.This could be annoying for
range
-like functions but it's not that burdensome to use the explicit generic typing (e.g.range::<uint>(0, 5)
).The text was updated successfully, but these errors were encountered: