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 wrapping_int_assign_impl #93204

Closed
1 of 4 tasks
kellerkindt opened this issue Jan 22, 2022 · 1 comment
Closed
1 of 4 tasks

Tracking Issue for wrapping_int_assign_impl #93204

kellerkindt opened this issue Jan 22, 2022 · 1 comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@kellerkindt
Copy link
Contributor

kellerkindt commented Jan 22, 2022

Feature gate: #![feature(wrapping_int_assign_impl)]

This is a tracking issue for adding basic integer operations to the Wrapping type:

let mut value = Wrapping(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;

As well as

let mut value = Wrapping(2u8);
let _: Wrapping<u8> = value + 3u8;
let _: Wrapping<u8> = value - 1u8;
let _: Wrapping<u8> = value * 2u8;
let _: Wrapping<u8> = value / 2u8;
let _: Wrapping<u8> = value % 2u8;
let _: Wrapping<u8> = value ^ 255u8;
let _: Wrapping<u8> = value | 123u8;
let _: Wrapping<u8> = value & 2u8;

Steps / History

Unresolved Questions

  • Is this reasonable?

This is analog to the implementation for the Saturating type here #92354

@kellerkindt kellerkindt added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 22, 2022
@kellerkindt kellerkindt changed the title [WIP] Tracking Issue for wrapping_int_assign_impl Tracking Issue for wrapping_int_assign_impl Jan 22, 2022
@m-ou-se
Copy link
Member

m-ou-se commented Jan 22, 2022

Trait implementations like these for a stable type cannot be added as unstable, so there's nothing to be tracked. So, I'm closing this issue.

In general, please only create tracking issues after a reviewer from the libs-api team has approved of the new (unstable) feature and asked you to do so. (See also the tracking issue template.) You can use issue = "none" as a placeholder when opening a PR for a new unstable feature that doesn't have an RFC.

@m-ou-se m-ou-se closed this as completed Jan 22, 2022
m-ou-se added a commit to m-ou-se/rust that referenced this issue Feb 7, 2022
…l, r=m-ou-se

Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0

Tracking issue rust-lang#93204

This is about adding basic integer operations to the `Wrapping` type:

```rust
let mut value = Wrapping(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;
```

Because this adds stable impls on a stable type, it runs into the following issue if an `#[unstable(...)]` attribute is used:

```
an `#[unstable]` annotation here has no effect
note: see issue rust-lang#55436 <rust-lang#55436> for more information
```

This means - if I understood this correctly - the new impls have to be stabilized instantly.
Which in turn means, this PR has to kick of an FCP on the tracking issue as well?

This impl is analog to 1c0dc18 rust-lang#92356 for the `Saturating` type `@dtolnay`  `@Mark-Simulacrum`
m-ou-se added a commit to m-ou-se/rust that referenced this issue Feb 7, 2022
…l, r=m-ou-se

Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0

Tracking issue rust-lang#93204

This is about adding basic integer operations to the `Wrapping` type:

```rust
let mut value = Wrapping(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;
```

Because this adds stable impls on a stable type, it runs into the following issue if an `#[unstable(...)]` attribute is used:

```
an `#[unstable]` annotation here has no effect
note: see issue rust-lang#55436 <rust-lang#55436> for more information
```

This means - if I understood this correctly - the new impls have to be stabilized instantly.
Which in turn means, this PR has to kick of an FCP on the tracking issue as well?

This impl is analog to 1c0dc18 rust-lang#92356 for the `Saturating` type ``@dtolnay``  ``@Mark-Simulacrum``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants