Add negation methods for signed non-zero integers.#102342
Add negation methods for signed non-zero integers.#102342bors merged 3 commits intorust-lang:masterfrom
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
a955916 to
259bbfb
Compare
|
@bors r+ |
…tmcm
Add negation methods for signed non-zero integers.
Performing negation with defined wrapping semantics (such as `wrapping_neg()`) on a non-zero integer currently requires unpacking to a primitive and re-wrapping. Since negation of non-zero signed integers always produces a non-zero result, it is safe to implement the various `*_neg()` methods for `NonZeroI{N}`.
I'm not sure what to do about the `#[unstable(..., issue = "none")]` here -- should I file a tracking issue, or is that handled by the Rust dev team?
ACP: rust-lang/libs-team#105
Rollup of 7 pull requests Successful merges: - rust-lang#102336 (Fix associated type bindings with anon const in GAT position) - rust-lang#102342 (Add negation methods for signed non-zero integers.) - rust-lang#102385 (Don't export `__heap_base` and `__data_end` on wasm32-wasi.) - rust-lang#102435 (Improve example of Iterator::reduce) - rust-lang#102436 (rustdoc: clean up "normalize.css 8" input override CSS) - rust-lang#102452 (fix minor ungrammatical sentence) - rust-lang#102455 (Use let-chaining in `WhileTrue::check_expr`.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Performing negation with defined wrapping semantics (such as
wrapping_neg()) on a non-zero integer currently requires unpacking to a primitive and re-wrapping. Since negation of non-zero signed integers always produces a non-zero result, it is safe to implement the various*_neg()methods forNonZeroI{N}.I'm not sure what to do about the
#[unstable(..., issue = "none")]here -- should I file a tracking issue, or is that handled by the Rust dev team?ACP: rust-lang/libs-team#105