Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
89d9ca9b
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
89d9ca9b
编写于
5月 16, 2018
作者:
S
Simon Sapin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize num::NonZeroU*
Tracking issue:
https://github.com/rust-lang/rust/issues/49137
上级
c536639c
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
8 addition
and
21 deletion
+8
-21
src/liballoc/lib.rs
src/liballoc/lib.rs
+0
-1
src/libcore/num/mod.rs
src/libcore/num/mod.rs
+7
-9
src/libcore/tests/lib.rs
src/libcore/tests/lib.rs
+0
-1
src/librustc/lib.rs
src/librustc/lib.rs
+0
-1
src/librustc_data_structures/lib.rs
src/librustc_data_structures/lib.rs
+0
-1
src/librustc_mir/lib.rs
src/librustc_mir/lib.rs
+0
-1
src/libstd/lib.rs
src/libstd/lib.rs
+0
-1
src/libstd/num.rs
src/libstd/num.rs
+1
-2
src/test/run-pass/ctfe/tuple-struct-constructors.rs
src/test/run-pass/ctfe/tuple-struct-constructors.rs
+0
-1
src/test/run-pass/enum-null-pointer-opt.rs
src/test/run-pass/enum-null-pointer-opt.rs
+0
-2
src/test/ui/print_type_sizes/niche-filling.rs
src/test/ui/print_type_sizes/niche-filling.rs
+0
-1
未找到文件。
src/liballoc/lib.rs
浏览文件 @
89d9ca9b
...
...
@@ -102,7 +102,6 @@
#![feature(lang_items)]
#![feature(libc)]
#![feature(needs_allocator)]
#![feature(nonzero)]
#![feature(optin_builtin_traits)]
#![feature(pattern)]
#![feature(pin)]
...
...
src/libcore/num/mod.rs
浏览文件 @
89d9ca9b
...
...
@@ -21,9 +21,9 @@
use
str
::
FromStr
;
macro_rules!
impl_nonzero_fmt
{
(
#[
$
stability:
meta]
(
$
(
$Trait
:
ident
),
+
)
for
$Ty
:
ident
)
=>
{
(
(
$
(
$Trait
:
ident
),
+
)
for
$Ty
:
ident
)
=>
{
$
(
#[
$
stability
]
#[
stable(feature
=
"nonzero"
,
since
=
"1.28.0"
)
]
impl
fmt
::
$Trait
for
$Ty
{
#[inline]
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
...
...
@@ -35,7 +35,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
}
macro_rules!
nonzero_integers
{
(
#[
$
stability:
meta]
$
(
$Ty
:
ident
(
$Int
:
ty
);
)
+
)
=>
{
(
$
(
$Ty
:
ident
(
$Int
:
ty
);
)
+
)
=>
{
$
(
/// An integer that is known not to equal zero.
///
...
...
@@ -46,7 +46,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// use std::mem::size_of;
/// assert_eq!(size_of::<Option<std::num::NonZeroU32>>(), size_of::<u32>());
/// ```
#[
$
stability
]
#[
stable(feature
=
"nonzero"
,
since
=
"1.28.0"
)
]
#[derive(Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Hash)]
pub
struct
$Ty
(
NonZero
<
$Int
>
);
...
...
@@ -56,14 +56,14 @@ impl $Ty {
/// # Safety
///
/// The value must not be zero.
#[
$
stability
]
#[
stable(feature
=
"nonzero"
,
since
=
"1.28.0"
)
]
#[inline]
pub
const
unsafe
fn
new_unchecked
(
n
:
$Int
)
->
Self
{
$Ty
(
NonZero
(
n
))
}
/// Create a non-zero if the given value is not zero.
#[
$
stability
]
#[
stable(feature
=
"nonzero"
,
since
=
"1.28.0"
)
]
#[inline]
pub
fn
new
(
n
:
$Int
)
->
Option
<
Self
>
{
if
n
!=
0
{
...
...
@@ -74,7 +74,7 @@ pub fn new(n: $Int) -> Option<Self> {
}
/// Returns the value as a primitive type.
#[
$
stability
]
#[
stable(feature
=
"nonzero"
,
since
=
"1.28.0"
)
]
#[inline]
pub
fn
get
(
self
)
->
$Int
{
self
.0
.0
...
...
@@ -83,7 +83,6 @@ pub fn get(self) -> $Int {
}
impl_nonzero_fmt!
{
#[
$
stability]
(
Debug
,
Display
,
Binary
,
Octal
,
LowerHex
,
UpperHex
)
for
$Ty
}
)
+
...
...
@@ -91,7 +90,6 @@ pub fn get(self) -> $Int {
}
nonzero_integers!
{
#[unstable(feature
=
"nonzero"
,
issue
=
"49137"
)]
NonZeroU8
(
u8
);
NonZeroU16
(
u16
);
NonZeroU32
(
u32
);
...
...
src/libcore/tests/lib.rs
浏览文件 @
89d9ca9b
...
...
@@ -26,7 +26,6 @@
#![feature(iterator_step_by)]
#![feature(iterator_flatten)]
#![feature(iterator_repeat_with)]
#![feature(nonzero)]
#![feature(pattern)]
#![feature(range_is_empty)]
#![feature(raw)]
...
...
src/librustc/lib.rs
浏览文件 @
89d9ca9b
...
...
@@ -56,7 +56,6 @@
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(non_exhaustive)]
#![feature(nonzero)]
#![feature(proc_macro_internals)]
#![feature(quote)]
#![feature(optin_builtin_traits)]
...
...
src/librustc_data_structures/lib.rs
浏览文件 @
89d9ca9b
...
...
@@ -21,7 +21,6 @@
html_root_url
=
"https://doc.rust-lang.org/nightly/"
)]
#![feature(collections_range)]
#![feature(nonzero)]
#![feature(unboxed_closures)]
#![feature(fn_traits)]
#![feature(unsize)]
...
...
src/librustc_mir/lib.rs
浏览文件 @
89d9ca9b
...
...
@@ -30,7 +30,6 @@
#![feature(exhaustive_patterns)]
#![feature(range_contains)]
#![feature(rustc_diagnostic_macros)]
#![feature(nonzero)]
#![feature(inclusive_range_methods)]
#![feature(crate_visibility_modifier)]
#![feature(never_type)]
...
...
src/libstd/lib.rs
浏览文件 @
89d9ca9b
...
...
@@ -277,7 +277,6 @@
#![feature(needs_panic_runtime)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(nonzero)]
#![feature(num_bits_bytes)]
#![feature(old_wrapping)]
#![feature(on_unimplemented)]
...
...
src/libstd/num.rs
浏览文件 @
89d9ca9b
...
...
@@ -21,8 +21,7 @@
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
use
core
::
num
::
Wrapping
;
#[unstable(feature
=
"nonzero"
,
issue
=
"49137"
)]
#[allow(deprecated)]
#[stable(feature
=
"nonzero"
,
since
=
"1.28.0"
)]
pub
use
core
::
num
::{
NonZeroU8
,
NonZeroU16
,
NonZeroU32
,
NonZeroU64
,
NonZeroU128
,
NonZeroUsize
};
#[cfg(test)]
use
fmt
;
...
...
src/test/run-pass/ctfe/tuple-struct-constructors.rs
浏览文件 @
89d9ca9b
...
...
@@ -10,7 +10,6 @@
// https://github.com/rust-lang/rust/issues/41898
#![feature(nonzero)]
use
std
::
num
::
NonZeroU64
;
fn
main
()
{
...
...
src/test/run-pass/enum-null-pointer-opt.rs
浏览文件 @
89d9ca9b
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(nonzero,
core)]
use
std
::
mem
::
size_of
;
use
std
::
num
::
NonZeroUsize
;
use
std
::
ptr
::
NonNull
;
...
...
src/test/ui/print_type_sizes/niche-filling.rs
浏览文件 @
89d9ca9b
...
...
@@ -22,7 +22,6 @@
// padding and overall computed sizes can be quite different.
#![feature(start)]
#![feature(nonzero)]
#![allow(dead_code)]
use
std
::
num
::
NonZeroU32
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录