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

Tracking Issue for fn unsigned_abs #74913

Closed
1 task
carbotaniuman opened this issue Jul 29, 2020 · 7 comments · Fixed by #80959
Closed
1 task

Tracking Issue for fn unsigned_abs #74913

carbotaniuman opened this issue Jul 29, 2020 · 7 comments · Fixed by #80959
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. Libs-Small Libs issues that are considered "small" or self-contained Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@carbotaniuman
Copy link
Contributor

This is a tracking issue for fn unsigned_abs on signed integral types.
The feature gate for the issue is #![feature(unsigned_abs)].

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Implementation history

First implemented in #74759

@carbotaniuman carbotaniuman added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Jul 29, 2020
@jonas-schievink jonas-schievink added B-unstable Blocker: Implemented in the nightly compiler and unstable. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 29, 2020
@KodrAus KodrAus added Libs-Small Libs issues that are considered "small" or self-contained Libs-Tracked Libs issues that are tracked on the team's project board. labels Jul 30, 2020
@jhpratt
Copy link
Member

jhpratt commented Nov 5, 2020

Are there any outstanding issues with this feature gate? It has a trivial implementation that is unquestionably correct, and it seemed quite clear in the RFC that it was desired.

@Kixunil
Copy link
Contributor

Kixunil commented Nov 5, 2020

One significant issue I see is currently the implementation for isize returns u64 instead of usize.

Documentation of the function
Playground proof that the implementation matches the documentation

Edit: I found the reason. The macro int_impl is called with u64 instead of usize as $UnsignedT. This was not a problem so far because $UnsignedT didn't appear in any function signature until now. So changing the call site for all pointer sizes should be enough.

@jhpratt
Copy link
Member

jhpratt commented Nov 5, 2020

Hmm…the behavior is different for different widths (16, 32, or 64). However, usize and u16/32/64 are not the same type. I'll make a modification locally and open a PR shortly.

@Kixunil
Copy link
Contributor

Kixunil commented Nov 6, 2020

Yes, exactly. Good job with the PR!

m-ou-se added a commit to m-ou-se/rust that referenced this issue Nov 7, 2020
Correct unsigned equivalent of isize to be usize

See [rust-lang#74913 (comment)](rust-lang#74913 (comment)) for why this matters. Apparently it hasn't been used anywhere else, though CI will tell for sure.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Nov 7, 2020
Correct unsigned equivalent of isize to be usize

See [rust-lang#74913 (comment)](rust-lang#74913 (comment)) for why this matters. Apparently it hasn't been used anywhere else, though CI will tell for sure.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Nov 7, 2020
Correct unsigned equivalent of isize to be usize

See [rust-lang#74913 (comment)](rust-lang#74913 (comment)) for why this matters. Apparently it hasn't been used anywhere else, though CI will tell for sure.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Nov 8, 2020
Correct unsigned equivalent of isize to be usize

See [rust-lang#74913 (comment)](rust-lang#74913 (comment)) for why this matters. Apparently it hasn't been used anywhere else, though CI will tell for sure.
@AngelicosPhosphoros
Copy link
Contributor

AngelicosPhosphoros commented Dec 12, 2020

Why unsigned_abs of isize returns u64 instead of usize?
IMHO, it is not valid.
https://doc.rust-lang.org/std/primitive.isize.html#method.unsigned_abs

@carbotaniuman @jhpratt

@CryZe
Copy link
Contributor

CryZe commented Dec 12, 2020

This is fixed on nightly (that you need anyway to use this for now)

@AngelicosPhosphoros
Copy link
Contributor

Nice, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. Libs-Small Libs issues that are considered "small" or self-contained Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants