提交 560b8f6c 编写于 作者: C Corey Richardson

rollup merge of #19468: victorvde/master

1. Made small improvements to the docs for checked_sub, checked_mul and checked_div.
2. Updated a confusingly outdated comment for intrinsics, noticed before at <https://stackoverflow.com/questions/23582931/>.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
//! rustc compiler intrinsics. //! rustc compiler intrinsics.
//! //!
//! The corresponding definitions are in librustc/middle/trans/foreign.rs. //! The corresponding definitions are in librustc_trans/trans/intrinsic.rs.
//! //!
//! # Volatiles //! # Volatiles
//! //!
......
...@@ -284,7 +284,7 @@ fn to_le(self) -> Self { ...@@ -284,7 +284,7 @@ fn to_le(self) -> Self {
/// ``` /// ```
fn checked_add(self, other: Self) -> Option<Self>; fn checked_add(self, other: Self) -> Option<Self>;
/// Checked integer subtraction. Computes `self + other`, returning `None` /// Checked integer subtraction. Computes `self - other`, returning `None`
/// if underflow occurred. /// if underflow occurred.
/// ///
/// # Example /// # Example
...@@ -297,7 +297,7 @@ fn to_le(self) -> Self { ...@@ -297,7 +297,7 @@ fn to_le(self) -> Self {
/// ``` /// ```
fn checked_sub(self, other: Self) -> Option<Self>; fn checked_sub(self, other: Self) -> Option<Self>;
/// Checked integer multiplication. Computes `self + other`, returning /// Checked integer multiplication. Computes `self * other`, returning
/// `None` if underflow or overflow occurred. /// `None` if underflow or overflow occurred.
/// ///
/// # Example /// # Example
...@@ -310,8 +310,8 @@ fn to_le(self) -> Self { ...@@ -310,8 +310,8 @@ fn to_le(self) -> Self {
/// ``` /// ```
fn checked_mul(self, other: Self) -> Option<Self>; fn checked_mul(self, other: Self) -> Option<Self>;
/// Checked integer division. Computes `self + other` returning `None` if /// Checked integer division. Computes `self / other`, returning `None` if
/// `self == 0` or the operation results in underflow or overflow. /// `other == 0` or the operation results in underflow or overflow.
/// ///
/// # Example /// # Example
/// ///
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册