Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f4a27b2c
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
f4a27b2c
编写于
2月 02, 2013
作者:
D
Daniel Micay
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
oldmap: get rid of the legacy contains_key method
上级
319eeb1c
变更
41
隐藏空白更改
内联
并排
Showing
41 changed file
with
86 addition
and
87 deletion
+86
-87
src/libcargo/cargo.rc
src/libcargo/cargo.rc
+2
-2
src/librustc/metadata/cstore.rs
src/librustc/metadata/cstore.rs
+1
-1
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+1
-1
src/librustc/middle/borrowck/check_loans.rs
src/librustc/middle/borrowck/check_loans.rs
+3
-3
src/librustc/middle/borrowck/gather_loans.rs
src/librustc/middle/borrowck/gather_loans.rs
+2
-2
src/librustc/middle/borrowck/preserve.rs
src/librustc/middle/borrowck/preserve.rs
+1
-1
src/librustc/middle/check_const.rs
src/librustc/middle/check_const.rs
+1
-1
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+4
-4
src/librustc/middle/freevars.rs
src/librustc/middle/freevars.rs
+1
-1
src/librustc/middle/mem_categorization.rs
src/librustc/middle/mem_categorization.rs
+3
-3
src/librustc/middle/moves.rs
src/librustc/middle/moves.rs
+2
-2
src/librustc/middle/region.rs
src/librustc/middle/region.rs
+1
-1
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+14
-10
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
+4
-6
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/callee.rs
+6
-5
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/consts.rs
+1
-1
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/trans/controlflow.rs
+1
-2
src/librustc/middle/trans/datum.rs
src/librustc/middle/trans/datum.rs
+1
-1
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/debuginfo.rs
+2
-2
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/expr.rs
+3
-3
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/glue.rs
+1
-1
src/librustc/middle/trans/machine.rs
src/librustc/middle/trans/machine.rs
+1
-1
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/meth.rs
+1
-1
src/librustc/middle/trans/reachable.rs
src/librustc/middle/trans/reachable.rs
+2
-2
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/reflect.rs
+1
-1
src/librustc/middle/trans/type_of.rs
src/librustc/middle/trans/type_of.rs
+1
-1
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+3
-3
src/librustc/middle/typeck/check/_match.rs
src/librustc/middle/typeck/check/_match.rs
+1
-1
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/method.rs
+3
-2
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+2
-2
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/regionck.rs
+2
-2
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/check/vtable.rs
+1
-1
src/librustc/middle/typeck/check/writeback.rs
src/librustc/middle/typeck/check/writeback.rs
+1
-1
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/coherence.rs
+2
-2
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/collect.rs
+1
-1
src/libstd/oldmap.rs
src/libstd/oldmap.rs
+4
-8
src/libsyntax/attr.rs
src/libsyntax/attr.rs
+1
-1
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_parser.rs
+1
-1
src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/obsolete.rs
+1
-1
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-mandelbrot.rs
+1
-1
未找到文件。
src/libcargo/cargo.rc
浏览文件 @
f4a27b2c
...
...
@@ -1706,7 +1706,7 @@ pub fn cmd_sources(c: &Cargo) {
return;
}
if c.sources.contains_key
(
name) {
if c.sources.contains_key
_ref(&
name) {
error(fmt!("source already exists: %s", name));
} else {
c.sources.insert(name, @Source {
...
...
@@ -1733,7 +1733,7 @@ pub fn cmd_sources(c: &Cargo) {
return;
}
if c.sources.contains_key
(
name) {
if c.sources.contains_key
_ref(&
name) {
c.sources.remove(name);
info(fmt!("removed source: %s", name));
} else {
...
...
src/librustc/metadata/cstore.rs
浏览文件 @
f4a27b2c
...
...
@@ -94,7 +94,7 @@ pub fn set_crate_data(cstore: CStore,
}
pub
fn
have_crate_data
(
cstore
:
CStore
,
cnum
:
ast
::
crate_num
)
->
bool
{
return
p
(
cstore
)
.metas
.contains_key
(
cnum
);
return
p
(
cstore
)
.metas
.contains_key
_ref
(
&
cnum
);
}
pub
fn
iter_crate_data
(
cstore
:
CStore
,
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
f4a27b2c
...
...
@@ -99,7 +99,7 @@ pub enum encode_ctxt = {
};
pub
fn
reachable
(
ecx
:
@
encode_ctxt
,
id
:
node_id
)
->
bool
{
ecx
.reachable
.contains_key
(
id
)
ecx
.reachable
.contains_key
_ref
(
&
id
)
}
fn
encode_name
(
ecx
:
@
encode_ctxt
,
ebml_w
:
writer
::
Encoder
,
name
:
ident
)
{
...
...
src/librustc/middle/borrowck/check_loans.rs
浏览文件 @
f4a27b2c
...
...
@@ -665,7 +665,7 @@ fn check_loans_in_expr(expr: @ast::expr,
self
.check_for_conflicting_loans
(
expr
.id
);
if
self
.bccx.moves_map
.contains_key
(
expr
.id
)
{
if
self
.bccx.moves_map
.contains_key
_ref
(
&
expr
.id
)
{
self
.check_move_out_from_expr
(
expr
);
}
...
...
@@ -686,7 +686,7 @@ fn check_loans_in_expr(expr: @ast::expr,
}
ast
::
expr_index
(
_
,
rval
)
|
ast
::
expr_binary
(
_
,
_
,
rval
)
if
self
.bccx.method_map
.contains_key
(
expr
.id
)
=>
{
if
self
.bccx.method_map
.contains_key
_ref
(
&
expr
.id
)
=>
{
self
.check_call
(
expr
,
None
,
expr
.callee_id
,
...
...
@@ -694,7 +694,7 @@ fn check_loans_in_expr(expr: @ast::expr,
~
[
rval
]);
}
ast
::
expr_unary
(
*
)
|
ast
::
expr_index
(
*
)
if
self
.bccx.method_map
.contains_key
(
expr
.id
)
=>
{
if
self
.bccx.method_map
.contains_key
_ref
(
&
expr
.id
)
=>
{
self
.check_call
(
expr
,
None
,
expr
.callee_id
,
...
...
src/librustc/middle/borrowck/gather_loans.rs
浏览文件 @
f4a27b2c
...
...
@@ -204,7 +204,7 @@ fn req_loans_in_expr(ex: @ast::expr,
ast
::
expr_binary
(
_
,
rcvr
,
_
)
|
ast
::
expr_unary
(
_
,
rcvr
)
|
ast
::
expr_assign_op
(
_
,
rcvr
,
_
)
if
self
.bccx.method_map
.contains_key
(
ex
.id
)
=>
{
if
self
.bccx.method_map
.contains_key
_ref
(
&
ex
.id
)
=>
{
// Receivers in method calls are always passed by ref.
//
// Here, in an overloaded operator, the call is this expression,
...
...
@@ -241,7 +241,7 @@ fn req_loans_in_expr(ex: @ast::expr,
// }
ast
::
expr_field
(
rcvr
,
_
,
_
)
if
self
.bccx.method_map
.contains_key
(
ex
.id
)
=>
{
if
self
.bccx.method_map
.contains_key
_ref
(
&
ex
.id
)
=>
{
// Receivers in method calls are always passed by ref.
//
// Here, the field a.b is in fact a closure. Eventually, this
...
...
src/librustc/middle/borrowck/preserve.rs
浏览文件 @
f4a27b2c
...
...
@@ -375,7 +375,7 @@ fn attempt_root(&self, cmt: cmt, base: cmt,
// scope_id;`. Though that would potentially re-introduce
// the ICE. See #3511 for more details.
let
scope_to_use
=
if
self
.bccx.stmt_map
.contains_key
(
scope_id
)
{
self
.bccx.stmt_map
.contains_key
_ref
(
&
scope_id
)
{
// Root it in its parent scope, b/c
// trans won't introduce a new scope for the
// stmt
...
...
src/librustc/middle/check_const.rs
浏览文件 @
f4a27b2c
...
...
@@ -102,7 +102,7 @@ pub fn check_expr(sess: Session,
}
expr_lit
(
@
codemap
::
spanned
{
node
:
lit_str
(
_
),
_
})
=>
{
}
expr_binary
(
_
,
_
,
_
)
|
expr_unary
(
_
,
_
)
=>
{
if
method_map
.contains_key
(
e
.id
)
{
if
method_map
.contains_key
_ref
(
&
e
.id
)
{
sess
.span_err
(
e
.span
,
~
"user-defined operators are not
\
allowed in constant expressions"
);
}
...
...
src/librustc/middle/check_match.rs
浏览文件 @
f4a27b2c
...
...
@@ -59,7 +59,7 @@ pub fn expr_is_non_moving_lvalue(cx: @MatchCheckCtxt, expr: @expr) -> bool {
return
false
;
}
!
cx
.moves_map
.contains_key
(
expr
.id
)
!
cx
.moves_map
.contains_key
_ref
(
&
expr
.id
)
}
pub
fn
check_expr
(
cx
:
@
MatchCheckCtxt
,
ex
:
@
expr
,
&&
s
:
(),
v
:
visit
::
vt
<
()
>
)
{
...
...
@@ -734,7 +734,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
by_ref_span
=
Some
(
span
);
}
bind_infer
=>
{
if
cx
.moves_map
.contains_key
(
id
)
{
if
cx
.moves_map
.contains_key
_ref
(
&
id
)
{
any_by_move
=
true
;
}
}
...
...
@@ -774,7 +774,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
if
pat_is_binding
(
def_map
,
p
)
{
match
p
.node
{
pat_ident
(
_
,
_
,
sub
)
=>
{
if
cx
.moves_map
.contains_key
(
p
.id
)
{
if
cx
.moves_map
.contains_key
_ref
(
&
p
.id
)
{
check_move
(
p
,
sub
);
}
}
...
...
@@ -800,7 +800,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
behind_bad_pointer
);
if
behind_bad_pointer
&&
cx
.moves_map
.contains_key
(
pat
.id
)
cx
.moves_map
.contains_key
_ref
(
&
pat
.id
)
{
cx
.tcx.sess
.span_err
(
pat
.span
,
...
...
src/librustc/middle/freevars.rs
浏览文件 @
f4a27b2c
...
...
@@ -71,7 +71,7 @@ fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
}
if
i
==
depth
{
// Made it to end of loop
let
dnum
=
ast_util
::
def_id_of_def
(
def
)
.node
;
if
!
seen
.contains_key
(
dnum
)
{
if
!
seen
.contains_key
_ref
(
&
dnum
)
{
refs
.push
(
@
freevar_entry
{
def
:
def
,
span
:
expr
.span
,
...
...
src/librustc/middle/mem_categorization.rs
浏览文件 @
f4a27b2c
...
...
@@ -348,7 +348,7 @@ fn cat_expr_unadjusted(expr: @ast::expr) -> cmt {
let
expr_ty
=
tcx
.ty
(
expr
);
match
expr
.node
{
ast
::
expr_unary
(
ast
::
deref
,
e_base
)
=>
{
if
self
.method_map
.contains_key
(
expr
.id
)
{
if
self
.method_map
.contains_key
_ref
(
&
expr
.id
)
{
return
self
.cat_rvalue
(
expr
,
expr_ty
);
}
...
...
@@ -357,7 +357,7 @@ fn cat_expr_unadjusted(expr: @ast::expr) -> cmt {
}
ast
::
expr_field
(
base
,
f_name
,
_
)
=>
{
if
self
.method_map
.contains_key
(
expr
.id
)
{
if
self
.method_map
.contains_key
_ref
(
&
expr
.id
)
{
return
self
.cat_method_ref
(
expr
,
expr_ty
);
}
...
...
@@ -366,7 +366,7 @@ fn cat_expr_unadjusted(expr: @ast::expr) -> cmt {
}
ast
::
expr_index
(
base
,
_
)
=>
{
if
self
.method_map
.contains_key
(
expr
.id
)
{
if
self
.method_map
.contains_key
_ref
(
&
expr
.id
)
{
return
self
.cat_rvalue
(
expr
,
expr_ty
);
}
...
...
src/librustc/middle/moves.rs
浏览文件 @
f4a27b2c
...
...
@@ -640,7 +640,7 @@ fn use_overloaded_operator(&self,
arg_exprs
:
&
[
@
expr
],
visitor
:
vt
<
VisitContext
>
)
->
bool
{
if
!
self
.method_map
.contains_key
(
expr
.id
)
{
if
!
self
.method_map
.contains_key
_ref
(
&
expr
.id
)
{
return
false
;
}
...
...
@@ -771,7 +771,7 @@ fn arms_have_by_move_bindings(&self,
for
arm
.pats.each
|
pat
|
{
let
mut
found
=
false
;
do
pat_bindings
(
self
.tcx.def_map
,
*
pat
)
|
_
,
node_id
,
_
,
_
|
{
if
moves_map
.contains_key
(
node_id
)
{
if
moves_map
.contains_key
_ref
(
&
node_id
)
{
found
=
true
;
}
}
...
...
src/librustc/middle/region.rs
浏览文件 @
f4a27b2c
...
...
@@ -296,7 +296,7 @@ pub fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
_
=>
{}
};
if
new_cx
.root_exprs
.contains_key
(
expr
.id
)
{
if
new_cx
.root_exprs
.contains_key
_ref
(
&
expr
.id
)
{
new_cx
.parent
=
Some
(
expr
.id
);
}
...
...
src/librustc/middle/resolve.rs
浏览文件 @
f4a27b2c
...
...
@@ -2211,7 +2211,7 @@ fn get_binding(import_resolution: @ImportResolution,
}
// We've successfully resolved the import. Write the results in.
assert
module_
.import_resolutions
.contains_key
(
target
);
assert
module_
.import_resolutions
.contains_key
_ref
(
&
target
);
let
import_resolution
=
module_
.import_resolutions
.get
(
target
);
match
value_result
{
...
...
@@ -2370,7 +2370,7 @@ fn resolve_single_module_import(module_: @Module,
}
// We've successfully resolved the import. Write the results in.
assert
module_
.import_resolutions
.contains_key
(
target
);
assert
module_
.import_resolutions
.contains_key
_ref
(
&
target
);
let
import_resolution
=
module_
.import_resolutions
.get
(
target
);
match
module_result
{
...
...
@@ -4090,7 +4090,7 @@ fn check_consistent_bindings(arm: arm) {
}
for
map_i
.each
|
key
,
binding
|
{
if
!
map_0
.contains_key
(
key
)
{
if
!
map_0
.contains_key
_ref
(
&
key
)
{
self
.session
.span_err
(
binding
.span
,
fmt!
(
"variable `%s` from pattern #%u is
\
...
...
@@ -4319,7 +4319,8 @@ struct in scope",
match
bindings_list
{
Some
(
bindings_list
)
if
!
bindings_list
.contains_key
(
ident
)
=>
{
if
!
bindings_list
.contains_key_ref
(
&
ident
)
=>
{
let
last_rib
=
(
*
self
.value_ribs
)
.last
();
last_rib
.bindings
.insert
(
ident
,
dl_def
(
def
));
...
...
@@ -4391,16 +4392,19 @@ struct in scope",
pat_struct
(
path
,
_
,
_
)
=>
{
match
self
.resolve_path
(
path
,
TypeNS
,
false
,
visitor
)
{
Some
(
def_ty
(
class_id
))
if
self
.structs
.contains_key
(
class_id
)
=>
{
if
self
.structs
.contains_key_ref
(
&
class_id
)
=>
{
let
class_def
=
def_struct
(
class_id
);
self
.record_def
(
pattern
.id
,
class_def
);
}
Some
(
definition
@
def_struct
(
class_id
))
if
self
.structs
.contains_key
(
class_id
)
=>
{
if
self
.structs
.contains_key_ref
(
&
class_id
)
=>
{
self
.record_def
(
pattern
.id
,
definition
);
}
Some
(
definition
@
def_variant
(
_
,
variant_id
))
if
self
.structs
.contains_key
(
variant_id
)
=>
{
if
self
.structs
.contains_key_ref
(
&
variant_id
)
=>
{
self
.record_def
(
pattern
.id
,
definition
);
}
result
=>
{
...
...
@@ -4848,12 +4852,12 @@ fn resolve_expr(expr: @expr, visitor: ResolveVisitor) {
match
self
.resolve_path
(
path
,
TypeNS
,
false
,
visitor
)
{
Some
(
def_ty
(
class_id
))
|
Some
(
def_struct
(
class_id
))
if
self
.structs
.contains_key
(
class_id
)
=>
{
if
self
.structs
.contains_key
_ref
(
&
class_id
)
=>
{
let
class_def
=
def_struct
(
class_id
);
self
.record_def
(
expr
.id
,
class_def
);
}
Some
(
definition
@
def_variant
(
_
,
class_id
))
if
self
.structs
.contains_key
(
class_id
)
=>
{
if
self
.structs
.contains_key
_ref
(
&
class_id
)
=>
{
self
.record_def
(
expr
.id
,
definition
);
}
_
=>
{
...
...
@@ -5073,7 +5077,7 @@ fn add_trait_info_if_containing_method(found_traits: @DVec<def_id>,
self
.session
.str_of
(
name
));
match
self
.trait_info
.find
(
trait_def_id
)
{
Some
(
trait_info
)
if
trait_info
.contains_key
(
name
)
=>
{
Some
(
trait_info
)
if
trait_info
.contains_key
_ref
(
&
name
)
=>
{
debug!
(
"(adding trait info if containing method) found trait
\
%d:%d for method '%s'"
,
trait_def_id
.crate
,
...
...
src/librustc/middle/trans/_match.rs
浏览文件 @
f4a27b2c
...
...
@@ -1586,7 +1586,7 @@ pub fn trans_match_inner(scope_cx: block,
// but during matching we need to store a *T as explained
// above
let
is_move
=
scope_cx
.ccx
()
.maps.moves_map
.contains_key
(
p_id
);
scope_cx
.ccx
()
.maps.moves_map
.contains_key
_ref
(
&
p_id
);
llmatch
=
alloca
(
bcx
,
T_ptr
(
llvariable_ty
));
trmode
=
TrByValue
(
is_move
,
alloca
(
bcx
,
llvariable_ty
));
}
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
f4a27b2c
...
...
@@ -169,8 +169,7 @@ pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
+
name
:
~
str
,
cc
:
lib
::
llvm
::
CallConv
,
ty
:
TypeRef
)
->
ValueRef
{
// XXX: Bad copy.
if
externs
.contains_key
(
copy
name
)
{
return
externs
.get
(
name
);
}
if
externs
.contains_key_ref
(
&
name
)
{
return
externs
.get
(
name
);
}
// XXX: Bad copy.
let
f
=
decl_fn
(
llmod
,
copy
name
,
cc
,
ty
);
externs
.insert
(
name
,
f
);
...
...
@@ -180,8 +179,7 @@ pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
pub
fn
get_extern_const
(
externs
:
HashMap
<~
str
,
ValueRef
>
,
llmod
:
ModuleRef
,
+
name
:
~
str
,
ty
:
TypeRef
)
->
ValueRef
{
unsafe
{
// XXX: Bad copy.
if
externs
.contains_key
(
copy
name
)
{
return
externs
.get
(
name
);
}
if
externs
.contains_key_ref
(
&
name
)
{
return
externs
.get
(
name
);
}
let
c
=
str
::
as_c_str
(
name
,
|
buf
|
{
llvm
::
LLVMAddGlobal
(
llmod
,
ty
,
buf
)
});
...
...
@@ -451,7 +449,7 @@ pub fn set_glue_inlining(f: ValueRef, t: ty::t) {
// silently mangles such symbols, breaking our linkage model.
pub
fn
note_unique_llvm_symbol
(
ccx
:
@
crate_ctxt
,
+
sym
:
~
str
)
{
// XXX: Bad copy.
if
ccx
.all_llvm_symbols
.contains_key
(
copy
sym
)
{
if
ccx
.all_llvm_symbols
.contains_key
_ref
(
&
sym
)
{
ccx
.sess
.bug
(
~
"duplicate LLVM symbol: "
+
sym
);
}
ccx
.all_llvm_symbols
.insert
(
sym
,
());
...
...
@@ -2485,7 +2483,7 @@ pub fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
ccx
.sess
.bug
(
~
"get_item_val(): unexpected variant"
)
}
};
if
!
(
exprt
||
ccx
.reachable
.contains_key
(
id
))
{
if
!
(
exprt
||
ccx
.reachable
.contains_key
_ref
(
&
id
))
{
lib
::
llvm
::
SetLinkage
(
val
,
lib
::
llvm
::
InternalLinkage
);
}
ccx
.item_vals
.insert
(
id
,
val
);
...
...
src/librustc/middle/trans/callee.rs
浏览文件 @
f4a27b2c
...
...
@@ -672,7 +672,8 @@ pub fn trans_arg_expr(bcx: block,
// FIXME(#3548) use the adjustments table
match
autoref_arg
{
DoAutorefArg
=>
{
assert
!
bcx
.ccx
()
.maps.moves_map
.contains_key
(
arg_expr
.id
);
assert
!
bcx
.ccx
()
.maps.moves_map
.contains_key_ref
(
&
arg_expr
.id
);
val
=
arg_datum
.to_ref_llval
(
bcx
);
}
DontAutorefArg
=>
{
...
...
@@ -682,16 +683,16 @@ pub fn trans_arg_expr(bcx: block,
// the explicit self code currently passes by-ref, it
// does not hold.
//
//assert !bcx.ccx().maps.moves_map.contains_key(
// arg_expr.id);
//assert !bcx.ccx().maps.moves_map.contains_key
_ref
(
//
&
arg_expr.id);
val
=
arg_datum
.to_ref_llval
(
bcx
);
}
ast
::
by_val
=>
{
// NB: avoid running the take glue.
assert
!
bcx
.ccx
()
.maps.moves_map
.contains_key
(
arg_expr
.id
);
assert
!
bcx
.ccx
()
.maps.moves_map
.contains_key
_ref
(
&
arg_expr
.id
);
val
=
arg_datum
.to_value_llval
(
bcx
);
}
...
...
src/librustc/middle/trans/consts.rs
浏览文件 @
f4a27b2c
...
...
@@ -126,7 +126,7 @@ pub fn get_const_val(cx: @crate_ctxt, def_id: ast::def_id) -> ValueRef {
if
!
ast_util
::
is_local
(
def_id
)
{
cx
.tcx.sess
.bug
(
~
"cross-crate constants"
);
}
if
!
cx
.const_values
.contains_key
(
def_id
.node
)
{
if
!
cx
.const_values
.contains_key
_ref
(
&
def_id
.node
)
{
match
cx
.tcx.items
.get
(
def_id
.node
)
{
ast_map
::
node_item
(
@
ast
::
item
{
node
:
ast
::
item_const
(
_
,
subexpr
),
_
...
...
src/librustc/middle/trans/controlflow.rs
浏览文件 @
f4a27b2c
...
...
@@ -183,8 +183,7 @@ pub fn trans_log(log_ex: @ast::expr,
// XXX: Bad copy.
let
modname
=
path_str
(
ccx
.sess
,
copy
modpath
);
// XXX: Bad copy.
let
global
=
if
ccx
.module_data
.contains_key
(
copy
modname
)
{
let
global
=
if
ccx
.module_data
.contains_key_ref
(
&
modname
)
{
ccx
.module_data
.get
(
modname
)
}
else
{
let
s
=
link
::
mangle_internal_name_by_path_and_seq
(
...
...
src/librustc/middle/trans/datum.rs
浏览文件 @
f4a27b2c
...
...
@@ -223,7 +223,7 @@ fn store_to(bcx: block, id: ast::node_id,
* `id` is located in the move table, but copies otherwise.
*/
if
bcx
.ccx
()
.maps.moves_map
.contains_key
(
id
)
{
if
bcx
.ccx
()
.maps.moves_map
.contains_key
_ref
(
&
id
)
{
self
.move_to
(
bcx
,
action
,
dst
)
}
else
{
self
.copy_to
(
bcx
,
action
,
dst
)
...
...
src/librustc/middle/trans/debuginfo.rs
浏览文件 @
f4a27b2c
...
...
@@ -117,7 +117,7 @@ pub fn mk_ctxt(+crate: ~str, intr: @ident_interner) -> debug_ctxt {
}
fn
update_cache
(
cache
:
metadata_cache
,
mdtag
:
int
,
val
:
debug_metadata
)
{
let
existing
=
if
cache
.contains_key
(
mdtag
)
{
let
existing
=
if
cache
.contains_key
_ref
(
&
mdtag
)
{
cache
.get
(
mdtag
)
}
else
{
~
[]
...
...
@@ -176,7 +176,7 @@ fn cached_metadata<T: Copy>(cache: metadata_cache,
eq_fn
:
fn
(
md
:
T
)
->
bool
)
->
Option
<
T
>
{
unsafe
{
if
cache
.contains_key
(
mdtag
)
{
if
cache
.contains_key
_ref
(
&
mdtag
)
{
let
items
=
cache
.get
(
mdtag
);
for
items
.each
|
item
|
{
let
md
:
T
=
md_from_metadata
::
<
T
>
(
*
item
);
...
...
src/librustc/middle/trans/expr.rs
浏览文件 @
f4a27b2c
...
...
@@ -265,7 +265,7 @@ fn auto_slice_and_ref(bcx: block, datum: Datum) -> DatumBlock {
}
pub
fn
trans_into
(
bcx
:
block
,
expr
:
@
ast
::
expr
,
dest
:
Dest
)
->
block
{
if
bcx
.tcx
()
.adjustments
.contains_key
(
expr
.id
)
{
if
bcx
.tcx
()
.adjustments
.contains_key
_ref
(
&
expr
.id
)
{
// use trans_to_datum, which is mildly less efficient but
// which will perform the adjustments:
let
datumblock
=
trans_to_datum
(
bcx
,
expr
);
...
...
@@ -426,7 +426,7 @@ fn trans_rvalue_datum_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
}
ast
::
expr_binary
(
op
,
lhs
,
rhs
)
=>
{
// if overloaded, would be RvalueDpsExpr
assert
!
bcx
.ccx
()
.maps.method_map
.contains_key
(
expr
.id
);
assert
!
bcx
.ccx
()
.maps.method_map
.contains_key
_ref
(
&
expr
.id
);
return
trans_binary
(
bcx
,
expr
,
op
,
lhs
,
rhs
);
}
...
...
@@ -1243,7 +1243,7 @@ fn trans_unary_datum(bcx: block,
assert
op
!=
ast
::
deref
;
// if overloaded, would be RvalueDpsExpr
assert
!
bcx
.ccx
()
.maps.method_map
.contains_key
(
un_expr
.id
);
assert
!
bcx
.ccx
()
.maps.method_map
.contains_key
_ref
(
&
un_expr
.id
);
let
un_ty
=
expr_ty
(
bcx
,
un_expr
);
let
sub_ty
=
expr_ty
(
bcx
,
sub_expr
);
...
...
src/librustc/middle/trans/glue.rs
浏览文件 @
f4a27b2c
...
...
@@ -380,7 +380,7 @@ pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
let
_
icx
=
bcx
.insn_ctxt
(
"make_visit_glue"
);
let
mut
bcx
=
bcx
;
let
ty_visitor_name
=
special_idents
::
ty_visitor
;
assert
bcx
.ccx
()
.tcx.intrinsic_defs
.contains_key
(
ty_visitor_name
);
assert
bcx
.ccx
()
.tcx.intrinsic_defs
.contains_key
_ref
(
&
ty_visitor_name
);
let
(
trait_id
,
ty
)
=
bcx
.ccx
()
.tcx.intrinsic_defs
.get
(
ty_visitor_name
);
let
v
=
PointerCast
(
bcx
,
v
,
T_ptr
(
type_of
::
type_of
(
bcx
.ccx
(),
ty
)));
bcx
=
reflect
::
emit_calls_to_trait_visit_ty
(
bcx
,
t
,
v
,
trait_id
);
...
...
src/librustc/middle/trans/machine.rs
浏览文件 @
f4a27b2c
...
...
@@ -178,7 +178,7 @@ pub fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
// Computes the size of the data part of an enum.
pub
fn
static_size_of_enum
(
cx
:
@
crate_ctxt
,
t
:
ty
::
t
)
->
uint
{
if
cx
.enum_sizes
.contains_key
(
t
)
{
return
cx
.enum_sizes
.get
(
t
);
}
if
cx
.enum_sizes
.contains_key
_ref
(
&
t
)
{
return
cx
.enum_sizes
.get
(
t
);
}
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_enum
(
tid
,
ref
substs
)
=>
{
// Compute max(variant sizes).
...
...
src/librustc/middle/trans/meth.rs
浏览文件 @
f4a27b2c
...
...
@@ -871,7 +871,7 @@ pub fn trans_trait_cast(bcx: block,
match
vstore
{
ty
::
vstore_slice
(
*
)
|
ty
::
vstore_box
=>
{
let
mut
llboxdest
=
GEPi
(
bcx
,
lldest
,
[
0u
,
1u
]);
if
bcx
.tcx
()
.legacy_boxed_traits
.contains_key
(
id
)
{
if
bcx
.tcx
()
.legacy_boxed_traits
.contains_key
_ref
(
&
id
)
{
// Allocate an @ box and store the value into it
let
{
bcx
:
new_bcx
,
box
:
llbox
,
body
:
body
}
=
malloc_boxed
(
bcx
,
v_ty
);
...
...
src/librustc/middle/trans/reachable.rs
浏览文件 @
f4a27b2c
...
...
@@ -95,7 +95,7 @@ fn traverse_public_mod(cx: ctx, mod_id: node_id, m: _mod) {
}
fn
traverse_public_item
(
cx
:
ctx
,
item
:
@
item
)
{
if
cx
.rmap
.contains_key
(
item
.id
)
{
return
;
}
if
cx
.rmap
.contains_key
_ref
(
&
item
.id
)
{
return
;
}
cx
.rmap
.insert
(
item
.id
,
());
match
/*bad*/
copy
item
.node
{
item_mod
(
m
)
=>
traverse_public_mod
(
cx
,
item
.id
,
m
),
...
...
@@ -145,7 +145,7 @@ fn mk_ty_visitor() -> visit::vt<ctx> {
}
fn
traverse_ty
(
ty
:
@
Ty
,
cx
:
ctx
,
v
:
visit
::
vt
<
ctx
>
)
{
if
cx
.rmap
.contains_key
(
ty
.id
)
{
return
;
}
if
cx
.rmap
.contains_key
_ref
(
&
ty
.id
)
{
return
;
}
cx
.rmap
.insert
(
ty
.id
,
());
match
ty
.node
{
...
...
src/librustc/middle/trans/reflect.rs
浏览文件 @
f4a27b2c
...
...
@@ -316,7 +316,7 @@ pub fn emit_calls_to_trait_visit_ty(bcx: block,
->
block
{
use
syntax
::
parse
::
token
::
special_idents
::
tydesc
;
let
final
=
sub_block
(
bcx
,
~
"final"
);
assert
bcx
.ccx
()
.tcx.intrinsic_defs
.contains_key
(
tydesc
);
assert
bcx
.ccx
()
.tcx.intrinsic_defs
.contains_key
_ref
(
&
tydesc
);
let
(
_
,
tydesc_ty
)
=
bcx
.ccx
()
.tcx.intrinsic_defs
.get
(
tydesc
);
let
tydesc_ty
=
type_of
::
type_of
(
bcx
.ccx
(),
tydesc_ty
);
let
r
=
reflector
({
...
...
src/librustc/middle/trans/type_of.rs
浏览文件 @
f4a27b2c
...
...
@@ -87,7 +87,7 @@ pub fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
debug!
(
"type_of %?: %?"
,
t
,
ty
::
get
(
t
));
// Check the cache.
if
cx
.lltypes
.contains_key
(
t
)
{
return
cx
.lltypes
.get
(
t
);
}
if
cx
.lltypes
.contains_key
_ref
(
&
t
)
{
return
cx
.lltypes
.get
(
t
);
}
// Replace any typedef'd types with their equivalent non-typedef
// type. This ensures that all LLVM nominal types that contain
...
...
src/librustc/middle/ty.rs
浏览文件 @
f4a27b2c
...
...
@@ -2817,7 +2817,7 @@ pub fn node_id_to_type_params(cx: ctxt, id: ast::node_id) -> ~[t] {
}
fn
node_id_has_type_params
(
cx
:
ctxt
,
id
:
ast
::
node_id
)
->
bool
{
return
cx
.node_type_substs
.contains_key
(
id
);
return
cx
.node_type_substs
.contains_key
_ref
(
&
id
);
}
// Type accessors for substructures of types
...
...
@@ -3114,7 +3114,7 @@ pub enum ExprKind {
pub
fn
expr_kind
(
tcx
:
ctxt
,
method_map
:
typeck
::
method_map
,
expr
:
@
ast
::
expr
)
->
ExprKind
{
if
method_map
.contains_key
(
expr
.id
)
{
if
method_map
.contains_key
_ref
(
&
expr
.id
)
{
// Overloaded operations are generally calls, and hence they are
// generated via DPS. However, assign_op (e.g., `x += y`) is an
// exception, as its result is always unit.
...
...
@@ -4368,7 +4368,7 @@ pub fn iter_bound_traits_and_supertraits(tcx: ctxt,
let
super_t
=
supertrait
.tpt.ty
;
let
d_id
=
ty_to_def_id
(
super_t
)
.expect
(
"supertrait
\
should be a trait ty"
);
if
!
supertrait_map
.contains_key
(
d_id
)
{
if
!
supertrait_map
.contains_key
_ref
(
&
d_id
)
{
supertrait_map
.insert
(
d_id
,
super_t
);
trait_ty
=
super_t
;
seen_def_ids
.push
(
d_id
);
...
...
src/librustc/middle/typeck/check/_match.rs
浏览文件 @
f4a27b2c
...
...
@@ -239,7 +239,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
// Report an error if not all the fields were specified.
if
!
etc
{
for
class_fields
.eachi
|
i
,
field
|
{
if
found_fields
.contains_key
(
i
)
{
if
found_fields
.contains_key
_ref
(
&
i
)
{
loop
;
}
tcx
.sess
.span_err
(
span
,
...
...
src/librustc/middle/typeck/check/method.rs
浏览文件 @
f4a27b2c
...
...
@@ -1171,11 +1171,12 @@ fn enforce_drop_trait_limitations(&self, candidate: &Candidate) {
match
candidate
.origin
{
method_static
(
method_id
)
|
method_self
(
method_id
,
_
)
|
method_super
(
method_id
,
_
)
=>
{
bad
=
self
.tcx
()
.destructors
.contains_key
(
method_id
);
bad
=
self
.tcx
()
.destructors
.contains_key
_ref
(
&
method_id
);
}
method_param
(
method_param
{
trait_id
:
trait_id
,
_
})
|
method_trait
(
trait_id
,
_
,
_
)
=>
{
bad
=
self
.tcx
()
.destructor_for_type
.contains_key
(
trait_id
);
bad
=
self
.tcx
()
.destructor_for_type
.contains_key_ref
(
&
trait_id
);
}
}
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
f4a27b2c
...
...
@@ -3078,8 +3078,8 @@ fn arg(m: ast::rmode, ty: ty::t) -> ty::arg {
~
"visit_tydesc"
=>
{
let
tydesc_name
=
special_idents
::
tydesc
;
let
ty_visitor_name
=
tcx
.sess
.ident_of
(
~
"TyVisitor"
);
assert
tcx
.intrinsic_defs
.contains_key
(
tydesc_name
);
assert
ccx
.tcx.intrinsic_defs
.contains_key
(
ty_visitor_name
);
assert
tcx
.intrinsic_defs
.contains_key
_ref
(
&
tydesc_name
);
assert
ccx
.tcx.intrinsic_defs
.contains_key
_ref
(
&
ty_visitor_name
);
let
(
_
,
tydesc_ty
)
=
tcx
.intrinsic_defs
.get
(
tydesc_name
);
let
(
_
,
visitor_trait
)
=
tcx
.intrinsic_defs
.get
(
ty_visitor_name
);
let
td_ptr
=
ty
::
mk_ptr
(
ccx
.tcx
,
ty
::
mt
{
ty
:
tydesc_ty
,
...
...
src/librustc/middle/typeck/check/regionck.rs
浏览文件 @
f4a27b2c
...
...
@@ -211,7 +211,7 @@ pub fn visit_expr(expr: @ast::expr, &&rcx: @rcx, v: rvt) {
// `constrain_auto_ref()` on all exprs. But that causes a
// lot of spurious errors because of how the region
// hierarchy is setup.
if
rcx
.fcx.ccx.method_map
.contains_key
(
callee
.id
)
{
if
rcx
.fcx.ccx.method_map
.contains_key
_ref
(
&
callee
.id
)
{
match
callee
.node
{
ast
::
expr_field
(
base
,
_
,
_
)
=>
{
constrain_auto_ref
(
rcx
,
base
);
...
...
@@ -750,7 +750,7 @@ fn categorize_unadjusted(rcx: @rcx,
let
_
i
=
::
util
::
common
::
indenter
();
let
guarantor
=
{
if
rcx
.fcx.ccx.method_map
.contains_key
(
expr
.id
)
{
if
rcx
.fcx.ccx.method_map
.contains_key
_ref
(
&
expr
.id
)
{
None
}
else
{
guarantor
(
rcx
,
expr
)
...
...
src/librustc/middle/typeck/check/vtable.rs
浏览文件 @
f4a27b2c
...
...
@@ -268,7 +268,7 @@ pub fn lookup_vtable(vcx: &VtableContext,
// im is one specific impl of trait_ty.
// First, ensure we haven't processed this impl yet.
if
impls_seen
.contains_key
(
im
.did
)
{
if
impls_seen
.contains_key
_ref
(
&
im
.did
)
{
loop
;
}
impls_seen
.insert
(
im
.did
,
());
...
...
src/librustc/middle/typeck/check/writeback.rs
浏览文件 @
f4a27b2c
...
...
@@ -141,7 +141,7 @@ fn maybe_resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span,
id
:
ast
::
node_id
)
->
Option
<
ty
::
t
>
{
if
wbcx
.fcx.inh.node_types
.contains_key
(
id
)
{
if
wbcx
.fcx.inh.node_types
.contains_key
_ref
(
&
id
)
{
resolve_type_vars_for_node
(
wbcx
,
sp
,
id
)
}
else
{
None
...
...
src/librustc/middle/typeck/coherence.rs
浏览文件 @
f4a27b2c
...
...
@@ -502,7 +502,7 @@ fn each_provided_trait_method(
}
for
ty
::
trait_methods
(
tcx
,
trait_did
)
.each
|
method
|
{
if
provided_method_idents
.contains_key
(
method
.ident
)
{
if
provided_method_idents
.contains_key
_ref
(
&
method
.ident
)
{
if
!
f
(
method
)
{
break
;
}
...
...
@@ -912,7 +912,7 @@ fn add_default_methods_for_external_trait(trait_def_id: ast::def_id) {
let
tcx
=
self
.crate_context.tcx
;
let
pmm
=
tcx
.provided_methods
;
if
pmm
.contains_key
(
trait_def_id
)
{
return
;
}
if
pmm
.contains_key
_ref
(
&
trait_def_id
)
{
return
;
}
debug!
(
"(adding default methods for trait) processing trait"
);
...
...
src/librustc/middle/typeck/collect.rs
浏览文件 @
f4a27b2c
...
...
@@ -326,7 +326,7 @@ pub fn ensure_supertraits(ccx: @crate_ctxt,
rp
:
Option
<
ty
::
region_variance
>
,
trait_refs
:
&
[
@
ast
::
trait_ref
])
{
let
tcx
=
ccx
.tcx
;
if
tcx
.supertraits
.contains_key
(
local_def
(
id
))
{
return
;
}
if
tcx
.supertraits
.contains_key
_ref
(
&
local_def
(
id
))
{
return
;
}
let
instantiated
=
dvec
::
DVec
();
for
trait_refs
.each
|
trait_ref
|
{
...
...
src/libstd/oldmap.rs
浏览文件 @
f4a27b2c
...
...
@@ -164,10 +164,6 @@ fn rehash() {
impl
<
K
:
Eq
IterBytes
Hash
Copy
,
V
:
Copy
>
T
<
K
,
V
>
{
pure
fn
size
()
->
uint
{
self
.count
}
pure
fn
contains_key
(
k
:
K
)
->
bool
{
self
.contains_key_ref
(
&
k
)
}
pure
fn
contains_key_ref
(
k
:
&
K
)
->
bool
{
let
hash
=
k
.hash_keyed
(
0
,
0
)
as
uint
;
match
self
.search_tbl
(
k
,
hash
)
{
...
...
@@ -638,9 +634,9 @@ fn test_removal() {
fn
test_contains_key
()
{
let
key
=
~
"k"
;
let
map
=
HashMap
::
<~
str
,
~
str
>
();
assert
(
!
map
.contains_key
(
key
));
assert
(
!
map
.contains_key
_ref
(
&
key
));
map
.insert
(
key
,
~
"val"
);
assert
(
map
.contains_key
(
key
));
assert
(
map
.contains_key
_ref
(
&
key
));
}
#[test]
...
...
@@ -658,10 +654,10 @@ fn test_clear() {
let
map
=
HashMap
::
<~
str
,
~
str
>
();
map
.insert
(
key
,
~
"val"
);
assert
(
map
.size
()
==
1
);
assert
(
map
.contains_key
(
key
));
assert
(
map
.contains_key
_ref
(
&
key
));
map
.clear
();
assert
(
map
.size
()
==
0
);
assert
(
!
map
.contains_key
(
key
));
assert
(
!
map
.contains_key
_ref
(
&
key
));
}
#[test]
...
...
src/libsyntax/attr.rs
浏览文件 @
f4a27b2c
...
...
@@ -363,7 +363,7 @@ pub fn require_unique_names(diagnostic: span_handler,
let
name
=
get_meta_item_name
(
*
meta
);
// FIXME: How do I silence the warnings? --pcw (#2619)
if
map
.contains_key
(
name
)
{
if
map
.contains_key
_ref
(
&
name
)
{
diagnostic
.span_fatal
(
meta
.span
,
fmt!
(
"duplicate meta item `%s`"
,
name
));
}
...
...
src/libsyntax/ext/tt/macro_parser.rs
浏览文件 @
f4a27b2c
...
...
@@ -197,7 +197,7 @@ fn n_rec(p_s: parse_sess, m: matcher, res: ~[@named_match],
codemap
::
spanned
{
node
:
match_nonterminal
(
bind_name
,
_
,
idx
),
span
:
sp
}
=>
{
if
ret_val
.contains_key
(
bind_name
)
{
if
ret_val
.contains_key
_ref
(
&
bind_name
)
{
p_s
.span_diagnostic
.span_fatal
(
sp
,
~
"Duplicated bind name: "
+
*
p_s
.interner
.get
(
bind_name
))
}
...
...
src/libsyntax/parse/obsolete.rs
浏览文件 @
f4a27b2c
...
...
@@ -137,7 +137,7 @@ fn obsolete_expr(sp: span, kind: ObsoleteSyntax) -> @expr {
desc
:
&
str
)
{
self
.span_err
(
sp
,
fmt!
(
"obsolete syntax: %s"
,
kind_str
));
if
!
self
.obsolete_set
.contains_key
(
kind
)
{
if
!
self
.obsolete_set
.contains_key
_ref
(
&
kind
)
{
self
.sess.span_diagnostic
.handler
()
.note
(
fmt!
(
"%s"
,
desc
));
self
.obsolete_set
.insert
(
kind
,
());
}
...
...
src/test/bench/shootout-mandelbrot.rs
浏览文件 @
f4a27b2c
...
...
@@ -134,7 +134,7 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
done
+=
1_u
;
let
mut
prev
=
done
;
while
prev
<=
i
{
if
lines
.contains_key
(
prev
)
{
if
lines
.contains_key
_ref
(
&
prev
)
{
debug!
(
"WS %u"
,
prev
);
cout
.write
(
lines
.get
(
prev
));
done
+=
1_u
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录