Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9aee389b
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,发现更多精彩内容 >>
提交
9aee389b
编写于
2月 18, 2015
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
差异文件
rollup merge of #22485: pnkfelix/fsk-int-uint-audit
cc #22240
上级
b90e4071
fc0f6e86
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
27 deletion
+27
-27
src/libcore/borrow.rs
src/libcore/borrow.rs
+1
-1
src/libcore/cmp.rs
src/libcore/cmp.rs
+6
-6
src/libcore/default.rs
src/libcore/default.rs
+8
-8
src/libcore/intrinsics.rs
src/libcore/intrinsics.rs
+12
-12
未找到文件。
src/libcore/borrow.rs
浏览文件 @
9aee389b
...
...
@@ -124,7 +124,7 @@ fn to_owned(&self) -> T { self.clone() }
/// ```rust
/// use std::borrow::Cow;
///
/// fn abs_all(input: &mut Cow<Vec<i
nt>, [int
]>) {
/// fn abs_all(input: &mut Cow<Vec<i
32>, [i32
]>) {
/// for i in 0..input.len() {
/// let v = input[i];
/// if v < 0 {
...
...
src/libcore/cmp.rs
浏览文件 @
9aee389b
...
...
@@ -215,7 +215,7 @@ impl Ord for Ordering {
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
fn
cmp
(
&
self
,
other
:
&
Ordering
)
->
Ordering
{
(
*
self
as
i
nt
)
.cmp
(
&
(
*
other
as
int
))
(
*
self
as
i
32
)
.cmp
(
&
(
*
other
as
i32
))
}
}
...
...
@@ -224,7 +224,7 @@ impl PartialOrd for Ordering {
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
fn
partial_cmp
(
&
self
,
other
:
&
Ordering
)
->
Option
<
Ordering
>
{
(
*
self
as
i
nt
)
.partial_cmp
(
&
(
*
other
as
int
))
(
*
self
as
i
32
)
.partial_cmp
(
&
(
*
other
as
i32
))
}
}
...
...
@@ -482,7 +482,7 @@ fn ne(&self, _other: &()) -> bool { false }
}
partial_eq_impl!
{
bool
char
u
int
u8
u16
u32
u64
int
i8
i16
i32
i64
f32
f64
bool
char
u
size
u8
u16
u32
u64
isize
i8
i16
i32
i64
f32
f64
}
macro_rules!
eq_impl
{
...
...
@@ -492,7 +492,7 @@ impl Eq for $t {}
)
*
)
}
eq_impl!
{
()
bool
char
u
int
u8
u16
u32
u64
int
i8
i16
i32
i64
}
eq_impl!
{
()
bool
char
u
size
u8
u16
u32
u64
isize
i8
i16
i32
i64
}
macro_rules!
partial_ord_impl
{
(
$
(
$t:ty
)
*
)
=>
(
$
(
...
...
@@ -535,7 +535,7 @@ fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
}
}
partial_ord_impl!
{
char
u
int
u8
u16
u32
u64
int
i8
i16
i32
i64
f32
f64
}
partial_ord_impl!
{
char
u
size
u8
u16
u32
u64
isize
i8
i16
i32
i64
f32
f64
}
macro_rules!
ord_impl
{
(
$
(
$t:ty
)
*
)
=>
(
$
(
...
...
@@ -565,7 +565,7 @@ fn cmp(&self, other: &bool) -> Ordering {
}
}
ord_impl!
{
char
u
int
u8
u16
u32
u64
int
i8
i16
i32
i64
}
ord_impl!
{
char
u
size
u8
u16
u32
u64
isize
i8
i16
i32
i64
}
// & pointers
...
...
src/libcore/default.rs
浏览文件 @
9aee389b
...
...
@@ -16,7 +16,7 @@
//!
//! ```
//! struct SomeOptions {
//! foo: i
nt
,
//! foo: i
32
,
//! bar: f32,
//! }
//! ```
...
...
@@ -28,7 +28,7 @@
//!
//! #[derive(Default)]
//! struct SomeOptions {
//! foo: i
nt
,
//! foo: i
32
,
//! bar: f32,
//! }
//!
...
...
@@ -56,7 +56,7 @@
//!
//! #[derive(Default)]
//! struct SomeOptions {
//! foo: i
nt
,
//! foo: i
32
,
//! bar: f32,
//! baz: Kind,
//! }
...
...
@@ -73,7 +73,7 @@
//! # use std::default::Default;
//! # #[derive(Default)]
//! # struct SomeOptions {
//! # foo: i
nt
,
//! # foo: i
32
,
//! # bar: f32,
//! # }
//! fn main() {
...
...
@@ -93,7 +93,7 @@
/// ```
/// #[derive(Default)]
/// struct SomeOptions {
/// foo: i
nt
,
/// foo: i
32
,
/// bar: f32,
/// }
/// ```
...
...
@@ -113,7 +113,7 @@ pub trait Default {
///
/// let i: i8 = Default::default();
/// let (x, y): (Option<String>, f64) = Default::default();
/// let (a, b, (c, d)): (i
nt, uint
, (bool, bool)) = Default::default();
/// let (a, b, (c, d)): (i
32, u32
, (bool, bool)) = Default::default();
/// ```
///
/// Making your own:
...
...
@@ -150,13 +150,13 @@ fn default() -> $t { $v }
default_impl!
{
bool
,
false
}
default_impl!
{
char
,
'\x00'
}
default_impl!
{
u
int
,
0
}
default_impl!
{
u
size
,
0
}
default_impl!
{
u8
,
0
}
default_impl!
{
u16
,
0
}
default_impl!
{
u32
,
0
}
default_impl!
{
u64
,
0
}
default_impl!
{
i
nt
,
0
}
default_impl!
{
i
size
,
0
}
default_impl!
{
i8
,
0
}
default_impl!
{
i16
,
0
}
default_impl!
{
i32
,
0
}
...
...
src/libcore/intrinsics.rs
浏览文件 @
9aee389b
...
...
@@ -50,10 +50,10 @@
#[derive(Copy)]
pub
struct
TyDesc
{
// sizeof(T)
pub
size
:
u
int
,
pub
size
:
u
size
,
// alignof(T)
pub
align
:
u
int
,
pub
align
:
u
size
,
// Called when a value of type `T` is no longer needed
pub
drop_glue
:
GlueFn
,
...
...
@@ -186,15 +186,15 @@ pub struct TyDesc {
/// would *exactly* overwrite a value. When laid out in vectors
/// and structures there may be additional padding between
/// elements.
pub
fn
size_of
<
T
>
()
->
u
int
;
pub
fn
size_of
<
T
>
()
->
u
size
;
/// Move a value to an uninitialized memory location.
///
/// Drop glue is not run on the destination.
pub
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
src
:
T
);
pub
fn
min_align_of
<
T
>
()
->
u
int
;
pub
fn
pref_align_of
<
T
>
()
->
u
int
;
pub
fn
min_align_of
<
T
>
()
->
u
size
;
pub
fn
pref_align_of
<
T
>
()
->
u
size
;
/// Get a static pointer to a type descriptor.
pub
fn
get_tydesc
<
T
:
?
Sized
>
()
->
*
const
TyDesc
;
...
...
@@ -253,7 +253,7 @@ pub struct TyDesc {
///
/// This is implemented as an intrinsic to avoid converting to and from an
/// integer, since the conversion would throw away aliasing information.
pub
fn
offset
<
T
>
(
dst
:
*
const
T
,
offset
:
i
nt
)
->
*
const
T
;
pub
fn
offset
<
T
>
(
dst
:
*
const
T
,
offset
:
i
size
)
->
*
const
T
;
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
/// and destination may *not* overlap.
...
...
@@ -294,7 +294,7 @@ pub struct TyDesc {
/// }
/// ```
#[unstable(feature
=
"core"
)]
pub
fn
copy_nonoverlapping_memory
<
T
>
(
dst
:
*
mut
T
,
src
:
*
const
T
,
count
:
u
int
);
pub
fn
copy_nonoverlapping_memory
<
T
>
(
dst
:
*
mut
T
,
src
:
*
const
T
,
count
:
u
size
);
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
/// and destination may overlap.
...
...
@@ -324,13 +324,13 @@ pub struct TyDesc {
/// ```
///
#[unstable(feature
=
"core"
)]
pub
fn
copy_memory
<
T
>
(
dst
:
*
mut
T
,
src
:
*
const
T
,
count
:
u
int
);
pub
fn
copy_memory
<
T
>
(
dst
:
*
mut
T
,
src
:
*
const
T
,
count
:
u
size
);
/// Invokes memset on the specified pointer, setting `count * size_of::<T>()`
/// bytes of memory starting at `dst` to `c`.
#[unstable(feature
=
"core"
,
reason
=
"uncertain about naming and semantics"
)]
pub
fn
set_memory
<
T
>
(
dst
:
*
mut
T
,
val
:
u8
,
count
:
u
int
);
pub
fn
set_memory
<
T
>
(
dst
:
*
mut
T
,
val
:
u8
,
count
:
u
size
);
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
/// a size of `count` * `size_of::<T>()` and an alignment of
...
...
@@ -338,19 +338,19 @@ pub struct TyDesc {
///
/// The volatile parameter parameter is set to `true`, so it will not be optimized out.
pub
fn
volatile_copy_nonoverlapping_memory
<
T
>
(
dst
:
*
mut
T
,
src
:
*
const
T
,
count
:
u
int
);
count
:
u
size
);
/// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
/// a size of `count` * `size_of::<T>()` and an alignment of
/// `min_align_of::<T>()`
///
/// The volatile parameter parameter is set to `true`, so it will not be optimized out.
pub
fn
volatile_copy_memory
<
T
>
(
dst
:
*
mut
T
,
src
:
*
const
T
,
count
:
u
int
);
pub
fn
volatile_copy_memory
<
T
>
(
dst
:
*
mut
T
,
src
:
*
const
T
,
count
:
u
size
);
/// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
/// size of `count` * `size_of::<T>()` and an alignment of
/// `min_align_of::<T>()`.
///
/// The volatile parameter parameter is set to `true`, so it will not be optimized out.
pub
fn
volatile_set_memory
<
T
>
(
dst
:
*
mut
T
,
val
:
u8
,
count
:
u
int
);
pub
fn
volatile_set_memory
<
T
>
(
dst
:
*
mut
T
,
val
:
u8
,
count
:
u
size
);
/// Perform a volatile load from the `src` pointer.
pub
fn
volatile_load
<
T
>
(
src
:
*
const
T
)
->
T
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录