Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4e161a4d
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,发现更多精彩内容 >>
提交
4e161a4d
编写于
9月 16, 2013
作者:
D
Daniel Micay
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switch Drop to `&mut self`
上级
bc89ade4
变更
129
展开全部
隐藏空白更改
内联
并排
Showing
129 changed file
with
192 addition
and
203 deletion
+192
-203
doc/tutorial-ffi.md
doc/tutorial-ffi.md
+1
-1
doc/tutorial.md
doc/tutorial.md
+1
-1
src/libextra/arc.rs
src/libextra/arc.rs
+1
-1
src/libextra/arena.rs
src/libextra/arena.rs
+1
-1
src/libextra/c_vec.rs
src/libextra/c_vec.rs
+1
-1
src/libextra/dlist.rs
src/libextra/dlist.rs
+5
-8
src/libextra/future.rs
src/libextra/future.rs
+1
-1
src/libextra/rc.rs
src/libextra/rc.rs
+2
-2
src/libextra/task_pool.rs
src/libextra/task_pool.rs
+1
-1
src/libextra/workcache.rs
src/libextra/workcache.rs
+1
-1
src/librustc/back/link.rs
src/librustc/back/link.rs
+1
-1
src/librustc/lib/llvm.rs
src/librustc/lib/llvm.rs
+4
-4
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+2
-2
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/common.rs
+1
-1
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/context.rs
+1
-1
src/librustc/rustc.rs
src/librustc/rustc.rs
+1
-1
src/librustc/util/common.rs
src/librustc/util/common.rs
+1
-1
src/librustdoc/demo.rs
src/librustdoc/demo.rs
+1
-1
src/libstd/c_str.rs
src/libstd/c_str.rs
+1
-1
src/libstd/condition.rs
src/libstd/condition.rs
+1
-1
src/libstd/io.rs
src/libstd/io.rs
+3
-3
src/libstd/ops.rs
src/libstd/ops.rs
+3
-3
src/libstd/option.rs
src/libstd/option.rs
+1
-1
src/libstd/os.rs
src/libstd/os.rs
+2
-2
src/libstd/rt/comm.rs
src/libstd/rt/comm.rs
+2
-2
src/libstd/rt/kill.rs
src/libstd/rt/kill.rs
+2
-2
src/libstd/rt/local_heap.rs
src/libstd/rt/local_heap.rs
+1
-1
src/libstd/rt/rc.rs
src/libstd/rt/rc.rs
+1
-1
src/libstd/rt/sched.rs
src/libstd/rt/sched.rs
+3
-3
src/libstd/rt/stack.rs
src/libstd/rt/stack.rs
+1
-1
src/libstd/rt/task.rs
src/libstd/rt/task.rs
+1
-1
src/libstd/rt/thread.rs
src/libstd/rt/thread.rs
+1
-1
src/libstd/rt/uv/uvio.rs
src/libstd/rt/uv/uvio.rs
+7
-7
src/libstd/run.rs
src/libstd/run.rs
+3
-6
src/libstd/task/spawn.rs
src/libstd/task/spawn.rs
+28
-33
src/libstd/unstable/atomics.rs
src/libstd/unstable/atomics.rs
+1
-1
src/libstd/unstable/dynamic_lib.rs
src/libstd/unstable/dynamic_lib.rs
+1
-1
src/libstd/unstable/finally.rs
src/libstd/unstable/finally.rs
+1
-1
src/libstd/unstable/sync.rs
src/libstd/unstable/sync.rs
+2
-2
src/libstd/util.rs
src/libstd/util.rs
+2
-2
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+1
-1
src/test/auxiliary/issue-2526.rs
src/test/auxiliary/issue-2526.rs
+2
-2
src/test/auxiliary/issue-3012-1.rs
src/test/auxiliary/issue-3012-1.rs
+1
-1
src/test/auxiliary/issue2170lib.rs
src/test/auxiliary/issue2170lib.rs
+1
-1
src/test/auxiliary/moves_based_on_type_lib.rs
src/test/auxiliary/moves_based_on_type_lib.rs
+1
-1
src/test/bench/task-perf-alloc-unwind.rs
src/test/bench/task-perf-alloc-unwind.rs
+1
-1
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs
...nd-by-move-neither-can-live-while-the-other-survives-1.rs
+1
-1
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs
...nd-by-move-neither-can-live-while-the-other-survives-2.rs
+1
-1
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs
...nd-by-move-neither-can-live-while-the-other-survives-3.rs
+1
-1
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs
...nd-by-move-neither-can-live-while-the-other-survives-4.rs
+1
-1
src/test/compile-fail/bind-by-move-no-sub-bindings.rs
src/test/compile-fail/bind-by-move-no-sub-bindings.rs
+1
-1
src/test/compile-fail/block-must-not-have-result-res.rs
src/test/compile-fail/block-must-not-have-result-res.rs
+1
-1
src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
+1
-1
src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs
...est/compile-fail/borrowck-move-out-of-struct-with-dtor.rs
+1
-1
src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs
...mpile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs
+1
-1
src/test/compile-fail/copy-a-resource.rs
src/test/compile-fail/copy-a-resource.rs
+1
-1
src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs
...-fail/disallowed-deconstructing-destructing-struct-let.rs
+1
-1
src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs
...ail/disallowed-deconstructing-destructing-struct-match.rs
+1
-1
src/test/compile-fail/drop-on-non-struct.rs
src/test/compile-fail/drop-on-non-struct.rs
+1
-1
src/test/compile-fail/explicit-call-to-dtor.rs
src/test/compile-fail/explicit-call-to-dtor.rs
+1
-1
src/test/compile-fail/explicit-call-to-supertrait-dtor.rs
src/test/compile-fail/explicit-call-to-supertrait-dtor.rs
+1
-1
src/test/compile-fail/functional-struct-update-noncopyable.rs
...test/compile-fail/functional-struct-update-noncopyable.rs
+1
-1
src/test/compile-fail/issue-2548.rs
src/test/compile-fail/issue-2548.rs
+1
-1
src/test/compile-fail/issue-2823.rs
src/test/compile-fail/issue-2823.rs
+1
-1
src/test/compile-fail/issue-3214.rs
src/test/compile-fail/issue-3214.rs
+1
-1
src/test/compile-fail/kindck-destructor-owned.rs
src/test/compile-fail/kindck-destructor-owned.rs
+1
-1
src/test/compile-fail/no-send-res-ports.rs
src/test/compile-fail/no-send-res-ports.rs
+1
-1
src/test/compile-fail/noncopyable-class.rs
src/test/compile-fail/noncopyable-class.rs
+1
-1
src/test/compile-fail/pinned-deep-copy.rs
src/test/compile-fail/pinned-deep-copy.rs
+1
-1
src/test/compile-fail/repeat-to-run-dtor-twice.rs
src/test/compile-fail/repeat-to-run-dtor-twice.rs
+1
-1
src/test/compile-fail/unique-object-noncopyable.rs
src/test/compile-fail/unique-object-noncopyable.rs
+1
-1
src/test/compile-fail/unique-pinned-nocopy.rs
src/test/compile-fail/unique-pinned-nocopy.rs
+1
-1
src/test/compile-fail/unique-vec-res.rs
src/test/compile-fail/unique-vec-res.rs
+1
-1
src/test/compile-fail/use-after-move-self-based-on-type.rs
src/test/compile-fail/use-after-move-self-based-on-type.rs
+1
-1
src/test/compile-fail/vec-res-add.rs
src/test/compile-fail/vec-res-add.rs
+1
-1
src/test/debug-info/boxed-struct.rs
src/test/debug-info/boxed-struct.rs
+1
-1
src/test/debug-info/c-style-enum-in-composite.rs
src/test/debug-info/c-style-enum-in-composite.rs
+1
-1
src/test/debug-info/packed-struct-with-destructor.rs
src/test/debug-info/packed-struct-with-destructor.rs
+5
-5
src/test/debug-info/struct-with-destructor.rs
src/test/debug-info/struct-with-destructor.rs
+2
-2
src/test/run-fail/issue-2061.rs
src/test/run-fail/issue-2061.rs
+1
-1
src/test/run-fail/morestack2.rs
src/test/run-fail/morestack2.rs
+1
-1
src/test/run-fail/morestack3.rs
src/test/run-fail/morestack3.rs
+1
-1
src/test/run-fail/morestack4.rs
src/test/run-fail/morestack4.rs
+1
-1
src/test/run-fail/rt-set-exit-status-fail2.rs
src/test/run-fail/rt-set-exit-status-fail2.rs
+1
-1
src/test/run-fail/too-much-recursion-unwinding.rs
src/test/run-fail/too-much-recursion-unwinding.rs
+1
-1
src/test/run-fail/unwind-box-res.rs
src/test/run-fail/unwind-box-res.rs
+1
-1
src/test/run-fail/unwind-resource-fail.rs
src/test/run-fail/unwind-resource-fail.rs
+1
-1
src/test/run-fail/unwind-resource-fail2.rs
src/test/run-fail/unwind-resource-fail2.rs
+1
-1
src/test/run-fail/unwind-resource-fail3.rs
src/test/run-fail/unwind-resource-fail3.rs
+1
-1
src/test/run-pass/attr-no-drop-flag-size.rs
src/test/run-pass/attr-no-drop-flag-size.rs
+1
-1
src/test/run-pass/borrowck-unary-move-2.rs
src/test/run-pass/borrowck-unary-move-2.rs
+1
-1
src/test/run-pass/class-attributes-1.rs
src/test/run-pass/class-attributes-1.rs
+1
-1
src/test/run-pass/class-attributes-2.rs
src/test/run-pass/class-attributes-2.rs
+1
-1
src/test/run-pass/class-dtor.rs
src/test/run-pass/class-dtor.rs
+1
-1
src/test/run-pass/drop-trait-generic.rs
src/test/run-pass/drop-trait-generic.rs
+1
-1
src/test/run-pass/drop-trait.rs
src/test/run-pass/drop-trait.rs
+1
-1
src/test/run-pass/init-res-into-things.rs
src/test/run-pass/init-res-into-things.rs
+1
-1
src/test/run-pass/issue-2487-a.rs
src/test/run-pass/issue-2487-a.rs
+1
-1
src/test/run-pass/issue-2708.rs
src/test/run-pass/issue-2708.rs
+1
-1
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2718.rs
+2
-2
src/test/run-pass/issue-2735-2.rs
src/test/run-pass/issue-2735-2.rs
+1
-1
src/test/run-pass/issue-2735-3.rs
src/test/run-pass/issue-2735-3.rs
+1
-1
src/test/run-pass/issue-2895.rs
src/test/run-pass/issue-2895.rs
+1
-1
src/test/run-pass/issue-3220.rs
src/test/run-pass/issue-3220.rs
+1
-1
src/test/run-pass/issue-3563-3.rs
src/test/run-pass/issue-3563-3.rs
+1
-1
src/test/run-pass/issue-4252.rs
src/test/run-pass/issue-4252.rs
+1
-1
src/test/run-pass/issue-4735.rs
src/test/run-pass/issue-4735.rs
+1
-1
src/test/run-pass/issue-6341.rs
src/test/run-pass/issue-6341.rs
+1
-1
src/test/run-pass/issue-6344-let.rs
src/test/run-pass/issue-6344-let.rs
+1
-1
src/test/run-pass/issue-6344-match.rs
src/test/run-pass/issue-6344-match.rs
+1
-1
src/test/run-pass/issue-979.rs
src/test/run-pass/issue-979.rs
+1
-1
src/test/run-pass/newtype-struct-drop-run.rs
src/test/run-pass/newtype-struct-drop-run.rs
+1
-1
src/test/run-pass/newtype-struct-with-dtor.rs
src/test/run-pass/newtype-struct-with-dtor.rs
+1
-1
src/test/run-pass/option-unwrap.rs
src/test/run-pass/option-unwrap.rs
+1
-1
src/test/run-pass/resource-assign-is-not-copy.rs
src/test/run-pass/resource-assign-is-not-copy.rs
+1
-1
src/test/run-pass/resource-cycle.rs
src/test/run-pass/resource-cycle.rs
+2
-2
src/test/run-pass/resource-cycle2.rs
src/test/run-pass/resource-cycle2.rs
+1
-1
src/test/run-pass/resource-cycle3.rs
src/test/run-pass/resource-cycle3.rs
+1
-1
src/test/run-pass/resource-destruct.rs
src/test/run-pass/resource-destruct.rs
+1
-1
src/test/run-pass/resource-in-struct.rs
src/test/run-pass/resource-in-struct.rs
+1
-1
src/test/run-pass/send-resource.rs
src/test/run-pass/send-resource.rs
+1
-1
src/test/run-pass/struct-literal-dtor.rs
src/test/run-pass/struct-literal-dtor.rs
+1
-1
src/test/run-pass/task-killjoin-rsrc.rs
src/test/run-pass/task-killjoin-rsrc.rs
+1
-1
src/test/run-pass/type-param-constraints.rs
src/test/run-pass/type-param-constraints.rs
+1
-1
src/test/run-pass/unique-pinned-nocopy-2.rs
src/test/run-pass/unique-pinned-nocopy-2.rs
+1
-1
src/test/run-pass/unit-like-struct-drop-run.rs
src/test/run-pass/unit-like-struct-drop-run.rs
+1
-1
src/test/run-pass/unwind-resource.rs
src/test/run-pass/unwind-resource.rs
+1
-1
src/test/run-pass/unwind-resource2.rs
src/test/run-pass/unwind-resource2.rs
+1
-1
src/test/run-pass/vec-slice-drop.rs
src/test/run-pass/vec-slice-drop.rs
+1
-1
未找到文件。
doc/tutorial-ffi.md
浏览文件 @
4e161a4d
...
...
@@ -321,7 +321,7 @@ impl<T: Send> Unique<T> {
#[unsafe_destructor]
impl<T: Send> Drop for Unique<T> {
fn drop(&self) {
fn drop(&
mut
self) {
#[fixed_stack_segment];
#[inline(never)];
...
...
doc/tutorial.md
浏览文件 @
4e161a4d
...
...
@@ -1898,7 +1898,7 @@ struct TimeBomb {
}
impl Drop for TimeBomb {
fn drop(&self) {
fn drop(&
mut
self) {
for _ in range(0, self.explosivity) {
println("blam!");
}
...
...
src/libextra/arc.rs
浏览文件 @
4e161a4d
...
...
@@ -313,7 +313,7 @@ struct PoisonOnFail {
}
impl
Drop
for
PoisonOnFail
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
/* assert!(!*self.failed);
-- might be false in case of cond.wait() */
...
...
src/libextra/arena.rs
浏览文件 @
4e161a4d
...
...
@@ -93,7 +93,7 @@ fn chunk(size: uint, is_pod: bool) -> Chunk {
#[unsafe_destructor]
impl
Drop
for
Arena
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
destroy_chunk
(
&
self
.head
);
do
self
.chunks.each
|
chunk
|
{
...
...
src/libextra/c_vec.rs
浏览文件 @
4e161a4d
...
...
@@ -56,7 +56,7 @@ struct DtorRes {
#[unsafe_destructor]
impl
Drop
for
DtorRes
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
match
self
.dtor
{
option
::
None
=>
(),
option
::
Some
(
f
)
=>
f
()
...
...
src/libextra/dlist.rs
浏览文件 @
4e161a4d
...
...
@@ -415,14 +415,11 @@ pub fn insert_ordered(&mut self, elt: T) {
#[unsafe_destructor]
impl
<
T
>
Drop
for
DList
<
T
>
{
fn
drop
(
&
self
)
{
let
mut_self
=
unsafe
{
cast
::
transmute_mut
(
self
)
};
fn
drop
(
&
mut
self
)
{
// Dissolve the dlist in backwards direction
// Just dropping the list_head can lead to stack exhaustion
// when length is >> 1_000_000
let
mut
tail
=
mut_
self
.list_tail
;
let
mut
tail
=
self
.list_tail
;
loop
{
match
tail
.resolve
()
{
None
=>
break
,
...
...
@@ -432,9 +429,9 @@ fn drop(&self) {
}
}
}
mut_
self
.length
=
0
;
mut_
self
.list_head
=
None
;
mut_
self
.list_tail
=
Rawlink
::
none
();
self
.length
=
0
;
self
.list_head
=
None
;
self
.list_tail
=
Rawlink
::
none
();
}
}
...
...
src/libextra/future.rs
浏览文件 @
4e161a4d
...
...
@@ -43,7 +43,7 @@ pub struct Future<A> {
// over ~fn's that have pipes and so forth within!
#[unsafe_destructor]
impl
<
A
>
Drop
for
Future
<
A
>
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
enum
FutureState
<
A
>
{
...
...
src/libextra/rc.rs
浏览文件 @
4e161a4d
...
...
@@ -73,7 +73,7 @@ pub fn borrow<'r>(&'r self) -> &'r T {
#[unsafe_destructor]
impl
<
T
>
Drop
for
Rc
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
if
self
.ptr
.is_not_null
()
{
(
*
self
.ptr
)
.count
-=
1
;
...
...
@@ -218,7 +218,7 @@ pub fn with_mut_borrow<U>(&self, f: &fn(&mut T) -> U) -> U {
#[unsafe_destructor]
impl
<
T
>
Drop
for
RcMut
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
if
self
.ptr
.is_not_null
()
{
(
*
self
.ptr
)
.count
-=
1
;
...
...
src/libextra/task_pool.rs
浏览文件 @
4e161a4d
...
...
@@ -34,7 +34,7 @@ pub struct TaskPool<T> {
#[unsafe_destructor]
impl
<
T
>
Drop
for
TaskPool
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
for
channel
in
self
.channels
.iter
()
{
channel
.send
(
Quit
);
}
...
...
src/libextra/workcache.rs
浏览文件 @
4e161a4d
...
...
@@ -201,7 +201,7 @@ fn load(&mut self) {
// FIXME #4330: use &mut self here
#[unsafe_destructor]
impl
Drop
for
Database
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
if
self
.db_dirty
{
self
.save
();
}
...
...
src/librustc/back/link.rs
浏览文件 @
4e161a4d
...
...
@@ -105,7 +105,7 @@ pub trait Engine {}
impl
Engine
for
LLVMJITData
{}
impl
Drop
for
LLVMJITData
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
llvm
::
LLVMDisposeExecutionEngine
(
self
.ee
);
llvm
::
LLVMContextDispose
(
self
.llcx
);
...
...
src/librustc/lib/llvm.rs
浏览文件 @
4e161a4d
...
...
@@ -2325,7 +2325,7 @@ pub struct target_data_res {
}
impl
Drop
for
target_data_res
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
llvm
::
LLVMDisposeTargetData
(
self
.TD
);
}
...
...
@@ -2361,7 +2361,7 @@ pub struct pass_manager_res {
}
impl
Drop
for
pass_manager_res
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
llvm
::
LLVMDisposePassManager
(
self
.PM
);
}
...
...
@@ -2397,7 +2397,7 @@ pub struct object_file_res {
}
impl
Drop
for
object_file_res
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
llvm
::
LLVMDisposeObjectFile
(
self
.ObjectFile
);
}
...
...
@@ -2434,7 +2434,7 @@ pub struct section_iter_res {
}
impl
Drop
for
section_iter_res
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
llvm
::
LLVMDisposeSectionIterator
(
self
.SI
);
}
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
4e161a4d
...
...
@@ -109,7 +109,7 @@ pub struct _InsnCtxt { _x: () }
#[unsafe_destructor]
impl
Drop
for
_
InsnCtxt
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
do
local_data
::
modify
(
task_local_insn_key
)
|
c
|
{
do
c
.map_move
|
ctx
|
{
let
mut
ctx
=
(
*
ctx
)
.clone
();
...
...
@@ -159,7 +159,7 @@ pub fn new(ccx: @mut CrateContext,
#[unsafe_destructor]
impl
<
'self
>
Drop
for
StatRecorder
<
'self
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
if
self
.ccx.sess
.trans_stats
()
{
let
end
=
time
::
precise_time_ns
();
let
elapsed
=
((
end
-
self
.start
)
/
1_000_000
)
as
uint
;
...
...
src/librustc/middle/trans/common.rs
浏览文件 @
4e161a4d
...
...
@@ -111,7 +111,7 @@ pub struct BuilderRef_res {
}
impl
Drop
for
BuilderRef_res
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
llvm
::
LLVMDisposeBuilder
(
self
.B
);
}
...
...
src/librustc/middle/trans/context.rs
浏览文件 @
4e161a4d
...
...
@@ -273,7 +273,7 @@ pub fn offsetof_gep(&self,
#[unsafe_destructor]
impl
Drop
for
CrateContext
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unset_task_llcx
();
}
}
...
...
src/librustc/rustc.rs
浏览文件 @
4e161a4d
...
...
@@ -342,7 +342,7 @@ struct finally {
}
impl
Drop
for
finally
{
fn
drop
(
&
self
)
{
self
.ch
.send
(
done
);
}
fn
drop
(
&
mut
self
)
{
self
.ch
.send
(
done
);
}
}
let
_
finally
=
finally
{
ch
:
ch
};
...
...
src/librustc/util/common.rs
浏览文件 @
4e161a4d
...
...
@@ -40,7 +40,7 @@ pub struct _indenter {
}
impl
Drop
for
_
indenter
{
fn
drop
(
&
self
)
{
debug!
(
"<<"
);
}
fn
drop
(
&
mut
self
)
{
debug!
(
"<<"
);
}
}
pub
fn
_
indenter
(
_
i
:
())
->
_
indenter
{
...
...
src/librustdoc/demo.rs
浏览文件 @
4e161a4d
...
...
@@ -127,7 +127,7 @@ struct Bored {
}
impl
Drop
for
Bored
{
fn
drop
(
&
self
)
{
}
fn
drop
(
&
mut
self
)
{
}
}
/**
...
...
src/libstd/c_str.rs
浏览文件 @
4e161a4d
...
...
@@ -127,7 +127,7 @@ pub fn iter<'a>(&'a self) -> CStringIterator<'a> {
}
impl
Drop
for
CString
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
#[fixed_stack_segment]
;
#[inline(never)]
;
if
self
.owns_buffer_
{
unsafe
{
...
...
src/libstd/condition.rs
浏览文件 @
4e161a4d
...
...
@@ -87,7 +87,7 @@ struct Guard<'self, T, U> {
#[unsafe_destructor]
impl
<
'self
,
T
,
U
>
Drop
for
Guard
<
'self
,
T
,
U
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
debug!
(
"Guard: popping handler from TLS"
);
let
curr
=
local_data
::
pop
(
self
.cond.key
);
match
curr
{
...
...
src/libstd/io.rs
浏览文件 @
4e161a4d
...
...
@@ -1021,7 +1021,7 @@ pub fn new(f: *libc::FILE) -> FILERes {
}
impl
Drop
for
FILERes
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
#[fixed_stack_segment]
;
#[inline(never)]
;
unsafe
{
...
...
@@ -1302,7 +1302,7 @@ pub fn new(fd: fd_t) -> FdRes {
}
impl
Drop
for
FdRes
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
#[fixed_stack_segment]
;
#[inline(never)]
;
unsafe
{
...
...
@@ -1832,7 +1832,7 @@ pub fn new(arg: Arg<t>) -> Res<t> {
#[unsafe_destructor]
impl
<
T
>
Drop
for
Res
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
match
self
.arg.opt_level
{
None
=>
(),
Some
(
level
)
=>
{
...
...
src/libstd/ops.rs
浏览文件 @
4e161a4d
...
...
@@ -14,7 +14,7 @@
#[lang=
"drop"
]
pub
trait
Drop
{
fn
drop
(
&
self
);
fn
drop
(
&
mut
self
);
}
#[lang=
"add"
]
...
...
@@ -95,7 +95,7 @@ struct HasDtor {
}
impl
Drop
for
HasDtor
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
}
}
...
...
@@ -105,4 +105,4 @@ fn alloc_obj_with_dtor(bh: &mut BenchHarness) {
HasDtor
{
x
:
10
};
}
}
}
\ No newline at end of file
}
src/libstd/option.rs
浏览文件 @
4e161a4d
...
...
@@ -573,7 +573,7 @@ struct R {
#[unsafe_destructor]
impl
::
ops
::
Drop
for
R
{
fn
drop
(
&
self
)
{
*
(
self
.i
)
+=
1
;
}
fn
drop
(
&
mut
self
)
{
*
(
self
.i
)
+=
1
;
}
}
fn
R
(
i
:
@
mut
int
)
->
R
{
...
...
src/libstd/os.rs
浏览文件 @
4e161a4d
...
...
@@ -1481,7 +1481,7 @@ pub fn granularity() -> uint {
#[cfg(unix)]
impl
Drop
for
MemoryMap
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
#[fixed_stack_segment]
;
#[inline(never)]
;
unsafe
{
...
...
@@ -1607,7 +1607,7 @@ pub fn granularity() -> uint {
#[cfg(windows)]
impl
Drop
for
MemoryMap
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
#[fixed_stack_segment]
;
#[inline(never)]
;
use
libc
::
types
::
os
::
arch
::
extra
::{
LPCVOID
,
HANDLE
};
...
...
src/libstd/rt/comm.rs
浏览文件 @
4e161a4d
...
...
@@ -363,7 +363,7 @@ fn peek(&self) -> bool {
#[unsafe_destructor]
impl
<
T
>
Drop
for
ChanOne
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
if
self
.suppress_finalize
{
return
}
unsafe
{
...
...
@@ -391,7 +391,7 @@ fn drop(&self) {
#[unsafe_destructor]
impl
<
T
>
Drop
for
PortOne
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
if
self
.suppress_finalize
{
return
}
unsafe
{
...
...
src/libstd/rt/kill.rs
浏览文件 @
4e161a4d
...
...
@@ -235,7 +235,7 @@ pub struct Death {
impl
Drop
for
KillFlag
{
// Letting a KillFlag with a task inside get dropped would leak the task.
// We could free it here, but the task should get awoken by hand somehow.
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
match
self
.load
(
Relaxed
)
{
KILL_RUNNING
|
KILL_KILLED
=>
{
},
_
=>
rtabort!
(
"can't drop kill flag with a blocked task inside!"
),
...
...
@@ -685,7 +685,7 @@ pub fn assert_may_sleep(&self) {
}
impl
Drop
for
Death
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
// Mustn't be in an atomic or unkillable section at task death.
rtassert!
(
self
.unkillable
==
0
);
rtassert!
(
self
.wont_sleep
==
0
);
...
...
src/libstd/rt/local_heap.rs
浏览文件 @
4e161a4d
...
...
@@ -78,7 +78,7 @@ pub fn free(&mut self, box: *OpaqueBox) {
impl
Drop
for
LocalHeap
{
#[fixed_stack_segment]
#[inline(never)]
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
rust_delete_boxed_region
(
self
.boxed_region
);
rust_delete_memory_region
(
self
.memory_region
);
...
...
src/libstd/rt/rc.rs
浏览文件 @
4e161a4d
...
...
@@ -74,7 +74,7 @@ pub fn refcount(&self) -> uint {
#[unsafe_destructor]
impl
<
T
>
Drop
for
RC
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
assert
!
(
self
.refcount
()
>
0
);
unsafe
{
...
...
src/libstd/rt/sched.rs
浏览文件 @
4e161a4d
...
...
@@ -1200,15 +1200,15 @@ fn start_closure_dtor() {
struct
S
{
field
:
()
}
impl
Drop
for
S
{
fn
drop
(
&
self
)
{
let
_
foo
=
@
0
;
fn
drop
(
&
mut
self
)
{
let
_
foo
=
@
0
;
}
}
let
s
=
S
{
field
:
()
};
do
spawntask
{
let
_
ss
=
&
s
;
let
_
ss
=
&
s
;
}
}
}
...
...
src/libstd/rt/stack.rs
浏览文件 @
4e161a4d
...
...
@@ -53,7 +53,7 @@ pub fn end(&self) -> *uint {
}
impl
Drop
for
StackSegment
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
#[fixed_stack_segment]
;
#[inline(never)]
;
unsafe
{
...
...
src/libstd/rt/task.rs
浏览文件 @
4e161a4d
...
...
@@ -328,7 +328,7 @@ pub fn on_appropriate_sched() -> bool {
}
impl
Drop
for
Task
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
rtdebug!
(
"called drop for a task: %u"
,
borrow
::
to_uint
(
self
));
rtassert!
(
self
.destroyed
)
}
...
...
src/libstd/rt/thread.rs
浏览文件 @
4e161a4d
...
...
@@ -46,7 +46,7 @@ pub fn join(self) {
}
impl
Drop
for
Thread
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
#[fixed_stack_segment]
;
#[inline(never)]
;
assert
!
(
self
.joined
);
...
...
src/libstd/rt/uv/uvio.rs
浏览文件 @
4e161a4d
...
...
@@ -187,7 +187,7 @@ pub fn new() -> UvEventLoop {
}
impl
Drop
for
UvEventLoop
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
// XXX: Need mutable finalizer
let
this
=
unsafe
{
transmute
::
<&
UvEventLoop
,
&
mut
UvEventLoop
>
(
self
)
...
...
@@ -351,7 +351,7 @@ fn fire(&mut self) { self.async.send() }
}
impl
Drop
for
UvRemoteCallback
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
let
this
:
&
mut
UvRemoteCallback
=
cast
::
transmute_mut
(
self
);
do
this
.exit_flag.with
|
should_exit
|
{
...
...
@@ -647,7 +647,7 @@ fn new(watcher: TcpWatcher, home: SchedHandle) -> UvTcpListener {
}
impl
Drop
for
UvTcpListener
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
// XXX need mutable finalizer
let
self_
=
unsafe
{
transmute
::
<&
UvTcpListener
,
&
mut
UvTcpListener
>
(
self
)
};
do
self_
.home_for_io_with_sched
|
self_
,
scheduler
|
{
...
...
@@ -762,7 +762,7 @@ fn home<'r>(&'r mut self) -> &'r mut SchedHandle { &mut self.home }
}
impl
Drop
for
UvTcpStream
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
// XXX need mutable finalizer
let
this
=
unsafe
{
transmute
::
<&
UvTcpStream
,
&
mut
UvTcpStream
>
(
self
)
};
do
this
.home_for_io_with_sched
|
self_
,
scheduler
|
{
...
...
@@ -921,7 +921,7 @@ fn home<'r>(&'r mut self) -> &'r mut SchedHandle { &mut self.home }
}
impl
Drop
for
UvUdpSocket
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
// XXX need mutable finalizer
let
this
=
unsafe
{
transmute
::
<&
UvUdpSocket
,
&
mut
UvUdpSocket
>
(
self
)
};
do
this
.home_for_io_with_sched
|
self_
,
scheduler
|
{
...
...
@@ -1139,7 +1139,7 @@ fn new(w: timer::TimerWatcher, home: SchedHandle) -> UvTimer {
}
impl
Drop
for
UvTimer
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
let
self_
=
unsafe
{
transmute
::
<&
UvTimer
,
&
mut
UvTimer
>
(
self
)
};
do
self_
.home_for_io_with_sched
|
self_
,
scheduler
|
{
rtdebug!
(
"closing UvTimer"
);
...
...
@@ -1253,7 +1253,7 @@ fn seek_common(&mut self, pos: i64, whence: c_int) ->
}
impl
Drop
for
UvFileStream
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
let
self_
=
unsafe
{
transmute
::
<&
UvFileStream
,
&
mut
UvFileStream
>
(
self
)
};
if
self
.close_on_drop
{
do
self_
.home_for_io_with_sched
|
self_
,
scheduler
|
{
...
...
src/libstd/run.rs
浏览文件 @
4e161a4d
...
...
@@ -436,12 +436,9 @@ fn killpid(pid: pid_t, force: bool) {
}
impl
Drop
for
Process
{
fn
drop
(
&
self
)
{
// FIXME(#4330) Need self by value to get mutability.
let
mut_self
:
&
mut
Process
=
unsafe
{
cast
::
transmute
(
self
)
};
mut_self
.finish
();
mut_self
.close_outputs
();
fn
drop
(
&
mut
self
)
{
self
.finish
();
self
.close_outputs
();
free_handle
(
self
.handle
);
}
}
...
...
src/libstd/task/spawn.rs
浏览文件 @
4e161a4d
...
...
@@ -319,40 +319,35 @@ pub struct Taskgroup {
impl
Drop
for
Taskgroup
{
// Runs on task exit.
fn
drop
(
&
self
)
{
unsafe
{
// FIXME(#4330) Need self by value to get mutability.
let
this
:
&
mut
Taskgroup
=
transmute
(
self
);
// If we are failing, the whole taskgroup needs to die.
do
RuntimeGlue
::
with_task_handle_and_failing
|
me
,
failing
|
{
if
failing
{
for
x
in
this
.notifier
.mut_iter
()
{
x
.failed
=
true
;
}
// Take everybody down with us. After this point, every
// other task in the group will see 'tg' as none, which
// indicates the whole taskgroup is failing (and forbids
// new spawns from succeeding).
let
tg
=
do
access_group
(
&
self
.tasks
)
|
tg
|
{
tg
.take
()
};
// It's safe to send kill signals outside the lock, because
// we have a refcount on all kill-handles in the group.
kill_taskgroup
(
tg
,
me
);
}
else
{
// Remove ourselves from the group(s).
do
access_group
(
&
self
.tasks
)
|
tg
|
{
leave_taskgroup
(
tg
,
me
,
true
);
}
fn
drop
(
&
mut
self
)
{
// If we are failing, the whole taskgroup needs to die.
do
RuntimeGlue
::
with_task_handle_and_failing
|
me
,
failing
|
{
if
failing
{
for
x
in
self
.notifier
.mut_iter
()
{
x
.failed
=
true
;
}
// Take everybody down with us. After this point, every
// other task in the group will see 'tg' as none, which
// indicates the whole taskgroup is failing (and forbids
// new spawns from succeeding).
let
tg
=
do
access_group
(
&
self
.tasks
)
|
tg
|
{
tg
.take
()
};
// It's safe to send kill signals outside the lock, because
// we have a refcount on all kill-handles in the group.
kill_taskgroup
(
tg
,
me
);
}
else
{
// Remove ourselves from the group(s).
do
access_group
(
&
self
.tasks
)
|
tg
|
{
leave_taskgroup
(
tg
,
me
,
true
);
}
// It doesn't matter whether this happens before or after dealing
// with our own taskgroup, so long as both happen before we die.
// We remove ourself from every ancestor we can, so no cleanup; no
// break.
do
each_ancestor
(
&
mut
this
.ancestors
,
|
_
|
{})
|
ancestor_group
|
{
leave_taskgroup
(
ancestor_group
,
me
,
false
);
true
};
}
// It doesn't matter whether this happens before or after dealing
// with our own taskgroup, so long as both happen before we die.
// We remove ourself from every ancestor we can, so no cleanup; no
// break.
do
each_ancestor
(
&
mut
self
.ancestors
,
|
_
|
{})
|
ancestor_group
|
{
leave_taskgroup
(
ancestor_group
,
me
,
false
);
true
};
}
}
}
...
...
@@ -377,7 +372,7 @@ struct AutoNotify {
}
impl
Drop
for
AutoNotify
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
let
result
=
if
self
.failed
{
Failure
}
else
{
Success
};
self
.notify_chan
.send
(
result
);
}
...
...
src/libstd/unstable/atomics.rs
浏览文件 @
4e161a4d
...
...
@@ -338,7 +338,7 @@ pub fn is_empty(&mut self, order: Ordering) -> bool {
#[unsafe_destructor]
impl
<
T
>
Drop
for
AtomicOption
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
// This will ensure that the contained data is
// destroyed, unless it's null.
unsafe
{
...
...
src/libstd/unstable/dynamic_lib.rs
浏览文件 @
4e161a4d
...
...
@@ -26,7 +26,7 @@
pub
struct
DynamicLibrary
{
priv
handle
:
*
libc
::
c_void
}
impl
Drop
for
DynamicLibrary
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
match
do
dl
::
check_for_errors_in
{
unsafe
{
dl
::
close
(
self
.handle
)
...
...
src/libstd/unstable/finally.rs
浏览文件 @
4e161a4d
...
...
@@ -64,7 +64,7 @@ struct Finallyalizer<'self> {
#[unsafe_destructor]
impl
<
'self
>
Drop
for
Finallyalizer
<
'self
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
(
self
.dtor
)();
}
}
...
...
src/libstd/unstable/sync.rs
浏览文件 @
4e161a4d
...
...
@@ -220,7 +220,7 @@ fn clone(&self) -> UnsafeArc<T> {
#[unsafe_destructor]
impl
<
T
>
Drop
for
UnsafeArc
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
// Happens when destructing an unwrapper's handle and from `#[unsafe_no_drop_flag]`
if
self
.data
.is_null
()
{
...
...
@@ -308,7 +308,7 @@ pub struct LittleLock {
}
impl
Drop
for
LittleLock
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
rust_destroy_little_lock
(
self
.l
);
}
...
...
src/libstd/util.rs
浏览文件 @
4e161a4d
...
...
@@ -88,7 +88,7 @@ pub fn new() -> NonCopyable { NonCopyable }
}
impl
Drop
for
NonCopyable
{
fn
drop
(
&
self
)
{
}
fn
drop
(
&
mut
self
)
{
}
}
/// A type with no inhabitants
...
...
@@ -188,7 +188,7 @@ fn test_noncopyable() {
struct
Foo
{
five
:
int
}
impl
Drop
for
Foo
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
assert_eq!
(
self
.five
,
5
);
unsafe
{
did_run
=
true
;
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
4e161a4d
...
...
@@ -341,7 +341,7 @@ pub struct Parser {
#[unsafe_destructor]
impl
Drop
for
Parser
{
/* do not copy the parser; its state is tied to outside state */
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
is_plain_ident_or_underscore
(
t
:
&
token
::
Token
)
->
bool
{
...
...
src/test/auxiliary/issue-2526.rs
浏览文件 @
4e161a4d
...
...
@@ -21,7 +21,7 @@ struct arc_destruct<T> {
#[unsafe_destructor]
impl
<
T
:
Freeze
>
Drop
for
arc_destruct
<
T
>
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
arc_destruct
<
T
:
Freeze
>
(
data
:
int
)
->
arc_destruct
<
T
>
{
...
...
@@ -43,7 +43,7 @@ struct context_res {
}
impl
Drop
for
context_res
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
context_res
()
->
context_res
{
...
...
src/test/auxiliary/issue-3012-1.rs
浏览文件 @
4e161a4d
...
...
@@ -19,7 +19,7 @@ pub struct socket_handle {
}
impl
Drop
for
socket_handle
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
/* c::close(self.sockfd); */
}
}
...
...
src/test/auxiliary/issue2170lib.rs
浏览文件 @
4e161a4d
...
...
@@ -16,7 +16,7 @@ pub struct rsrc {
}
impl
Drop
for
rsrc
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
foo
(
self
.x
);
}
}
...
...
src/test/auxiliary/moves_based_on_type_lib.rs
浏览文件 @
4e161a4d
...
...
@@ -15,7 +15,7 @@ pub struct S {
}
impl
Drop
for
S
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
println
(
"goodbye"
);
}
}
...
...
src/test/bench/task-perf-alloc-unwind.rs
浏览文件 @
4e161a4d
...
...
@@ -58,7 +58,7 @@ struct r {
#[unsafe_destructor]
impl
Drop
for
r
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
r
(
l
:
@
nillist
)
->
r
{
...
...
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs
浏览文件 @
4e161a4d
...
...
@@ -11,7 +11,7 @@
struct
X
{
x
:
()
}
impl
Drop
for
X
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"destructor runs"
);
}
}
...
...
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs
浏览文件 @
4e161a4d
...
...
@@ -11,7 +11,7 @@
struct
X
{
x
:
(),
}
impl
Drop
for
X
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"destructor runs"
);
}
}
...
...
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs
浏览文件 @
4e161a4d
...
...
@@ -11,7 +11,7 @@
struct
X
{
x
:
(),
}
impl
Drop
for
X
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"destructor runs"
);
}
}
...
...
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs
浏览文件 @
4e161a4d
...
...
@@ -11,7 +11,7 @@
struct
X
{
x
:
(),
}
impl
Drop
for
X
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"destructor runs"
);
}
}
...
...
src/test/compile-fail/bind-by-move-no-sub-bindings.rs
浏览文件 @
4e161a4d
...
...
@@ -11,7 +11,7 @@
struct
X
{
x
:
(),
}
impl
Drop
for
X
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"destructor runs"
);
}
}
...
...
src/test/compile-fail/block-must-not-have-result-res.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@
struct
r
;
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
true
}
}
...
...
src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
浏览文件 @
4e161a4d
...
...
@@ -14,7 +14,7 @@ struct defer<'self> {
#[unsafe_destructor]
impl
<
'self
>
Drop
for
defer
<
'self
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
error!
(
"%?"
,
self
.x
);
}
...
...
src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs
浏览文件 @
4e161a4d
struct
S
{
f
:
~
str
}
impl
Drop
for
S
{
fn
drop
(
&
self
)
{
println
(
self
.f
);
}
fn
drop
(
&
mut
self
)
{
println
(
self
.f
);
}
}
fn
move_in_match
()
{
...
...
src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs
浏览文件 @
4e161a4d
struct
S
(
~
str
);
impl
Drop
for
S
{
fn
drop
(
&
self
)
{
println
(
**
self
);
}
fn
drop
(
&
mut
self
)
{
println
(
**
self
);
}
}
fn
move_in_match
()
{
...
...
src/test/compile-fail/copy-a-resource.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct foo {
}
impl
Drop
for
foo
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
foo
(
i
:
int
)
->
foo
{
...
...
src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct X {
}
impl
Drop
for
X
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"value: %s"
,
self
.x
);
}
}
...
...
src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct X {
}
impl
Drop
for
X
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"value: %s"
,
self
.x
);
}
}
...
...
src/test/compile-fail/drop-on-non-struct.rs
浏览文件 @
4e161a4d
...
...
@@ -12,7 +12,7 @@
impl
Drop
for
Foo
{
//~ ERROR the Drop trait may only be implemented
//~^ ERROR cannot provide an extension implementation
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
println
(
"kaboom"
);
}
}
...
...
src/test/compile-fail/explicit-call-to-dtor.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct Foo {
}
impl
Drop
for
Foo
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
println
(
"kaboom"
);
}
}
...
...
src/test/compile-fail/explicit-call-to-supertrait-dtor.rs
浏览文件 @
4e161a4d
...
...
@@ -17,7 +17,7 @@ trait Bar : Drop {
}
impl
Drop
for
Foo
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
println
(
"kaboom"
);
}
}
...
...
src/test/compile-fail/functional-struct-update-noncopyable.rs
浏览文件 @
4e161a4d
...
...
@@ -17,7 +17,7 @@
struct
A
{
y
:
Arc
<
int
>
,
x
:
Arc
<
int
>
}
impl
Drop
for
A
{
fn
drop
(
&
self
)
{
println
(
fmt!
(
"x=%?"
,
self
.x
.get
()));
}
fn
drop
(
&
mut
self
)
{
println
(
fmt!
(
"x=%?"
,
self
.x
.get
()));
}
}
fn
main
()
{
let
a
=
A
{
y
:
Arc
::
new
(
1
),
x
:
Arc
::
new
(
2
)
};
...
...
src/test/compile-fail/issue-2548.rs
浏览文件 @
4e161a4d
...
...
@@ -18,7 +18,7 @@ struct foo {
#[unsafe_destructor]
impl
Drop
for
foo
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
println
(
"Goodbye, World!"
);
*
self
.x
+=
1
;
...
...
src/test/compile-fail/issue-2823.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct C {
}
impl
Drop
for
C
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"dropping: %?"
,
self
.x
);
}
}
...
...
src/test/compile-fail/issue-3214.rs
浏览文件 @
4e161a4d
...
...
@@ -15,7 +15,7 @@ struct foo {
}
impl
<
T
>
Drop
for
foo
<
T
>
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
}
fn
main
()
{
}
src/test/compile-fail/kindck-destructor-owned.rs
浏览文件 @
4e161a4d
...
...
@@ -3,7 +3,7 @@ struct Foo {
}
impl
Drop
for
Foo
{
//~ ERROR cannot implement a destructor on a structure that does not satisfy Send
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
*
self
.f
=
10
;
}
}
...
...
src/test/compile-fail/no-send-res-ports.rs
浏览文件 @
4e161a4d
...
...
@@ -20,7 +20,7 @@ struct foo {
#[unsafe_destructor]
impl
Drop
for
foo
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
foo
(
x
:
Port
<
()
>
)
->
foo
{
...
...
src/test/compile-fail/noncopyable-class.rs
浏览文件 @
4e161a4d
...
...
@@ -15,7 +15,7 @@ struct bar {
}
impl
Drop
for
bar
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
bar
(
x
:
int
)
->
bar
{
...
...
src/test/compile-fail/pinned-deep-copy.rs
浏览文件 @
4e161a4d
...
...
@@ -14,7 +14,7 @@ struct r {
#[unsafe_destructor]
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
*
(
self
.i
)
=
*
(
self
.i
)
+
1
;
}
...
...
src/test/compile-fail/repeat-to-run-dtor-twice.rs
浏览文件 @
4e161a4d
...
...
@@ -17,7 +17,7 @@ struct Foo {
}
impl
Drop
for
Foo
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
println
(
"Goodbye!"
);
}
}
...
...
src/test/compile-fail/unique-object-noncopyable.rs
浏览文件 @
4e161a4d
...
...
@@ -17,7 +17,7 @@ struct Bar {
}
impl
Drop
for
Bar
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
impl
Foo
for
Bar
{
...
...
src/test/compile-fail/unique-pinned-nocopy.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct r {
}
impl
Drop
for
r
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
main
()
{
...
...
src/test/compile-fail/unique-vec-res.rs
浏览文件 @
4e161a4d
...
...
@@ -14,7 +14,7 @@ struct r {
#[unsafe_destructor]
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
*
(
self
.i
)
=
*
(
self
.i
)
+
1
;
}
...
...
src/test/compile-fail/use-after-move-self-based-on-type.rs
浏览文件 @
4e161a4d
...
...
@@ -3,7 +3,7 @@ struct S {
}
impl
Drop
for
S
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
impl
S
{
...
...
src/test/compile-fail/vec-res-add.rs
浏览文件 @
4e161a4d
...
...
@@ -17,7 +17,7 @@ struct r {
fn
r
(
i
:
int
)
->
r
{
r
{
i
:
i
}
}
impl
Drop
for
r
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
main
()
{
...
...
src/test/debug-info/boxed-struct.rs
浏览文件 @
4e161a4d
...
...
@@ -42,7 +42,7 @@ struct StructWithDestructor {
}
impl
Drop
for
StructWithDestructor
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
main
()
{
...
...
src/test/debug-info/c-style-enum-in-composite.rs
浏览文件 @
4e161a4d
...
...
@@ -78,7 +78,7 @@ struct StructWithDrop {
}
impl
Drop
for
StructWithDrop
{
fn
drop
(
&
self
)
{()}
fn
drop
(
&
mut
self
)
{()}
}
fn
main
()
{
...
...
src/test/debug-info/packed-struct-with-destructor.rs
浏览文件 @
4e161a4d
...
...
@@ -49,7 +49,7 @@ struct Packed {
}
impl
Drop
for
Packed
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
#[packed]
...
...
@@ -74,7 +74,7 @@ struct Unpacked {
}
impl
Drop
for
Unpacked
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
#[packed]
...
...
@@ -94,7 +94,7 @@ struct PackedInPackedWithDrop {
}
impl
Drop
for
PackedInPackedWithDrop
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
struct
PackedInUnpackedWithDrop
{
...
...
@@ -105,7 +105,7 @@ struct PackedInUnpackedWithDrop {
}
impl
Drop
for
PackedInUnpackedWithDrop
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
#[packed]
...
...
@@ -117,7 +117,7 @@ struct UnpackedInPackedWithDrop {
}
impl
Drop
for
UnpackedInPackedWithDrop
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
struct
DeeplyNested
{
...
...
src/test/debug-info/struct-with-destructor.rs
浏览文件 @
4e161a4d
...
...
@@ -37,7 +37,7 @@ struct WithDestructor {
}
impl
Drop
for
WithDestructor
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
struct
NoDestructorGuarded
{
...
...
@@ -55,7 +55,7 @@ struct NestedInner {
}
impl
Drop
for
NestedInner
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
struct
NestedOuter
{
...
...
src/test/run-fail/issue-2061.rs
浏览文件 @
4e161a4d
...
...
@@ -15,7 +15,7 @@ struct R {
}
impl
Drop
for
R
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
let
_
y
=
R
{
b
:
self
.b
};
}
}
...
...
src/test/run-fail/morestack2.rs
浏览文件 @
4e161a4d
...
...
@@ -45,7 +45,7 @@ struct and_then_get_big_again {
}
impl
Drop
for
and_then_get_big_again
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
fn
getbig
(
i
:
int
)
{
if
i
!=
0
{
getbig
(
i
-
1
);
...
...
src/test/run-fail/morestack3.rs
浏览文件 @
4e161a4d
...
...
@@ -31,7 +31,7 @@ struct and_then_get_big_again {
}
impl
Drop
for
and_then_get_big_again
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
fn
getbig
(
i
:
int
)
{
if
i
!=
0
{
getbig
(
i
-
1
);
...
...
src/test/run-fail/morestack4.rs
浏览文件 @
4e161a4d
...
...
@@ -31,7 +31,7 @@ struct and_then_get_big_again {
}
impl
Drop
for
and_then_get_big_again
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
and_then_get_big_again
(
x
:
int
)
->
and_then_get_big_again
{
...
...
src/test/run-fail/rt-set-exit-status-fail2.rs
浏览文件 @
4e161a4d
...
...
@@ -21,7 +21,7 @@ struct r {
// failed has no effect and the process exits with the
// runtime's exit code
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
os
::
set_exit_status
(
50
);
}
}
...
...
src/test/run-fail/too-much-recursion-unwinding.rs
浏览文件 @
4e161a4d
...
...
@@ -24,7 +24,7 @@ struct r {
}
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
if
!*
(
self
.recursed
)
{
*
(
self
.recursed
)
=
true
;
...
...
src/test/run-fail/unwind-box-res.rs
浏览文件 @
4e161a4d
...
...
@@ -21,7 +21,7 @@ struct r {
}
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
let
_
v2
:
~
int
=
cast
::
transmute
(
self
.v
);
}
...
...
src/test/run-fail/unwind-resource-fail.rs
浏览文件 @
4e161a4d
...
...
@@ -15,7 +15,7 @@ struct r {
}
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fail
!
(
"squirrel"
)
}
fn
drop
(
&
mut
self
)
{
fail
!
(
"squirrel"
)
}
}
fn
r
(
i
:
int
)
->
r
{
r
{
i
:
i
}
}
...
...
src/test/run-fail/unwind-resource-fail2.rs
浏览文件 @
4e161a4d
...
...
@@ -16,7 +16,7 @@ struct r {
}
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fail
!
(
"wombat"
)
}
fn
drop
(
&
mut
self
)
{
fail
!
(
"wombat"
)
}
}
fn
r
(
i
:
int
)
->
r
{
r
{
i
:
i
}
}
...
...
src/test/run-fail/unwind-resource-fail3.rs
浏览文件 @
4e161a4d
...
...
@@ -19,7 +19,7 @@ fn faily_box(i: @int) -> faily_box { faily_box { i: i } }
#[unsafe_destructor]
impl
Drop
for
faily_box
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
fail
!
(
"quux"
);
}
}
...
...
src/test/run-pass/attr-no-drop-flag-size.rs
浏览文件 @
4e161a4d
...
...
@@ -17,7 +17,7 @@ struct Test<T> {
#[unsafe_destructor]
impl
<
T
>
Drop
for
Test
<
T
>
{
fn
drop
(
&
self
)
{
}
fn
drop
(
&
mut
self
)
{
}
}
fn
main
()
{
...
...
src/test/run-pass/borrowck-unary-move-2.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct noncopyable {
}
impl
Drop
for
noncopyable
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"dropped"
);
}
}
...
...
src/test/run-pass/class-attributes-1.rs
浏览文件 @
4e161a4d
...
...
@@ -16,7 +16,7 @@ struct cat {
impl
Drop
for
cat
{
#[cat_dropper]
fn
drop
(
&
self
)
{
error!
(
"%s landed on hir feet"
,
self
. name
);
}
fn
drop
(
&
mut
self
)
{
error!
(
"%s landed on hir feet"
,
self
. name
);
}
}
...
...
src/test/run-pass/class-attributes-2.rs
浏览文件 @
4e161a4d
...
...
@@ -17,7 +17,7 @@ impl Drop for cat {
/**
Actually, cats don't always land on their feet when you drop them.
*/
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
error!
(
"%s landed on hir feet"
,
self
.name
);
}
}
...
...
src/test/run-pass/class-dtor.rs
浏览文件 @
4e161a4d
...
...
@@ -14,7 +14,7 @@ struct cat {
}
impl
Drop
for
cat
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
(
self
.done
)(
self
.meows
);
}
}
...
...
src/test/run-pass/drop-trait-generic.rs
浏览文件 @
4e161a4d
...
...
@@ -14,7 +14,7 @@ struct S<T> {
#[unsafe_destructor]
impl
<
T
>
::
std
::
ops
::
Drop
for
S
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
println
(
"bye"
);
}
}
...
...
src/test/run-pass/drop-trait.rs
浏览文件 @
4e161a4d
...
...
@@ -13,7 +13,7 @@ struct Foo {
}
impl
Drop
for
Foo
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
println
(
"bye"
);
}
}
...
...
src/test/run-pass/init-res-into-things.rs
浏览文件 @
4e161a4d
...
...
@@ -19,7 +19,7 @@ struct Box { x: r }
#[unsafe_destructor]
impl
Drop
for
r
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
*
(
self
.i
)
=
*
(
self
.i
)
+
1
;
}
}
...
...
src/test/run-pass/issue-2487-a.rs
浏览文件 @
4e161a4d
...
...
@@ -14,7 +14,7 @@ struct socket {
}
impl
Drop
for
socket
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
impl
socket
{
...
...
src/test/run-pass/issue-2708.rs
浏览文件 @
4e161a4d
...
...
@@ -16,7 +16,7 @@ struct Font {
}
impl
Drop
for
Font
{
fn
drop
(
&
self
)
{}
fn
drop
(
&
mut
self
)
{}
}
fn
Font
()
->
Font
{
...
...
src/test/run-pass/issue-2718.rs
浏览文件 @
4e161a4d
...
...
@@ -161,7 +161,7 @@ pub struct send_packet<T> {
#[unsafe_destructor]
impl
<
T
:
Send
>
Drop
for
send_packet
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
if
self
.p
!=
None
{
let
self_p
:
&
mut
Option
<*
packet
<
T
>>
=
...
...
@@ -191,7 +191,7 @@ pub struct recv_packet<T> {
#[unsafe_destructor]
impl
<
T
:
Send
>
Drop
for
recv_packet
<
T
>
{
fn
drop
(
&
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
if
self
.p
!=
None
{
let
self_p
:
&
mut
Option
<*
packet
<
T
>>
=
...
...
src/test/run-pass/issue-2735-2.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-2735-3.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-2895.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-3220.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-3563-3.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-4252.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-4735.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-6341.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-6344-let.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-6344-match.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/issue-979.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/newtype-struct-drop-run.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/newtype-struct-with-dtor.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/option-unwrap.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/resource-assign-is-not-copy.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/resource-cycle.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/resource-cycle2.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/resource-cycle3.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/resource-destruct.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/resource-in-struct.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/send-resource.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/struct-literal-dtor.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/task-killjoin-rsrc.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/type-param-constraints.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/unique-pinned-nocopy-2.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/unit-like-struct-drop-run.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/unwind-resource.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/unwind-resource2.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
src/test/run-pass/vec-slice-drop.rs
浏览文件 @
4e161a4d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录