Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f4fa7c8a
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,发现更多精彩内容 >>
提交
f4fa7c8a
编写于
5月 29, 2014
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Register new snapshots
上级
e5e865b8
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
13 addition
and
1265 deletion
+13
-1265
src/liballoc/heap.rs
src/liballoc/heap.rs
+1
-8
src/libcore/failure.rs
src/libcore/failure.rs
+2
-38
src/libstd/fmt.rs
src/libstd/fmt.rs
+0
-40
src/libstd/lib.rs
src/libstd/lib.rs
+0
-7
src/libstd/reflect.rs
src/libstd/reflect.rs
+0
-439
src/libstd/repr.rs
src/libstd/repr.rs
+0
-663
src/libstd/rt/stack.rs
src/libstd/rt/stack.rs
+1
-30
src/libstd/rt/unwind.rs
src/libstd/rt/unwind.rs
+1
-40
src/snapshots.txt
src/snapshots.txt
+8
-0
未找到文件。
src/liballoc/heap.rs
浏览文件 @
f4fa7c8a
...
...
@@ -133,14 +133,7 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
}
}
#[cfg(not(test),
stage0)]
#[lang=
"exchange_free"
]
#[inline]
unsafe
fn
exchange_free
(
ptr
:
*
mut
u8
)
{
deallocate
(
ptr
,
0
,
8
);
}
#[cfg(not(test),
not(stage0))]
#[cfg(not(test))]
#[lang=
"exchange_free"
]
#[inline]
unsafe
fn
exchange_free
(
ptr
:
*
mut
u8
,
size
:
uint
,
align
:
uint
)
{
...
...
src/libcore/failure.rs
浏览文件 @
f4fa7c8a
...
...
@@ -30,12 +30,10 @@
use
fmt
;
use
intrinsics
;
#[cfg(not(test),
stage0)]
use
str
::
raw
::
c_str_to_static_slice
;
#[cold]
#[inline(never)]
// this is the slow path, always
#[lang=
"fail_"
]
#[cfg(not(test)
,
not(stage0)
)]
#[cfg(not(test))]
fn
fail_
(
expr
:
&
'static
str
,
file
:
&
'static
str
,
line
:
uint
)
->
!
{
format_args!
(|
args
|
->
()
{
begin_unwind
(
args
,
file
,
line
);
...
...
@@ -44,24 +42,9 @@ fn fail_(expr: &'static str, file: &'static str, line: uint) -> ! {
unsafe
{
intrinsics
::
abort
()
}
}
#[cold]
#[inline(never)]
// this is the slow path, always
#[lang=
"fail_"
]
#[cfg(not(test),
stage0)]
fn
fail_
(
expr
:
*
u8
,
file
:
*
u8
,
line
:
uint
)
->
!
{
unsafe
{
let
expr
=
c_str_to_static_slice
(
expr
as
*
i8
);
let
file
=
c_str_to_static_slice
(
file
as
*
i8
);
format_args!
(|
args
|
->
()
{
begin_unwind
(
args
,
file
,
line
);
},
"{}"
,
expr
);
intrinsics
::
abort
()
}
}
#[cold]
#[lang=
"fail_bounds_check"
]
#[cfg(not(test)
,
not(stage0)
)]
#[cfg(not(test))]
fn
fail_bounds_check
(
file
:
&
'static
str
,
line
:
uint
,
index
:
uint
,
len
:
uint
)
->
!
{
format_args!
(|
args
|
->
()
{
...
...
@@ -70,28 +53,9 @@ fn fail_bounds_check(file: &'static str, line: uint,
unsafe
{
intrinsics
::
abort
()
}
}
#[cold]
#[lang=
"fail_bounds_check"
]
#[cfg(not(test),
stage0)]
fn
fail_bounds_check
(
file
:
*
u8
,
line
:
uint
,
index
:
uint
,
len
:
uint
)
->
!
{
let
file
=
unsafe
{
c_str_to_static_slice
(
file
as
*
i8
)
};
format_args!
(|
args
|
->
()
{
begin_unwind
(
args
,
file
,
line
);
},
"index out of bounds: the len is {} but the index is {}"
,
len
,
index
);
unsafe
{
intrinsics
::
abort
()
}
}
#[cold]
pub
fn
begin_unwind
(
fmt
:
&
fmt
::
Arguments
,
file
:
&
'static
str
,
line
:
uint
)
->
!
{
#[allow(ctypes)]
#[cfg(stage0)]
extern
{
#[link_name
=
"rust_begin_unwind"
]
fn
begin_unwind
(
fmt
:
&
fmt
::
Arguments
,
file
:
&
'static
str
,
line
:
uint
)
->
!
;
}
#[allow(ctypes)]
#[cfg(not(stage0))]
extern
{
#[lang
=
"begin_unwind"
]
fn
begin_unwind
(
fmt
:
&
fmt
::
Arguments
,
file
:
&
'static
str
,
...
...
src/libstd/fmt.rs
浏览文件 @
f4fa7c8a
...
...
@@ -492,10 +492,6 @@ fn my_fmt_fn(args: &fmt::Arguments) {
use
io
::
Writer
;
use
io
;
#[cfg(stage0)]
use
option
::
None
;
#[cfg(stage0)]
use
repr
;
use
result
::{
Ok
,
Err
};
use
str
::{
Str
,
StrAllocating
};
use
str
;
...
...
@@ -524,21 +520,6 @@ fn my_fmt_fn(args: &fmt::Arguments) {
#[doc(hidden)]
pub
use
core
::
fmt
::{
secret_pointer
};
#[doc(hidden)]
#[cfg(stage0)]
pub
fn
secret_poly
<
T
:
Poly
>
(
x
:
&
T
,
fmt
:
&
mut
Formatter
)
->
Result
{
// FIXME #11938 - UFCS would make us able call the this method
// directly Poly::fmt(x, fmt).
x
.fmt
(
fmt
)
}
/// Format trait for the `?` character
#[cfg(stage0)]
pub
trait
Poly
{
/// Formats the value using the given formatter.
fn
fmt
(
&
self
,
&
mut
Formatter
)
->
Result
;
}
/// The format function takes a precompiled format string and a list of
/// arguments, to return the resulting formatted string.
///
...
...
@@ -562,27 +543,6 @@ pub fn format(args: &Arguments) -> string::String{
str
::
from_utf8
(
output
.unwrap
()
.as_slice
())
.unwrap
()
.into_string
()
}
#[cfg(stage0)]
impl
<
T
>
Poly
for
T
{
fn
fmt
(
&
self
,
f
:
&
mut
Formatter
)
->
Result
{
match
(
f
.width
,
f
.precision
)
{
(
None
,
None
)
=>
{
match
repr
::
write_repr
(
f
,
self
)
{
Ok
(())
=>
Ok
(()),
Err
(
..
)
=>
Err
(
WriteError
),
}
}
// If we have a specified width for formatting, then we have to make
// this allocation of a new string
_
=>
{
let
s
=
repr
::
repr_to_str
(
self
);
f
.pad
(
s
.as_slice
())
}
}
}
}
impl
<
'a
>
Writer
for
Formatter
<
'a
>
{
fn
write
(
&
mut
self
,
b
:
&
[
u8
])
->
io
::
IoResult
<
()
>
{
match
(
*
self
)
.write
(
b
)
{
...
...
src/libstd/lib.rs
浏览文件 @
f4fa7c8a
...
...
@@ -241,13 +241,6 @@ fn start(argc: int, argv: **u8) -> int {
pub
mod
fmt
;
pub
mod
cleanup
;
/* Unsupported interfaces */
#[unstable]
pub
mod
repr
;
#[unstable]
pub
mod
reflect
;
// Private APIs
#[unstable]
pub
mod
unstable
;
...
...
src/libstd/reflect.rs
已删除
100644 → 0
浏览文件 @
e5e865b8
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/*!
Runtime type reflection
*/
#![allow(missing_doc)]
use
intrinsics
::{
Disr
,
Opaque
,
TyDesc
,
TyVisitor
};
use
mem
;
use
owned
::
Box
;
/**
* Trait for visitor that wishes to reflect on data. To use this, create a
* struct that encapsulates the set of pointers you wish to walk through a
* data structure, and implement both `MovePtr` for it as well as `TyVisitor`;
* then build a MovePtrAdaptor wrapped around your struct.
*/
pub
trait
MovePtr
{
fn
move_ptr
(
&
mut
self
,
adjustment
:
|
*
u8
|
->
*
u8
);
fn
push_ptr
(
&
mut
self
);
fn
pop_ptr
(
&
mut
self
);
}
/// Helper function for alignment calculation.
#[inline]
pub
fn
align
(
size
:
uint
,
align
:
uint
)
->
uint
{
((
size
+
align
)
-
1u
)
&
!
(
align
-
1u
)
}
/// Adaptor to wrap around visitors implementing MovePtr.
pub
struct
MovePtrAdaptor
<
V
>
{
inner
:
V
}
impl
<
V
:
TyVisitor
+
MovePtr
>
MovePtrAdaptor
<
V
>
{
pub
fn
new
(
v
:
V
)
->
MovePtrAdaptor
<
V
>
{
MovePtrAdaptor
{
inner
:
v
}
}
#[inline]
pub
fn
bump
(
&
mut
self
,
sz
:
uint
)
{
self
.inner
.move_ptr
(|
p
|
((
p
as
uint
)
+
sz
)
as
*
u8
)
}
#[inline]
pub
fn
align
(
&
mut
self
,
a
:
uint
)
{
self
.inner
.move_ptr
(|
p
|
align
(
p
as
uint
,
a
)
as
*
u8
)
}
#[inline]
pub
fn
align_to
<
T
>
(
&
mut
self
)
{
self
.align
(
mem
::
min_align_of
::
<
T
>
());
}
#[inline]
pub
fn
bump_past
<
T
>
(
&
mut
self
)
{
self
.bump
(
mem
::
size_of
::
<
T
>
());
}
pub
fn
unwrap
(
self
)
->
V
{
self
.inner
}
}
/// Abstract type-directed pointer-movement using the MovePtr trait
impl
<
V
:
TyVisitor
+
MovePtr
>
TyVisitor
for
MovePtrAdaptor
<
V
>
{
fn
visit_bot
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
()
>
();
if
!
self
.inner
.visit_bot
()
{
return
false
;
}
self
.bump_past
::
<
()
>
();
true
}
fn
visit_nil
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
()
>
();
if
!
self
.inner
.visit_nil
()
{
return
false
;
}
self
.bump_past
::
<
()
>
();
true
}
fn
visit_bool
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
bool
>
();
if
!
self
.inner
.visit_bool
()
{
return
false
;
}
self
.bump_past
::
<
bool
>
();
true
}
fn
visit_int
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
int
>
();
if
!
self
.inner
.visit_int
()
{
return
false
;
}
self
.bump_past
::
<
int
>
();
true
}
fn
visit_i8
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
i8
>
();
if
!
self
.inner
.visit_i8
()
{
return
false
;
}
self
.bump_past
::
<
i8
>
();
true
}
fn
visit_i16
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
i16
>
();
if
!
self
.inner
.visit_i16
()
{
return
false
;
}
self
.bump_past
::
<
i16
>
();
true
}
fn
visit_i32
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
i32
>
();
if
!
self
.inner
.visit_i32
()
{
return
false
;
}
self
.bump_past
::
<
i32
>
();
true
}
fn
visit_i64
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
i64
>
();
if
!
self
.inner
.visit_i64
()
{
return
false
;
}
self
.bump_past
::
<
i64
>
();
true
}
fn
visit_uint
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
uint
>
();
if
!
self
.inner
.visit_uint
()
{
return
false
;
}
self
.bump_past
::
<
uint
>
();
true
}
fn
visit_u8
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
u8
>
();
if
!
self
.inner
.visit_u8
()
{
return
false
;
}
self
.bump_past
::
<
u8
>
();
true
}
fn
visit_u16
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
u16
>
();
if
!
self
.inner
.visit_u16
()
{
return
false
;
}
self
.bump_past
::
<
u16
>
();
true
}
fn
visit_u32
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
u32
>
();
if
!
self
.inner
.visit_u32
()
{
return
false
;
}
self
.bump_past
::
<
u32
>
();
true
}
fn
visit_u64
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
u64
>
();
if
!
self
.inner
.visit_u64
()
{
return
false
;
}
self
.bump_past
::
<
u64
>
();
true
}
fn
visit_f32
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
f32
>
();
if
!
self
.inner
.visit_f32
()
{
return
false
;
}
self
.bump_past
::
<
f32
>
();
true
}
fn
visit_f64
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
f64
>
();
if
!
self
.inner
.visit_f64
()
{
return
false
;
}
self
.bump_past
::
<
f64
>
();
true
}
fn
visit_f128
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
f128
>
();
if
!
self
.inner
.visit_f128
()
{
return
false
;
}
self
.bump_past
::
<
f128
>
();
true
}
fn
visit_char
(
&
mut
self
)
->
bool
{
self
.align_to
::
<
char
>
();
if
!
self
.inner
.visit_char
()
{
return
false
;
}
self
.bump_past
::
<
char
>
();
true
}
fn
visit_estr_box
(
&
mut
self
)
->
bool
{
true
}
fn
visit_estr_uniq
(
&
mut
self
)
->
bool
{
self
.align_to
::
<~
str
>
();
if
!
self
.inner
.visit_estr_uniq
()
{
return
false
;
}
self
.bump_past
::
<~
str
>
();
true
}
fn
visit_estr_slice
(
&
mut
self
)
->
bool
{
self
.align_to
::
<&
'static
str
>
();
if
!
self
.inner
.visit_estr_slice
()
{
return
false
;
}
self
.bump_past
::
<&
'static
str
>
();
true
}
fn
visit_estr_fixed
(
&
mut
self
,
n
:
uint
,
sz
:
uint
,
align
:
uint
)
->
bool
{
self
.align
(
align
);
if
!
self
.inner
.visit_estr_fixed
(
n
,
sz
,
align
)
{
return
false
;
}
self
.bump
(
sz
);
true
}
fn
visit_box
(
&
mut
self
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.align_to
::
<@
u8
>
();
if
!
self
.inner
.visit_box
(
mtbl
,
inner
)
{
return
false
;
}
self
.bump_past
::
<@
u8
>
();
true
}
fn
visit_uniq
(
&
mut
self
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.align_to
::
<
Box
<
u8
>>
();
if
!
self
.inner
.visit_uniq
(
mtbl
,
inner
)
{
return
false
;
}
self
.bump_past
::
<
Box
<
u8
>>
();
true
}
fn
visit_ptr
(
&
mut
self
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.align_to
::
<*
u8
>
();
if
!
self
.inner
.visit_ptr
(
mtbl
,
inner
)
{
return
false
;
}
self
.bump_past
::
<*
u8
>
();
true
}
fn
visit_rptr
(
&
mut
self
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.align_to
::
<&
'static
u8
>
();
if
!
self
.inner
.visit_rptr
(
mtbl
,
inner
)
{
return
false
;
}
self
.bump_past
::
<&
'static
u8
>
();
true
}
fn
visit_evec_box
(
&
mut
self
,
_
mtbl
:
uint
,
_
inner
:
*
TyDesc
)
->
bool
{
true
}
fn
visit_evec_uniq
(
&
mut
self
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.align_to
::
<~
[
u8
]
>
();
if
!
self
.inner
.visit_evec_uniq
(
mtbl
,
inner
)
{
return
false
;
}
self
.bump_past
::
<~
[
u8
]
>
();
true
}
fn
visit_evec_slice
(
&
mut
self
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.align_to
::
<&
'static
[
u8
]
>
();
if
!
self
.inner
.visit_evec_slice
(
mtbl
,
inner
)
{
return
false
;
}
self
.bump_past
::
<&
'static
[
u8
]
>
();
true
}
fn
visit_evec_fixed
(
&
mut
self
,
n
:
uint
,
sz
:
uint
,
align
:
uint
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.align
(
align
);
if
!
self
.inner
.visit_evec_fixed
(
n
,
sz
,
align
,
mtbl
,
inner
)
{
return
false
;
}
self
.bump
(
sz
);
true
}
fn
visit_enter_rec
(
&
mut
self
,
n_fields
:
uint
,
sz
:
uint
,
align
:
uint
)
->
bool
{
self
.align
(
align
);
if
!
self
.inner
.visit_enter_rec
(
n_fields
,
sz
,
align
)
{
return
false
;
}
true
}
fn
visit_rec_field
(
&
mut
self
,
i
:
uint
,
name
:
&
str
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
unsafe
{
self
.align
((
*
inner
)
.align
);
}
if
!
self
.inner
.visit_rec_field
(
i
,
name
,
mtbl
,
inner
)
{
return
false
;
}
unsafe
{
self
.bump
((
*
inner
)
.size
);
}
true
}
fn
visit_leave_rec
(
&
mut
self
,
n_fields
:
uint
,
sz
:
uint
,
align
:
uint
)
->
bool
{
if
!
self
.inner
.visit_leave_rec
(
n_fields
,
sz
,
align
)
{
return
false
;
}
true
}
fn
visit_enter_class
(
&
mut
self
,
name
:
&
str
,
named_fields
:
bool
,
n_fields
:
uint
,
sz
:
uint
,
align
:
uint
)
->
bool
{
self
.align
(
align
);
if
!
self
.inner
.visit_enter_class
(
name
,
named_fields
,
n_fields
,
sz
,
align
)
{
return
false
;
}
true
}
fn
visit_class_field
(
&
mut
self
,
i
:
uint
,
name
:
&
str
,
named
:
bool
,
mtbl
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
unsafe
{
self
.align
((
*
inner
)
.align
);
}
if
!
self
.inner
.visit_class_field
(
i
,
name
,
named
,
mtbl
,
inner
)
{
return
false
;
}
unsafe
{
self
.bump
((
*
inner
)
.size
);
}
true
}
fn
visit_leave_class
(
&
mut
self
,
name
:
&
str
,
named_fields
:
bool
,
n_fields
:
uint
,
sz
:
uint
,
align
:
uint
)
->
bool
{
if
!
self
.inner
.visit_leave_class
(
name
,
named_fields
,
n_fields
,
sz
,
align
)
{
return
false
;
}
true
}
fn
visit_enter_tup
(
&
mut
self
,
n_fields
:
uint
,
sz
:
uint
,
align
:
uint
)
->
bool
{
self
.align
(
align
);
if
!
self
.inner
.visit_enter_tup
(
n_fields
,
sz
,
align
)
{
return
false
;
}
true
}
fn
visit_tup_field
(
&
mut
self
,
i
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
unsafe
{
self
.align
((
*
inner
)
.align
);
}
if
!
self
.inner
.visit_tup_field
(
i
,
inner
)
{
return
false
;
}
unsafe
{
self
.bump
((
*
inner
)
.size
);
}
true
}
fn
visit_leave_tup
(
&
mut
self
,
n_fields
:
uint
,
sz
:
uint
,
align
:
uint
)
->
bool
{
if
!
self
.inner
.visit_leave_tup
(
n_fields
,
sz
,
align
)
{
return
false
;
}
true
}
fn
visit_enter_fn
(
&
mut
self
,
purity
:
uint
,
proto
:
uint
,
n_inputs
:
uint
,
retstyle
:
uint
)
->
bool
{
if
!
self
.inner
.visit_enter_fn
(
purity
,
proto
,
n_inputs
,
retstyle
)
{
return
false
}
true
}
fn
visit_fn_input
(
&
mut
self
,
i
:
uint
,
mode
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
if
!
self
.inner
.visit_fn_input
(
i
,
mode
,
inner
)
{
return
false
;
}
true
}
fn
visit_fn_output
(
&
mut
self
,
retstyle
:
uint
,
variadic
:
bool
,
inner
:
*
TyDesc
)
->
bool
{
if
!
self
.inner
.visit_fn_output
(
retstyle
,
variadic
,
inner
)
{
return
false
;
}
true
}
fn
visit_leave_fn
(
&
mut
self
,
purity
:
uint
,
proto
:
uint
,
n_inputs
:
uint
,
retstyle
:
uint
)
->
bool
{
if
!
self
.inner
.visit_leave_fn
(
purity
,
proto
,
n_inputs
,
retstyle
)
{
return
false
;
}
true
}
fn
visit_enter_enum
(
&
mut
self
,
n_variants
:
uint
,
get_disr
:
unsafe
extern
fn
(
ptr
:
*
Opaque
)
->
Disr
,
sz
:
uint
,
align
:
uint
)
->
bool
{
self
.align
(
align
);
if
!
self
.inner
.visit_enter_enum
(
n_variants
,
get_disr
,
sz
,
align
)
{
return
false
;
}
true
}
fn
visit_enter_enum_variant
(
&
mut
self
,
variant
:
uint
,
disr_val
:
Disr
,
n_fields
:
uint
,
name
:
&
str
)
->
bool
{
if
!
self
.inner
.visit_enter_enum_variant
(
variant
,
disr_val
,
n_fields
,
name
)
{
return
false
;
}
true
}
fn
visit_enum_variant_field
(
&
mut
self
,
i
:
uint
,
offset
:
uint
,
inner
:
*
TyDesc
)
->
bool
{
self
.inner
.push_ptr
();
self
.bump
(
offset
);
if
!
self
.inner
.visit_enum_variant_field
(
i
,
offset
,
inner
)
{
return
false
;
}
self
.inner
.pop_ptr
();
true
}
fn
visit_leave_enum_variant
(
&
mut
self
,
variant
:
uint
,
disr_val
:
Disr
,
n_fields
:
uint
,
name
:
&
str
)
->
bool
{
if
!
self
.inner
.visit_leave_enum_variant
(
variant
,
disr_val
,
n_fields
,
name
)
{
return
false
;
}
true
}
fn
visit_leave_enum
(
&
mut
self
,
n_variants
:
uint
,
get_disr
:
unsafe
extern
fn
(
ptr
:
*
Opaque
)
->
Disr
,
sz
:
uint
,
align
:
uint
)
->
bool
{
if
!
self
.inner
.visit_leave_enum
(
n_variants
,
get_disr
,
sz
,
align
)
{
return
false
;
}
self
.bump
(
sz
);
true
}
fn
visit_trait
(
&
mut
self
,
name
:
&
str
)
->
bool
{
self
.align_to
::
<
Box
<
TyVisitor
>>
();
if
!
self
.inner
.visit_trait
(
name
)
{
return
false
;
}
self
.bump_past
::
<
Box
<
TyVisitor
>>
();
true
}
fn
visit_param
(
&
mut
self
,
i
:
uint
)
->
bool
{
if
!
self
.inner
.visit_param
(
i
)
{
return
false
;
}
true
}
fn
visit_self
(
&
mut
self
)
->
bool
{
self
.align_to
::
<&
'static
u8
>
();
if
!
self
.inner
.visit_self
()
{
return
false
;
}
self
.align_to
::
<&
'static
u8
>
();
true
}
}
src/libstd/repr.rs
已删除
100644 → 0
浏览文件 @
e5e865b8
此差异已折叠。
点击以展开。
src/libstd/rt/stack.rs
浏览文件 @
f4fa7c8a
...
...
@@ -30,7 +30,7 @@
/// stacks are currently not enabled as segmented stacks, but rather one giant
/// stack segment. This means that whenever we run out of stack, we want to
/// truly consider it to be stack overflow rather than allocating a new stack.
#[cfg(not(test)
,
not(stage0)
)]
// in testing, use the original libstd's version
#[cfg(not(test))]
// in testing, use the original libstd's version
#[lang
=
"stack_exhausted"
]
extern
fn
stack_exhausted
()
{
use
option
::{
Option
,
None
,
Some
};
...
...
@@ -103,35 +103,6 @@
}
}
#[no_mangle]
// - this is called from C code
#[no_split_stack]
// - it would be sad for this function to trigger __morestack
#[doc(hidden)]
// - Function must be `pub` to get exported, but it's
// irrelevant for documentation purposes.
#[cfg(stage0,
not(test))]
// in testing, use the original libstd's version
pub
extern
"C"
fn
rust_stack_exhausted
()
{
use
option
::{
Option
,
None
,
Some
};
use
owned
::
Box
;
use
rt
::
local
::
Local
;
use
rt
::
task
::
Task
;
use
str
::
Str
;
use
intrinsics
;
unsafe
{
let
limit
=
get_sp_limit
();
record_sp_limit
(
limit
-
RED_ZONE
/
2
);
let
task
:
Option
<
Box
<
Task
>>
=
Local
::
try_take
();
let
name
=
match
task
{
Some
(
ref
task
)
=>
{
task
.name
.as_ref
()
.map
(|
n
|
n
.as_slice
())
}
None
=>
None
};
let
name
=
name
.unwrap_or
(
"<unknown>"
);
rterrln!
(
"task '{}' has overflowed its stack"
,
name
);
intrinsics
::
abort
();
}
}
#[inline(always)]
pub
unsafe
fn
record_stack_bounds
(
stack_lo
:
uint
,
stack_hi
:
uint
)
{
// When the old runtime had segmented stacks, it used a calculation that was
...
...
src/libstd/rt/unwind.rs
浏览文件 @
f4fa7c8a
...
...
@@ -213,7 +213,6 @@ fn __gcc_personality_v0(version: c_int,
}
#[lang=
"eh_personality"
]
#[cfg(not(stage0))]
extern
fn
eh_personality
(
version
:
c_int
,
actions
:
uw
::
_
Unwind_Action
,
...
...
@@ -227,22 +226,6 @@ fn __gcc_personality_v0(version: c_int,
context
)
}
}
#[lang=
"eh_personality"
]
#[no_mangle]
// so we can reference it by name from middle/trans/base.rs
#[cfg(stage0)]
pub
extern
"C"
fn
rust_eh_personality
(
version
:
c_int
,
actions
:
uw
::
_
Unwind_Action
,
exception_class
:
uw
::
_
Unwind_Exception_Class
,
ue_header
:
*
uw
::
_
Unwind_Exception
,
context
:
*
uw
::
_
Unwind_Context
)
->
uw
::
_
Unwind_Reason_Code
{
unsafe
{
__
gcc_personality_v0
(
version
,
actions
,
exception_class
,
ue_header
,
context
)
}
}
#[no_mangle]
// referenced from rust_try.ll
pub
extern
"C"
fn
rust_eh_personality_catch
(
...
...
@@ -281,7 +264,6 @@ fn __gcc_personality_v0(state: uw::_Unwind_State,
}
#[lang=
"eh_personality"
]
#[cfg(not(stage0))]
extern
"C"
fn
eh_personality
(
state
:
uw
::
_
Unwind_State
,
ue_header
:
*
uw
::
_
Unwind_Exception
,
...
...
@@ -293,20 +275,6 @@ extern "C" fn eh_personality(
}
}
#[lang=
"eh_personality"
]
#[no_mangle]
// so we can reference it by name from middle/trans/base.rs
#[cfg(stage0)]
pub
extern
"C"
fn
rust_eh_personality
(
state
:
uw
::
_
Unwind_State
,
ue_header
:
*
uw
::
_
Unwind_Exception
,
context
:
*
uw
::
_
Unwind_Context
)
->
uw
::
_
Unwind_Reason_Code
{
unsafe
{
__
gcc_personality_v0
(
state
,
ue_header
,
context
)
}
}
#[no_mangle]
// referenced from rust_try.ll
pub
extern
"C"
fn
rust_eh_personality_catch
(
state
:
uw
::
_
Unwind_State
,
...
...
@@ -327,20 +295,13 @@ pub extern "C" fn rust_eh_personality_catch(
}
// Entry point of failure from the libcore crate
#[cfg(not(test)
,
not(stage0)
)]
#[cfg(not(test))]
#[lang
=
"begin_unwind"
]
pub
extern
fn
rust_begin_unwind
(
msg
:
&
fmt
::
Arguments
,
file
:
&
'static
str
,
line
:
uint
)
->
!
{
begin_unwind_fmt
(
msg
,
file
,
line
)
}
#[no_mangle]
#[cfg(not(test),
stage0)]
pub
extern
fn
rust_begin_unwind
(
msg
:
&
fmt
::
Arguments
,
file
:
&
'static
str
,
line
:
uint
)
->
!
{
begin_unwind_fmt
(
msg
,
file
,
line
)
}
/// The entry point for unwinding with a formatted message.
///
/// This is designed to reduce the amount of code required at the call
...
...
src/snapshots.txt
浏览文件 @
f4fa7c8a
S 2014-05-29 50b8528
freebsd-x86_64 cfa0dcc98a57f03a53bb53df6fd5db02143e2bee
linux-i386 baf7c6ab5792f3d560a0f2adc94d7ff96d0cab3d
linux-x86_64 ed97bc90842b96b95e860b9d21fe1ade3f682fd3
macos-i386 2d0e27f72e34be53b1f16d704e9a3b8bedbdbd31
macos-x86_64 f8912b07014c234ae2d625d6da84c752508a2b04
winnt-i386 0af7b426f57015d8392e00ee9a9d1f2f5eb10761
S 2014-05-16 5327218
freebsd-x86_64 e91e235c808eb7e8a1e82f7e00c874de9b1df345
linux-i386 3a3b7d68ed42a144fa06c9a49c63966da9adeef2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录