-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Tracking Issue for nonzero_ops #84186
Copy link
Copy link
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Feature gate:
#![feature(nonzero_ops)]This is the tracking issue for #82703. The common arithmetic operators that keep the invariants of
NonZero*types enforced are implemented for these types.Public API
Example with
U8/I8, but same forU16/I16etc.Steps / History
const.unchecked_methods.impl Neg for NonZeroI*, which could not be feature-gated.Unresolved Questions
unchecked_addandunchecked_mulbe markedconstand how? Would it imply that theirconst-ness for the underlying types be upgraded instd?-> Leave as-is (non-const) until add const-ub RFC rfcs#3016 lands. (Implement nonzero arithmetics for NonZero types. #82703 (comment))
-> It has landed now, mark them
constin Mark unsafe methods NonZero*::unchecked_(add|mul) as const. #87910.(un)checked, referring to checking for nonzeroness in std with theNonZeroInt::new_uncheckedmethod, but here referring to checking overflow? Discussion here.->
checkconsistently means "check everything that needs be checked in the current context, and refer to the doc to verify what needs to be checked in this context". The doc has been made explicit about what needs to be checked for every method above.