Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
852619d5
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,发现更多精彩内容 >>
提交
852619d5
编写于
3月 10, 2013
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove `++` mode from the compiler (it is parsed as `+` mode)
and obsolete `-` mode altogether (it *was* parsed as `+` mode).
上级
efc7f82b
变更
57
隐藏空白更改
内联
并排
Showing
57 changed file
with
89 addition
and
144 deletion
+89
-144
src/libcore/cast.rs
src/libcore/cast.rs
+1
-1
src/libcore/unstable/intrinsics.rs
src/libcore/unstable/intrinsics.rs
+2
-2
src/librustc/back/link.rs
src/librustc/back/link.rs
+2
-2
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+2
-2
src/librustc/metadata/creader.rs
src/librustc/metadata/creader.rs
+1
-1
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+1
-1
src/librustc/metadata/loader.rs
src/librustc/metadata/loader.rs
+1
-1
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tydecode.rs
+0
-1
src/librustc/metadata/tyencode.rs
src/librustc/metadata/tyencode.rs
+0
-1
src/librustc/middle/astencode.rs
src/librustc/middle/astencode.rs
+1
-1
src/librustc/middle/borrowck/gather_loans.rs
src/librustc/middle/borrowck/gather_loans.rs
+2
-2
src/librustc/middle/lint.rs
src/librustc/middle/lint.rs
+1
-1
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+2
-2
src/librustc/middle/mem_categorization.rs
src/librustc/middle/mem_categorization.rs
+0
-8
src/librustc/middle/moves.rs
src/librustc/middle/moves.rs
+1
-1
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+5
-5
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/_match.rs
+1
-1
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+1
-7
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/callee.rs
+0
-8
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/common.rs
+5
-5
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/trans/controlflow.rs
+1
-1
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/meth.rs
+1
-1
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/reflect.rs
+0
-1
src/librustc/middle/trans/type_of.rs
src/librustc/middle/trans/type_of.rs
+0
-1
src/librustc/middle/trans/type_use.rs
src/librustc/middle/trans/type_use.rs
+3
-3
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+1
-1
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+2
-2
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/mod.rs
+0
-20
src/libstd/arena.rs
src/libstd/arena.rs
+1
-1
src/libstd/priority_queue.rs
src/libstd/priority_queue.rs
+1
-1
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+1
-1
src/libsyntax/ast_map.rs
src/libsyntax/ast_map.rs
+3
-3
src/libsyntax/attr.rs
src/libsyntax/attr.rs
+3
-3
src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/obsolete.rs
+5
-0
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+7
-3
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+0
-1
src/test/auxiliary/cci_class_6.rs
src/test/auxiliary/cci_class_6.rs
+1
-1
src/test/bench/graph500-bfs.rs
src/test/bench/graph500-bfs.rs
+1
-1
src/test/bench/task-perf-jargon-metal-smoke.rs
src/test/bench/task-perf-jargon-metal-smoke.rs
+1
-1
src/test/compile-fail/liveness-move-from-args.rs
src/test/compile-fail/liveness-move-from-args.rs
+0
-4
src/test/compile-fail/liveness-use-after-send.rs
src/test/compile-fail/liveness-use-after-send.rs
+1
-1
src/test/compile-fail/mutable-arguments.rs
src/test/compile-fail/mutable-arguments.rs
+1
-6
src/test/run-fail/unwind-move.rs
src/test/run-fail/unwind-move.rs
+1
-1
src/test/run-pass/argument-passing.rs
src/test/run-pass/argument-passing.rs
+1
-1
src/test/run-pass/borrowck-lend-args.rs
src/test/run-pass/borrowck-lend-args.rs
+0
-8
src/test/run-pass/class-poly-methods.rs
src/test/run-pass/class-poly-methods.rs
+1
-1
src/test/run-pass/intrinsic-move-val.rs
src/test/run-pass/intrinsic-move-val.rs
+2
-2
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2718.rs
+9
-9
src/test/run-pass/liveness-move-in-loop.rs
src/test/run-pass/liveness-move-in-loop.rs
+1
-1
src/test/run-pass/move-arg-2-unique.rs
src/test/run-pass/move-arg-2-unique.rs
+1
-1
src/test/run-pass/move-arg-2.rs
src/test/run-pass/move-arg-2.rs
+1
-1
src/test/run-pass/move-arg.rs
src/test/run-pass/move-arg.rs
+1
-1
src/test/run-pass/move-nullary-fn.rs
src/test/run-pass/move-nullary-fn.rs
+2
-2
src/test/run-pass/pipe-bank-proto.rs
src/test/run-pass/pipe-bank-proto.rs
+1
-1
src/test/run-pass/pipe-pingpong-bounded.rs
src/test/run-pass/pipe-pingpong-bounded.rs
+2
-2
src/test/run-pass/pipe-pingpong-proto.rs
src/test/run-pass/pipe-pingpong-proto.rs
+2
-2
src/test/run-pass/unique-fn-arg-move.rs
src/test/run-pass/unique-fn-arg-move.rs
+1
-1
未找到文件。
src/libcore/cast.rs
浏览文件 @
852619d5
...
...
@@ -12,7 +12,7 @@ pub mod rusti {
#[abi
=
"rust-intrinsic"
]
#[link_name
=
"rusti"
]
pub
extern
{
fn
forget
<
T
>
(
-
x
:
T
);
fn
forget
<
T
>
(
+
x
:
T
);
fn
reinterpret_cast
<
T
,
U
>
(
&&
e
:
T
)
->
U
;
}
}
...
...
src/libcore/unstable/intrinsics.rs
浏览文件 @
852619d5
...
...
@@ -34,8 +34,8 @@
pub
fn
size_of
<
T
>
()
->
uint
;
pub
fn
move_val
<
T
>
(
dst
:
&
mut
T
,
-
src
:
T
);
pub
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
-
src
:
T
);
pub
fn
move_val
<
T
>
(
dst
:
&
mut
T
,
+
src
:
T
);
pub
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
+
src
:
T
);
pub
fn
min_align_of
<
T
>
()
->
uint
;
pub
fn
pref_align_of
<
T
>
()
->
uint
;
...
...
src/librustc/back/link.rs
浏览文件 @
852619d5
...
...
@@ -486,7 +486,7 @@ fn provided_link_metas(sess: Session, c: &ast::crate) ->
// This calculates CMH as defined above
fn
crate_meta_extras_hash
(
symbol_hasher
:
&
hash
::
State
,
-
cmh_items
:
~
[
@
ast
::
meta_item
],
+
cmh_items
:
~
[
@
ast
::
meta_item
],
dep_hashes
:
~
[
~
str
])
->
@
str
{
fn
len_and_str
(
s
:
&
str
)
->
~
str
{
fmt!
(
"%u_%s"
,
s
.len
(),
s
)
...
...
@@ -535,7 +535,7 @@ fn warn_missing(sess: Session, name: &str, default: &str) {
name
,
default
));
}
fn
crate_meta_name
(
sess
:
Session
,
output
:
&
Path
,
-
opt_name
:
Option
<@
str
>
)
fn
crate_meta_name
(
sess
:
Session
,
output
:
&
Path
,
+
opt_name
:
Option
<@
str
>
)
->
@
str
{
return
match
opt_name
{
Some
(
v
)
=>
v
,
...
...
src/librustc/driver/driver.rs
浏览文件 @
852619d5
...
...
@@ -440,7 +440,7 @@ fn ann_identified_post(node: pprust::ann_node) {
}
}
pub
fn
get_os
(
triple
:
~
str
)
->
Option
<
session
::
os
>
{
pub
fn
get_os
(
triple
:
&
str
)
->
Option
<
session
::
os
>
{
if
str
::
contains
(
triple
,
~
"win32"
)
||
str
::
contains
(
triple
,
~
"mingw32"
)
{
Some
(
session
::
os_win32
)
...
...
@@ -455,7 +455,7 @@ pub fn get_os(triple: ~str) -> Option<session::os> {
}
else
{
None
}
}
pub
fn
get_arch
(
triple
:
~
str
)
->
Option
<
session
::
arch
>
{
pub
fn
get_arch
(
triple
:
&
str
)
->
Option
<
session
::
arch
>
{
if
str
::
contains
(
triple
,
~
"i386"
)
||
str
::
contains
(
triple
,
~
"i486"
)
||
str
::
contains
(
triple
,
~
"i586"
)
||
...
...
src/librustc/metadata/creader.rs
浏览文件 @
852619d5
...
...
@@ -222,7 +222,7 @@ fn metas_with_ident(ident: @~str, +metas: ~[@ast::meta_item])
metas_with
(
ident
,
@~
"name"
,
metas
)
}
fn
existing_match
(
e
:
@
mut
Env
,
metas
:
~
[
@
ast
::
meta_item
],
hash
:
@~
str
)
fn
existing_match
(
e
:
@
mut
Env
,
metas
:
&
[
@
ast
::
meta_item
],
hash
:
@~
str
)
->
Option
<
int
>
{
for
e
.crate_cache.each
|
c
|
{
if
loader
::
metadata_matches
(
*
c
.metas
,
metas
)
...
...
src/librustc/metadata/decoder.rs
浏览文件 @
852619d5
...
...
@@ -560,7 +560,7 @@ pub fn maybe_get_item_ast(intr: @ident_interner, cdata: cmd, tcx: ty::ctxt,
let
item_path
=
item_path
(
intr
,
item_doc
);
vec
::
from_slice
(
item_path
.init
())
};
match
decode_inlined_item
(
cdata
,
tcx
,
path
,
item_doc
)
{
match
decode_inlined_item
(
cdata
,
tcx
,
copy
path
,
item_doc
)
{
Some
(
ref
ii
)
=>
csearch
::
found
((
/*bad*/
copy
*
ii
)),
None
=>
{
match
item_parent_item
(
item_doc
)
{
...
...
src/librustc/metadata/loader.rs
浏览文件 @
852619d5
...
...
@@ -176,7 +176,7 @@ fn crate_matches(crate_data: @~[u8],
metadata_matches
(
linkage_metas
,
metas
)
}
pub
fn
metadata_matches
(
extern_metas
:
~
[
@
ast
::
meta_item
],
pub
fn
metadata_matches
(
extern_metas
:
&
[
@
ast
::
meta_item
],
local_metas
:
&
[
@
ast
::
meta_item
])
->
bool
{
debug!
(
"matching %u metadata requirements against %u items"
,
...
...
src/librustc/metadata/tydecode.rs
浏览文件 @
852619d5
...
...
@@ -427,7 +427,6 @@ fn parse_mode(st: @mut PState) -> ast::mode {
let
m
=
ast
::
expl
(
match
next
(
st
)
{
'+'
=>
ast
::
by_copy
,
'='
=>
ast
::
by_ref
,
'#'
=>
ast
::
by_val
,
_
=>
fail
!
(
~
"bad mode"
)
});
return
m
;
...
...
src/librustc/metadata/tyencode.rs
浏览文件 @
852619d5
...
...
@@ -342,7 +342,6 @@ pub fn enc_mode(w: io::Writer, cx: @ctxt, m: mode) {
match
ty
::
resolved_mode
(
cx
.tcx
,
m
)
{
by_copy
=>
w
.write_char
(
'+'
),
by_ref
=>
w
.write_char
(
'='
),
by_val
=>
w
.write_char
(
'#'
)
}
}
...
...
src/librustc/middle/astencode.rs
浏览文件 @
852619d5
...
...
@@ -105,7 +105,7 @@ pub fn encode_inlined_item(ecx: @e::EncodeContext,
pub
fn
decode_inlined_item
(
cdata
:
@
cstore
::
crate_metadata
,
tcx
:
ty
::
ctxt
,
maps
:
Maps
,
path
:
ast_map
::
path
,
+
path
:
ast_map
::
path
,
par_doc
:
ebml
::
Doc
)
->
Option
<
ast
::
inlined_item
>
{
let
dcx
=
@
DecodeContext
{
...
...
src/librustc/middle/borrowck/gather_loans.rs
浏览文件 @
852619d5
...
...
@@ -156,7 +156,7 @@ fn req_loans_in_expr(ex: @ast::expr,
let
arg_cmt
=
self
.bccx
.cat_expr
(
*
arg
);
self
.guarantee_valid
(
arg_cmt
,
m_imm
,
scope_r
);
}
ast
::
by_
val
|
ast
::
by_
copy
=>
{}
ast
::
by_copy
=>
{}
}
}
visit
::
visit_expr
(
ex
,
self
,
vt
);
...
...
@@ -172,7 +172,7 @@ fn req_loans_in_expr(ex: @ast::expr,
let
arg_cmt
=
self
.bccx
.cat_expr
(
*
arg
);
self
.guarantee_valid
(
arg_cmt
,
m_imm
,
scope_r
);
}
ast
::
by_
val
|
ast
::
by_
copy
=>
{}
ast
::
by_copy
=>
{}
}
}
...
...
src/librustc/middle/lint.rs
浏览文件 @
852619d5
...
...
@@ -765,7 +765,7 @@ fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
// deprecated and because its semantics have changed recently:
for
decl
.inputs.eachi
|
i
,
arg
|
{
match
ty
::
resolved_mode
(
cx
,
arg
.mode
)
{
ast
::
by_
val
|
ast
::
by_
copy
=>
{}
ast
::
by_copy
=>
{}
ast
::
by_ref
=>
{
cx
.sess
.span_lint
(
foreign_mode
,
fn_id
,
fn_id
,
arg
.ty.span
,
...
...
src/librustc/middle/liveness.rs
浏览文件 @
852619d5
...
...
@@ -427,7 +427,7 @@ fn add_last_use(&mut self, expr_id: node_id, var: Variable) {
v
.push
(
id
);
}
Arg
(
_
,
_
,
by_ref
)
|
Arg
(
_
,
_
,
by_val
)
|
ImplicitRet
=>
{
ImplicitRet
=>
{
debug!
(
"--but it is not owned"
);
}
}
...
...
@@ -1006,7 +1006,7 @@ fn propagate_through_fn_block(&self, decl: &fn_decl, blk: &blk)
// inputs passed by & mode should be considered live on exit:
for
decl
.inputs.each
|
arg
|
{
match
ty
::
resolved_mode
(
self
.tcx
,
arg
.mode
)
{
by_
val
|
by_
ref
=>
{
by_ref
=>
{
// By val and by ref do not own, so register a
// read at the end. This will prevent us from
// moving out of such variables but also prevent
...
...
src/librustc/middle/mem_categorization.rs
浏览文件 @
852619d5
...
...
@@ -486,14 +486,6 @@ fn cat_def(&self,
let
lp
=
match
ty
::
resolved_mode
(
self
.tcx
,
mode
)
{
ast
::
by_copy
=>
Some
(
@
lp_arg
(
vid
)),
ast
::
by_ref
=>
None
,
ast
::
by_val
=>
{
// by-value is this hybrid mode where we have a
// pointer but we do not own it. This is not
// considered loanable because, for example, a by-ref
// and and by-val argument might both actually contain
// the same unique ptr.
None
}
};
@
cmt_
{
id
:
id
,
...
...
src/librustc/middle/moves.rs
浏览文件 @
852619d5
...
...
@@ -782,7 +782,7 @@ fn use_fn_arg(&self,
*/
match
arg_mode
{
by_
val
|
by_
ref
=>
self
.use_expr
(
arg_expr
,
Read
,
visitor
),
by_ref
=>
self
.use_expr
(
arg_expr
,
Read
,
visitor
),
by_copy
=>
self
.consume_expr
(
arg_expr
,
visitor
)
}
}
...
...
src/librustc/middle/resolve.rs
浏览文件 @
852619d5
...
...
@@ -2021,7 +2021,7 @@ fn import_directive_subclass_to_str(@mut self,
}
fn
import_path_to_str
(
@
mut
self
,
idents
:
~
[
ident
],
idents
:
&
[
ident
],
subclass
:
ImportDirectiveSubclass
)
->
@~
str
{
if
idents
.is_empty
()
{
...
...
@@ -2573,7 +2573,7 @@ fn resolve_glob_import(@mut self,
/// Resolves the given module path from the given root `module_`.
fn
resolve_module_path_from_root
(
@
mut
self
,
module_
:
@
mut
Module
,
module_path
:
~
[
ident
],
module_path
:
&
[
ident
],
index
:
uint
,
span
:
span
,
mut
name_search_type
:
NameSearchType
)
...
...
@@ -2658,7 +2658,7 @@ fn resolve_module_path_from_root(@mut self,
/// rooted at the given module.
fn
resolve_module_path_for_import
(
@
mut
self
,
module_
:
@
mut
Module
,
module_path
:
~
[
ident
],
module_path
:
&
[
ident
],
use_lexical_scope
:
UseLexicalScopeFlag
,
span
:
span
)
->
ResolveResult
<@
mut
Module
>
{
...
...
@@ -2944,7 +2944,7 @@ fn get_nearest_normal_module_parent_or_self(@mut self,
*/
fn
resolve_module_prefix
(
@
mut
self
,
module_
:
@
mut
Module
,
module_path
:
~
[
ident
])
module_path
:
&
[
ident
])
->
ResolveResult
<
ModulePrefixResult
>
{
let
interner
=
self
.session.parse_sess.interner
;
...
...
@@ -3876,7 +3876,7 @@ fn resolve_implementation(@mut self,
generics
:
&
Generics
,
opt_trait_reference
:
Option
<@
trait_ref
>
,
self_type
:
@
Ty
,
methods
:
~
[
@
method
],
methods
:
&
[
@
method
],
visitor
:
ResolveVisitor
)
{
// If applicable, create a rib for the type parameters.
let
outer_type_parameter_count
=
generics
.ty_params
.len
();
...
...
src/librustc/middle/trans/_match.rs
浏览文件 @
852619d5
...
...
@@ -599,7 +599,7 @@ pub fn enter_rec_or_struct(bcx: block,
dm
:
DefMap
,
m
:
&
[
@
Match
/&
r
],
col
:
uint
,
fields
:
~
[
ast
::
ident
],
fields
:
&
[
ast
::
ident
],
val
:
ValueRef
)
->
~
[
@
Match
/&
r
]
{
debug!
(
"enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)"
,
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
852619d5
...
...
@@ -1682,12 +1682,6 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
add_clean
(
bcx
,
llarg
,
arg_ty
.ty
);
}
ast
::
by_val
=>
{
// always by value, also not owned, so don't add a cleanup:
let
alloc
=
alloc_ty
(
bcx
,
arg_ty
.ty
);
Store
(
bcx
,
raw_llarg
,
alloc
);
llarg
=
alloc
;
}
}
bcx
=
_
match
::
bind_irrefutable_pat
(
bcx
,
...
...
@@ -1812,7 +1806,7 @@ pub fn trans_fn(ccx: @CrateContext,
debug!
(
"trans_fn(ty_self=%?)"
,
ty_self
);
let
_
icx
=
ccx
.insn_ctxt
(
"trans_fn"
);
ccx
.stats.n_fns
+=
1
;
let
the_path_str
=
path_str
(
ccx
.sess
,
&
path
);
let
the_path_str
=
path_str
(
ccx
.sess
,
path
);
trans_closure
(
ccx
,
path
,
decl
,
body
,
llfndecl
,
ty_self
,
param_substs
,
id
,
impl_id
,
|
fcx
|
{
...
...
src/librustc/middle/trans/callee.rs
浏览文件 @
852619d5
...
...
@@ -720,14 +720,6 @@ pub fn trans_arg_expr(bcx: block,
val
=
arg_datum
.to_ref_llval
(
bcx
);
}
ast
::
by_val
=>
{
// NB: avoid running the take glue.
fail_unless!
(
!
bcx
.ccx
()
.maps.moves_map
.contains_key
(
&
arg_expr
.id
));
val
=
arg_datum
.to_value_llval
(
bcx
);
}
ast
::
by_copy
=>
{
debug!
(
"by copy arg with type %s, storing to scratch"
,
bcx
.ty_to_str
(
arg_datum
.ty
));
...
...
src/librustc/middle/trans/common.rs
浏览文件 @
852619d5
...
...
@@ -54,7 +54,7 @@
use
core
::
vec
;
use
std
::
oldmap
::{
HashMap
,
Set
};
use
syntax
::
ast
::
ident
;
use
syntax
::
ast_map
::
path
;
use
syntax
::
ast_map
::
{
path
,
path_elt
}
;
use
syntax
::
codemap
::
span
;
use
syntax
::
parse
::
token
::
ident_interner
;
use
syntax
::{
ast
,
ast_map
};
...
...
@@ -590,7 +590,7 @@ pub struct block_ {
fcx
:
fn_ctxt
}
pub
fn
block_
(
llbb
:
BasicBlockRef
,
parent
:
Option
<
block
>
,
-
kind
:
block_kind
,
pub
fn
block_
(
llbb
:
BasicBlockRef
,
parent
:
Option
<
block
>
,
+
kind
:
block_kind
,
is_lpad
:
bool
,
node_info
:
Option
<
NodeInfo
>
,
fcx
:
fn_ctxt
)
->
block_
{
...
...
@@ -608,7 +608,7 @@ pub fn block_(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,
pub
type
block
=
@
mut
block_
;
pub
fn
mk_block
(
llbb
:
BasicBlockRef
,
parent
:
Option
<
block
>
,
-
kind
:
block_kind
,
pub
fn
mk_block
(
llbb
:
BasicBlockRef
,
parent
:
Option
<
block
>
,
+
kind
:
block_kind
,
is_lpad
:
bool
,
node_info
:
Option
<
NodeInfo
>
,
fcx
:
fn_ctxt
)
->
block
{
@
mut
block_
(
llbb
,
parent
,
kind
,
is_lpad
,
node_info
,
fcx
)
...
...
@@ -1320,9 +1320,9 @@ pub fn align_to(cx: block, off: ValueRef, align: ValueRef) -> ValueRef {
return
build
::
And
(
cx
,
bumped
,
build
::
Not
(
cx
,
mask
));
}
pub
fn
path_str
(
sess
:
session
::
Session
,
p
:
&
path
)
->
~
str
{
pub
fn
path_str
(
sess
:
session
::
Session
,
p
:
&
[
path_elt
]
)
->
~
str
{
let
mut
r
=
~
""
,
first
=
true
;
for
vec
::
each
(
*
p
)
|
e
|
{
for
p
.each
|
e
|
{
match
*
e
{
ast_map
::
path_name
(
s
)
|
ast_map
::
path_mod
(
s
)
=>
{
if
first
{
first
=
false
;
}
...
...
src/librustc/middle/trans/controlflow.rs
浏览文件 @
852619d5
...
...
@@ -192,7 +192,7 @@ pub fn trans_log(log_ex: @ast::expr,
bcx
.fcx.path
.filtered
(|
e
|
match
*
e
{
path_mod
(
_
)
=>
true
,
_
=>
false
}
));
let
modname
=
path_str
(
ccx
.sess
,
&
modpath
);
let
modname
=
path_str
(
ccx
.sess
,
modpath
);
let
global
=
if
ccx
.module_data
.contains_key
(
&
modname
)
{
ccx
.module_data
.get
(
&
modname
)
...
...
src/librustc/middle/trans/meth.rs
浏览文件 @
852619d5
...
...
@@ -44,7 +44,7 @@
see `trans::base::lval_static_fn()` or `trans::base::monomorphic_fn()`.
*/
pub
fn
trans_impl
(
ccx
:
@
CrateContext
,
+
path
:
path
,
name
:
ast
::
ident
,
methods
:
~
[
@
ast
::
method
],
generics
:
&
ast
::
Generics
,
methods
:
&
[
@
ast
::
method
],
generics
:
&
ast
::
Generics
,
self_ty
:
Option
<
ty
::
t
>
,
id
:
ast
::
node_id
)
{
let
_
icx
=
ccx
.insn_ctxt
(
"impl::trans_impl"
);
if
!
generics
.ty_params
.is_empty
()
{
return
;
}
...
...
src/librustc/middle/trans/reflect.rs
浏览文件 @
852619d5
...
...
@@ -313,7 +313,6 @@ fn visit_sig(&mut self, retval: uint, sig: &ty::FnSig) {
ast
::
infer
(
_
)
=>
0u
,
ast
::
expl
(
e
)
=>
match
e
{
ast
::
by_ref
=>
1u
,
ast
::
by_val
=>
2u
,
ast
::
by_copy
=>
5u
}
};
...
...
src/librustc/middle/trans/type_of.rs
浏览文件 @
852619d5
...
...
@@ -23,7 +23,6 @@
pub
fn
arg_is_indirect
(
ccx
:
@
CrateContext
,
arg
:
&
ty
::
arg
)
->
bool
{
match
ty
::
resolved_mode
(
ccx
.tcx
,
arg
.mode
)
{
ast
::
by_val
=>
false
,
ast
::
by_copy
=>
!
ty
::
type_is_immediate
(
arg
.ty
),
ast
::
by_ref
=>
true
}
...
...
src/librustc/middle/trans/type_use.rs
浏览文件 @
852619d5
...
...
@@ -81,7 +81,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
ty
::
ty_closure
(
ty
::
ClosureTy
{
sig
:
ref
sig
,
_
})
=>
{
for
vec
::
each
(
sig
.inputs
)
|
arg
|
{
match
ty
::
resolved_mode
(
ccx
.tcx
,
arg
.mode
)
{
by_
val
|
by_
copy
=>
{
by_copy
=>
{
type_needs
(
cx
,
use_repr
,
arg
.ty
);
}
by_ref
=>
{}
...
...
@@ -326,7 +326,7 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
ty
::
ty_fn_args
(
ty
::
node_id_to_type
(
cx
.ccx.tcx
,
f
.id
))
)
|
a
|
{
match
a
.mode
{
expl
(
by_copy
)
|
expl
(
by_val
)
=>
{
expl
(
by_copy
)
=>
{
type_needs
(
cx
,
use_repr
,
a
.ty
);
}
_
=>
()
...
...
@@ -340,7 +340,7 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
for
ty
::
ty_fn_args
(
ty
::
node_id_to_type
(
cx
.ccx.tcx
,
e
.callee_id
))
.each
|
a
|
{
match
a
.mode
{
expl
(
by_copy
)
|
expl
(
by_val
)
=>
{
expl
(
by_copy
)
=>
{
type_needs
(
cx
,
use_repr
,
a
.ty
);
}
_
=>
()
...
...
src/librustc/middle/ty.rs
浏览文件 @
852619d5
...
...
@@ -1110,7 +1110,7 @@ pub fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
// forward-compatible with non-legacy, we should use +
ast
::
by_copy
}
else
if
ty
::
type_is_immediate
(
ty
)
{
ast
::
by_
val
ast
::
by_
copy
}
else
{
ast
::
by_ref
}
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
852619d5
...
...
@@ -3207,7 +3207,7 @@ fn arg(m: ast::rmode, ty: ty::t) -> ty::arg {
let
(
_
,
visitor_trait
)
=
tcx
.intrinsic_defs
.get
(
&
ty_visitor_name
);
let
td_ptr
=
ty
::
mk_ptr
(
ccx
.tcx
,
ty
::
mt
{
ty
:
tydesc_ty
,
mutbl
:
ast
::
m_imm
});
(
0u
,
~
[
arg
(
ast
::
by_
val
,
td_ptr
),
(
0u
,
~
[
arg
(
ast
::
by_
copy
,
td_ptr
),
arg
(
ast
::
by_ref
,
visitor_trait
)],
ty
::
mk_nil
(
tcx
))
}
~
"frame_address"
=>
{
...
...
@@ -3217,7 +3217,7 @@ fn arg(m: ast::rmode, ty: ty::t) -> ty::arg {
onceness
:
ast
::
Once
,
region
:
ty
::
re_bound
(
ty
::
br_anon
(
0
)),
sig
:
ty
::
FnSig
{
inputs
:
~
[
arg
{
mode
:
ast
::
expl
(
ast
::
by_
val
),
inputs
:
~
[
arg
{
mode
:
ast
::
expl
(
ast
::
by_
copy
),
ty
:
ty
::
mk_imm_ptr
(
ccx
.tcx
,
ty
::
mk_mach_uint
(
ccx
.tcx
,
ast
::
ty_u8
))}],
...
...
src/librustc/middle/typeck/mod.rs
浏览文件 @
852619d5
...
...
@@ -273,26 +273,6 @@ fn find(&self, br: ty::bound_region) -> Option<ty::Region> {
}
}
fn
arg_is_argv_ty
(
tcx
:
ty
::
ctxt
,
a
:
ty
::
arg
)
->
bool
{
match
ty
::
resolved_mode
(
tcx
,
a
.mode
)
{
ast
::
by_val
=>
{
/*ok*/
}
_
=>
{
return
false
;
}
}
match
ty
::
get
(
a
.ty
)
.sty
{
ty
::
ty_evec
(
mt
,
vstore_uniq
)
=>
{
if
mt
.mutbl
!=
ast
::
m_imm
{
return
false
;
}
match
ty
::
get
(
mt
.ty
)
.sty
{
ty
::
ty_estr
(
vstore_uniq
)
=>
return
true
,
_
=>
return
false
}
}
_
=>
return
false
}
}
fn
check_main_fn_ty
(
ccx
:
@
mut
CrateCtxt
,
main_id
:
ast
::
node_id
,
main_span
:
span
)
{
...
...
src/libstd/arena.rs
浏览文件 @
852619d5
...
...
@@ -49,7 +49,7 @@
pub
mod
rusti
{
#[abi
=
"rust-intrinsic"
]
pub
extern
{
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
-
src
:
T
);
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
+
src
:
T
);
fn
needs_drop
<
T
>
()
->
bool
;
}
}
...
...
src/libstd/priority_queue.rs
浏览文件 @
852619d5
...
...
@@ -19,7 +19,7 @@
#[abi
=
"rust-intrinsic"
]
extern
"C"
mod
rusti
{
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
-
src
:
T
);
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
+
src
:
T
);
fn
init
<
T
>
()
->
T
;
}
...
...
src/libsyntax/ast.rs
浏览文件 @
852619d5
...
...
@@ -456,7 +456,7 @@ impl<T:to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> {
#[auto_encode]
#[auto_decode]
#[deriving_eq]
pub
enum
rmode
{
by_ref
,
by_
val
,
by_
copy
}
pub
enum
rmode
{
by_ref
,
by_copy
}
impl
to_bytes
::
IterBytes
for
rmode
{
pure
fn
iter_bytes
(
&
self
,
+
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
{
...
...
src/libsyntax/ast_map.rs
浏览文件 @
852619d5
...
...
@@ -148,7 +148,7 @@ pub fn map_crate(diag: span_handler, c: crate) -> map {
// the item itself.
pub
fn
map_decoded_item
(
diag
:
span_handler
,
map
:
map
,
path
:
path
,
+
path
:
path
,
ii
:
inlined_item
)
{
// I believe it is ok for the local IDs of inlined items from other crates
// to overlap with the local ids from this crate, so just generate the ids
...
...
@@ -171,10 +171,10 @@ pub fn map_decoded_item(diag: span_handler,
ii_item
(
*
)
|
ii_dtor
(
*
)
=>
{
/* fallthrough */
}
ii_foreign
(
i
)
=>
{
cx
.map
.insert
(
i
.id
,
node_foreign_item
(
i
,
foreign_abi_rust_intrinsic
,
@
/*bad*/
copy
path
));
@
path
));
}
ii_method
(
impl_did
,
m
)
=>
{
map_method
(
impl_did
,
@
/*bad*/
copy
path
,
m
,
cx
);
map_method
(
impl_did
,
@
path
,
m
,
cx
);
}
}
...
...
src/libsyntax/attr.rs
浏览文件 @
852619d5
...
...
@@ -72,7 +72,7 @@ pub fn attr_meta(attr: ast::attribute) -> @ast::meta_item {
}
// Get the meta_items from inside a vector of attributes
pub
fn
attr_metas
(
attrs
:
~
[
ast
::
attribute
])
->
~
[
@
ast
::
meta_item
]
{
pub
fn
attr_metas
(
attrs
:
&
[
ast
::
attribute
])
->
~
[
@
ast
::
meta_item
]
{
do
attrs
.map
|
a
|
{
attr_meta
(
*
a
)
}
}
...
...
@@ -214,7 +214,7 @@ pub fn attrs_contains_name(attrs: &[ast::attribute], name: &str) -> bool {
!
find_attrs_by_name
(
attrs
,
name
)
.is_empty
()
}
pub
fn
first_attr_value_str_by_name
(
attrs
:
~
[
ast
::
attribute
],
name
:
&
str
)
pub
fn
first_attr_value_str_by_name
(
attrs
:
&
[
ast
::
attribute
],
name
:
&
str
)
->
Option
<@~
str
>
{
let
mattrs
=
find_attrs_by_name
(
attrs
,
name
);
...
...
@@ -304,7 +304,7 @@ pub fn find_linkage_metas(attrs: &[ast::attribute]) -> ~[@ast::meta_item] {
}
}
pub
fn
foreign_abi
(
attrs
:
~
[
ast
::
attribute
])
pub
fn
foreign_abi
(
attrs
:
&
[
ast
::
attribute
])
->
Either
<~
str
,
ast
::
foreign_abi
>
{
return
match
attr
::
first_attr_value_str_by_name
(
attrs
,
~
"abi"
)
{
None
=>
{
...
...
src/libsyntax/parse/obsolete.rs
浏览文件 @
852619d5
...
...
@@ -55,6 +55,7 @@ pub enum ObsoleteSyntax {
ObsoletePostFnTySigil
,
ObsoleteBareFnType
,
ObsoleteNewtypeEnum
,
ObsoleteMode
,
}
impl
to_bytes
::
IterBytes
for
ObsoleteSyntax
{
...
...
@@ -176,6 +177,10 @@ fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
"newtype enum"
,
"instead of `enum Foo = int`, write `struct Foo(int)`"
),
ObsoleteMode
=>
(
"obsolete argument mode"
,
"replace `-` or `++` mode with `+`"
),
};
self
.report
(
sp
,
kind
,
kind_str
,
desc
);
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
852619d5
...
...
@@ -17,7 +17,7 @@
use
ast
::{
provided
,
public
,
pure_fn
,
purity
};
use
ast
::{
_
mod
,
add
,
arg
,
arm
,
attribute
,
bind_by_ref
,
bind_infer
};
use
ast
::{
bind_by_copy
,
bitand
,
bitor
,
bitxor
,
blk
};
use
ast
::{
blk_check_mode
,
box
,
by_copy
,
by_ref
,
by_val
};
use
ast
::{
blk_check_mode
,
box
,
by_copy
,
by_ref
};
use
ast
::{
crate
,
crate_cfg
,
decl
,
decl_item
};
use
ast
::{
decl_local
,
default_blk
,
deref
,
div
,
enum_def
,
enum_variant_kind
};
use
ast
::{
expl
,
expr
,
expr_
,
expr_addr_of
,
expr_match
,
expr_again
};
...
...
@@ -78,6 +78,7 @@
use
parse
::
obsolete
::{
ObsoleteRecordType
,
ObsoleteRecordPattern
};
use
parse
::
obsolete
::{
ObsoleteAssertion
,
ObsoletePostFnTySigil
};
use
parse
::
obsolete
::{
ObsoleteBareFnType
,
ObsoleteNewtypeEnum
};
use
parse
::
obsolete
::{
ObsoleteMode
};
use
parse
::
prec
::{
as_prec
,
token_to_binop
};
use
parse
::
token
::{
can_begin_expr
,
is_ident
,
is_ident_or_path
};
use
parse
::
token
::{
is_plain_ident
,
INTERPOLATED
,
special_idents
};
...
...
@@ -716,12 +717,15 @@ fn parse_borrowed_pointee(&self) -> ty_ {
fn
parse_arg_mode
(
&
self
)
->
mode
{
if
self
.eat
(
&
token
::
BINOP
(
token
::
MINUS
))
{
expl
(
by_copy
)
// NDM outdated syntax
self
.obsolete
(
*
self
.span
,
ObsoleteMode
);
expl
(
by_copy
)
}
else
if
self
.eat
(
&
token
::
ANDAND
)
{
expl
(
by_ref
)
}
else
if
self
.eat
(
&
token
::
BINOP
(
token
::
PLUS
))
{
if
self
.eat
(
&
token
::
BINOP
(
token
::
PLUS
))
{
expl
(
by_val
)
// ++ mode is obsolete, but we need a snapshot
// to stop parsing it.
expl
(
by_copy
)
}
else
{
expl
(
by_copy
)
}
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
852619d5
...
...
@@ -1710,7 +1710,6 @@ pub fn mode_to_str(m: ast::mode) -> ~str {
match
m
{
ast
::
expl
(
ast
::
by_ref
)
=>
~
"&&"
,
ast
::
expl
(
ast
::
by_copy
)
=>
~
"+"
,
ast
::
expl
(
ast
::
by_val
)
=>
~
"++"
,
ast
::
infer
(
_
)
=>
~
""
}
}
...
...
src/test/auxiliary/cci_class_6.rs
浏览文件 @
852619d5
...
...
@@ -23,7 +23,7 @@ fn speak<T>(&mut self, stuff: ~[T]) {
fn
meow_count
(
&
mut
self
)
->
uint
{
self
.meows
}
}
pub
fn
cat
<
U
>
(
in_x
:
uint
,
in_y
:
int
,
-
in_info
:
~
[
U
])
->
cat
<
U
>
{
pub
fn
cat
<
U
>
(
in_x
:
uint
,
in_y
:
int
,
+
in_info
:
~
[
U
])
->
cat
<
U
>
{
cat
{
meows
:
in_x
,
how_hungry
:
in_y
,
...
...
src/test/bench/graph500-bfs.rs
浏览文件 @
852619d5
...
...
@@ -100,7 +100,7 @@ fn make_graph(N: uint, edges: ~[(node_id, node_id)]) -> graph {
}
}
fn
gen_search_keys
(
graph
:
graph
,
n
:
uint
)
->
~
[
node_id
]
{
fn
gen_search_keys
(
graph
:
&
[
~
[
node_id
]]
,
n
:
uint
)
->
~
[
node_id
]
{
let
keys
=
oldmap
::
HashMap
::
<
node_id
,
()
>
();
let
r
=
rand
::
Rng
();
...
...
src/test/bench/task-perf-jargon-metal-smoke.rs
浏览文件 @
852619d5
...
...
@@ -19,7 +19,7 @@
use
core
::
cell
::
Cell
;
fn
child_generation
(
gens_left
:
uint
,
-
c
:
comm
::
Chan
<
()
>
)
{
fn
child_generation
(
gens_left
:
uint
,
c
:
comm
::
Chan
<
()
>
)
{
// This used to be O(n^2) in the number of generations that ever existed.
// With this code, only as many generations are alive at a time as tasks
// alive at a time,
...
...
src/test/compile-fail/liveness-move-from-args.rs
浏览文件 @
852619d5
...
...
@@ -10,10 +10,6 @@
fn
take
(
_
x
:
~
int
)
{
}
fn
from_by_value_arg
(
++
x
:
~
int
)
{
take
(
x
);
//~ ERROR illegal move from argument `x`, which is not copy or move mode
}
fn
from_by_ref_arg
(
&&
x
:
~
int
)
{
take
(
x
);
//~ ERROR illegal move from argument `x`, which is not copy or move mode
}
...
...
src/test/compile-fail/liveness-use-after-send.rs
浏览文件 @
852619d5
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
send
<
T
:
Owned
>
(
ch
:
_
chan
<
T
>
,
-
data
:
T
)
{
fn
send
<
T
:
Owned
>
(
ch
:
_
chan
<
T
>
,
+
data
:
T
)
{
debug!
(
ch
);
debug!
(
data
);
fail
!
();
...
...
src/test/compile-fail/mutable-arguments.rs
浏览文件 @
852619d5
...
...
@@ -19,18 +19,13 @@ fn mutate_by_ref(&&x: uint) {
x
=
0
;
//~ ERROR assigning to argument
}
fn
mutate_by_val
(
++
x
:
uint
)
{
//~^ WARNING unused variable: `x`
x
=
0
;
//~ ERROR assigning to argument
}
fn
mutate_by_copy
(
+
x
:
uint
)
{
//~^ WARNING unused variable: `x`
x
=
0
;
//~ ERROR assigning to argument
//~^ WARNING value assigned to `x` is never read
}
fn
mutate_by_move
(
-
x
:
uint
)
{
fn
mutate_by_move
(
+
x
:
uint
)
{
//~^ WARNING unused variable: `x`
x
=
0
;
//~ ERROR assigning to argument
//~^ WARNING value assigned to `x` is never read
...
...
src/test/run-fail/unwind-move.rs
浏览文件 @
852619d5
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
// error-pattern:fail
fn
f
(
-
_
a
:
@
int
)
{
fn
f
(
+
_
a
:
@
int
)
{
fail
!
();
}
...
...
src/test/run-pass/argument-passing.rs
浏览文件 @
852619d5
...
...
@@ -12,7 +12,7 @@
struct
X
{
x
:
int
}
fn
f1
(
a
:
&
mut
X
,
b
:
&
mut
int
,
-
c
:
int
)
->
int
{
fn
f1
(
a
:
&
mut
X
,
b
:
&
mut
int
,
+
c
:
int
)
->
int
{
let
r
=
a
.x
+
*
b
+
c
;
a
.x
=
0
;
*
b
=
10
;
...
...
src/test/run-pass/borrowck-lend-args.rs
浏览文件 @
852619d5
...
...
@@ -18,17 +18,9 @@ fn borrow_from_arg_mut_ref(v: &mut ~int) {
borrow
(
*
v
);
}
fn
borrow_from_arg_move
(
-
v
:
~
int
)
{
borrow
(
v
);
}
fn
borrow_from_arg_copy
(
+
v
:
~
int
)
{
borrow
(
v
);
}
fn
borrow_from_arg_val
(
++
v
:
~
int
)
{
borrow
(
v
);
}
pub
fn
main
()
{
}
src/test/run-pass/class-poly-methods.rs
浏览文件 @
852619d5
...
...
@@ -22,7 +22,7 @@ fn speak<T>(&mut self, stuff: ~[T]) {
fn
meow_count
(
&
mut
self
)
->
uint
{
self
.meows
}
}
fn
cat
<
U
>
(
in_x
:
uint
,
in_y
:
int
,
-
in_info
:
~
[
U
])
->
cat
<
U
>
{
fn
cat
<
U
>
(
in_x
:
uint
,
in_y
:
int
,
+
in_info
:
~
[
U
])
->
cat
<
U
>
{
cat
{
meows
:
in_x
,
how_hungry
:
in_y
,
...
...
src/test/run-pass/intrinsic-move-val.rs
浏览文件 @
852619d5
...
...
@@ -11,8 +11,8 @@
mod
rusti
{
#[abi
=
"rust-intrinsic"
]
pub
extern
{
pub
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
-
src
:
T
);
pub
fn
move_val
<
T
>
(
dst
:
&
mut
T
,
-
src
:
T
);
pub
fn
move_val_init
<
T
>
(
dst
:
&
mut
T
,
+
src
:
T
);
pub
fn
move_val
<
T
>
(
dst
:
&
mut
T
,
+
src
:
T
);
}
}
...
...
src/test/run-pass/issue-2718.rs
浏览文件 @
852619d5
...
...
@@ -70,7 +70,7 @@ pub fn swap_state_rel(+dst: &mut state, src: state) -> state {
}
}
pub
fn
send
<
T
:
Owned
>
(
mut
p
:
send_packet
<
T
>
,
-
payload
:
T
)
{
pub
fn
send
<
T
:
Owned
>
(
mut
p
:
send_packet
<
T
>
,
+
payload
:
T
)
{
let
mut
p
=
p
.unwrap
();
let
mut
p
=
unsafe
{
uniquify
(
p
)
};
fail_unless!
((
*
p
)
.payload
.is_none
());
...
...
@@ -228,7 +228,7 @@ pub mod pingpong {
pub
struct
ping
(::
pipes
::
send_packet
<
pong
>
);
pub
struct
pong
(::
pipes
::
send_packet
<
ping
>
);
pub
fn
liberate_ping
(
-
p
:
ping
)
->
::
pipes
::
send_packet
<
pong
>
{
pub
fn
liberate_ping
(
+
p
:
ping
)
->
::
pipes
::
send_packet
<
pong
>
{
unsafe
{
let
addr
:
*
::
pipes
::
send_packet
<
pong
>
=
match
&
p
{
&
ping
(
ref
x
)
=>
{
cast
::
transmute
(
ptr
::
addr_of
(
x
))
}
...
...
@@ -239,7 +239,7 @@ pub fn liberate_ping(-p: ping) -> ::pipes::send_packet<pong> {
}
}
pub
fn
liberate_pong
(
-
p
:
pong
)
->
::
pipes
::
send_packet
<
ping
>
{
pub
fn
liberate_pong
(
+
p
:
pong
)
->
::
pipes
::
send_packet
<
ping
>
{
unsafe
{
let
addr
:
*
::
pipes
::
send_packet
<
ping
>
=
match
&
p
{
&
pong
(
ref
x
)
=>
{
cast
::
transmute
(
ptr
::
addr_of
(
x
))
}
...
...
@@ -261,14 +261,14 @@ pub mod client {
pub
type
ping
=
::
pipes
::
send_packet
<
pingpong
::
ping
>
;
pub
type
pong
=
::
pipes
::
recv_packet
<
pingpong
::
pong
>
;
pub
fn
do_ping
(
-
c
:
ping
)
->
pong
{
pub
fn
do_ping
(
+
c
:
ping
)
->
pong
{
let
(
sp
,
rp
)
=
::
pipes
::
entangle
();
::
pipes
::
send
(
c
,
pingpong
::
ping
(
sp
));
rp
}
pub
fn
do_pong
(
-
c
:
pong
)
->
(
ping
,
())
{
pub
fn
do_pong
(
+
c
:
pong
)
->
(
ping
,
())
{
let
packet
=
::
pipes
::
recv
(
c
);
if
packet
.is_none
()
{
fail
!
(
~
"sender closed the connection"
)
...
...
@@ -283,7 +283,7 @@ pub mod server {
pub
type
ping
=
::
pipes
::
recv_packet
<
pingpong
::
ping
>
;
pub
type
pong
=
::
pipes
::
send_packet
<
pingpong
::
pong
>
;
pub
fn
do_ping
(
-
c
:
ping
)
->
(
pong
,
())
{
pub
fn
do_ping
(
+
c
:
ping
)
->
(
pong
,
())
{
let
packet
=
::
pipes
::
recv
(
c
);
if
packet
.is_none
()
{
fail
!
(
~
"sender closed the connection"
)
...
...
@@ -291,7 +291,7 @@ pub fn do_ping(-c: ping) -> (pong, ()) {
(
pingpong
::
liberate_ping
(
option
::
unwrap
(
packet
)),
())
}
pub
fn
do_pong
(
-
c
:
pong
)
->
ping
{
pub
fn
do_pong
(
+
c
:
pong
)
->
ping
{
let
(
sp
,
rp
)
=
::
pipes
::
entangle
();
::
pipes
::
send
(
c
,
pingpong
::
pong
(
sp
));
rp
...
...
@@ -299,14 +299,14 @@ pub fn do_pong(-c: pong) -> ping {
}
}
fn
client
(
-
chan
:
pingpong
::
client
::
ping
)
{
fn
client
(
+
chan
:
pingpong
::
client
::
ping
)
{
let
chan
=
pingpong
::
client
::
do_ping
(
chan
);
error!
(
~
"Sent ping"
);
let
(
_
chan
,
_
data
)
=
pingpong
::
client
::
do_pong
(
chan
);
error!
(
~
"Received pong"
);
}
fn
server
(
-
chan
:
pingpong
::
server
::
ping
)
{
fn
server
(
+
chan
:
pingpong
::
server
::
ping
)
{
let
(
chan
,
_
data
)
=
pingpong
::
server
::
do_ping
(
chan
);
error!
(
~
"Received ping"
);
let
_
chan
=
pingpong
::
server
::
do_pong
(
chan
);
...
...
src/test/run-pass/liveness-move-in-loop.rs
浏览文件 @
852619d5
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
take
(
-
x
:
int
)
->
int
{
x
}
fn
take
(
+
x
:
int
)
->
int
{
x
}
fn
the_loop
()
{
let
mut
list
=
~
[];
...
...
src/test/run-pass/move-arg-2-unique.rs
浏览文件 @
852619d5
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
test
(
-
foo
:
~~
[
int
])
{
fail_unless!
((
foo
[
0
]
==
10
));
}
fn
test
(
+
foo
:
~~
[
int
])
{
fail_unless!
((
foo
[
0
]
==
10
));
}
pub
fn
main
()
{
let
x
=
~~
[
10
];
...
...
src/test/run-pass/move-arg-2.rs
浏览文件 @
852619d5
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
test
(
-
foo
:
@~
[
int
])
{
fail_unless!
((
foo
[
0
]
==
10
));
}
fn
test
(
+
foo
:
@~
[
int
])
{
fail_unless!
((
foo
[
0
]
==
10
));
}
pub
fn
main
()
{
let
x
=
@~
[
10
];
...
...
src/test/run-pass/move-arg.rs
浏览文件 @
852619d5
...
...
@@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
test
(
-
foo
:
int
)
{
fail_unless!
((
foo
==
10
));
}
fn
test
(
+
foo
:
int
)
{
fail_unless!
((
foo
==
10
));
}
pub
fn
main
()
{
let
x
=
10
;
test
(
x
);
}
src/test/run-pass/move-nullary-fn.rs
浏览文件 @
852619d5
...
...
@@ -9,9 +9,9 @@
// except according to those terms.
// Issue #922
fn
f2
(
-
thing
:
@
fn
())
{
}
fn
f2
(
+
thing
:
@
fn
())
{
}
fn
f
(
-
thing
:
@
fn
())
{
fn
f
(
+
thing
:
@
fn
())
{
f2
(
thing
);
}
...
...
src/test/run-pass/pipe-bank-proto.rs
浏览文件 @
852619d5
...
...
@@ -53,7 +53,7 @@ fn switch<T:Owned,U>(+endp: pipes::RecvPacket<T>,
f
(
pipes
::
try_recv
(
endp
))
}
fn
move_it
<
T
>
(
-
x
:
T
)
->
T
{
x
}
fn
move_it
<
T
>
(
+
x
:
T
)
->
T
{
x
}
macro_rules!
follow
(
{
...
...
src/test/run-pass/pipe-pingpong-bounded.rs
浏览文件 @
852619d5
...
...
@@ -91,7 +91,7 @@ mod test {
use
core
::
pipes
::
recv
;
use
pingpong
::{
ping
,
pong
};
pub
fn
client
(
-
chan
:
::
pingpong
::
client
::
ping
)
{
pub
fn
client
(
+
chan
:
::
pingpong
::
client
::
ping
)
{
use
pingpong
::
client
;
let
chan
=
client
::
ping
(
chan
);
return
;
...
...
@@ -100,7 +100,7 @@ pub fn client(-chan: ::pingpong::client::ping) {
error!
(
"Received pong"
);
}
pub
fn
server
(
-
chan
:
::
pingpong
::
server
::
ping
)
{
pub
fn
server
(
+
chan
:
::
pingpong
::
server
::
ping
)
{
use
pingpong
::
server
;
let
ping
(
chan
)
=
recv
(
chan
);
return
;
...
...
src/test/run-pass/pipe-pingpong-proto.rs
浏览文件 @
852619d5
...
...
@@ -29,7 +29,7 @@ mod test {
use
core
::
pipes
::
recv
;
use
pingpong
::{
ping
,
pong
};
pub
fn
client
(
-
chan
:
::
pingpong
::
client
::
ping
)
{
pub
fn
client
(
+
chan
:
::
pingpong
::
client
::
ping
)
{
use
pingpong
::
client
;
let
chan
=
client
::
ping
(
chan
);
...
...
@@ -38,7 +38,7 @@ pub fn client(-chan: ::pingpong::client::ping) {
error!
(
~
"Received pong"
);
}
pub
fn
server
(
-
chan
:
::
pingpong
::
server
::
ping
)
{
pub
fn
server
(
+
chan
:
::
pingpong
::
server
::
ping
)
{
use
pingpong
::
server
;
let
ping
(
chan
)
=
recv
(
chan
);
...
...
src/test/run-pass/unique-fn-arg-move.rs
浏览文件 @
852619d5
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
f
(
-
i
:
~
int
)
{
fn
f
(
+
i
:
~
int
)
{
fail_unless!
(
*
i
==
100
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录