Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
81b4f36d
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,发现更多精彩内容 >>
提交
81b4f36d
编写于
2月 02, 2013
作者:
D
Daniel Micay
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
oldmap: remove legacy each method
上级
2e496818
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
48 addition
and
51 deletion
+48
-51
src/libcargo/cargo.rc
src/libcargo/cargo.rc
+17
-17
src/librustc/metadata/cstore.rs
src/librustc/metadata/cstore.rs
+1
-1
src/librustc/middle/lang_items.rs
src/librustc/middle/lang_items.rs
+1
-1
src/librustc/middle/lint.rs
src/librustc/middle/lint.rs
+3
-1
src/librustc/middle/region.rs
src/librustc/middle/region.rs
+1
-1
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+19
-19
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+2
-2
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/glue.rs
+1
-1
src/librustc/rustc.rc
src/librustc/rustc.rc
+1
-1
src/libstd/oldmap.rs
src/libstd/oldmap.rs
+0
-4
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
+2
-3
未找到文件。
src/libcargo/cargo.rc
浏览文件 @
81b4f36d
...
...
@@ -833,7 +833,7 @@ pub fn rustc_sysroot() -> ~str {
}
}
pub fn install_source(c: &Cargo, path: &Path) {
pub fn install_source(c: &
mut
Cargo, path: &Path) {
debug!("source: %s", path.to_str());
os::change_dir(path);
...
...
@@ -872,7 +872,8 @@ pub fn install_source(c: &Cargo, path: &Path) {
}
}
pub fn install_git(c: &Cargo, wd: &Path, url: ~str, reference: Option<~str>) {
pub fn install_git(c: &mut Cargo, wd: &Path, url: ~str,
reference: Option<~str>) {
run::program_output(~"git", ~[~"clone", url, wd.to_str()]);
if reference.is_some() {
let r = reference.get();
...
...
@@ -883,7 +884,7 @@ pub fn install_git(c: &Cargo, wd: &Path, url: ~str, reference: Option<~str>) {
install_source(c, wd);
}
pub fn install_curl(c: &Cargo, wd: &Path, url: ~str) {
pub fn install_curl(c: &
mut
Cargo, wd: &Path, url: ~str) {
let tarpath = wd.push("pkg.tar");
let p = run::program_output(~"curl", ~[~"-f", ~"-s", ~"-o",
tarpath.to_str(), url]);
...
...
@@ -896,14 +897,14 @@ pub fn install_curl(c: &Cargo, wd: &Path, url: ~str) {
install_source(c, wd);
}
pub fn install_file(c: &Cargo, wd: &Path, path: &Path) {
pub fn install_file(c: &
mut
Cargo, wd: &Path, path: &Path) {
run::program_output(~"tar", ~[~"-x", ~"--strip-components=1",
~"-C", wd.to_str(),
~"-f", path.to_str()]);
install_source(c, wd);
}
pub fn install_package(c: &Cargo, src: ~str, wd: &Path, pkg: Package) {
pub fn install_package(c: &
mut
Cargo, src: ~str, wd: &Path, pkg: Package) {
let url = copy pkg.url;
let method = match pkg.method {
~"git" => ~"git",
...
...
@@ -930,7 +931,7 @@ pub fn cargo_suggestion(c: &Cargo, fallback: fn()) {
fallback();
}
pub fn install_uuid(c: &Cargo, wd: &Path, uuid: ~str) {
pub fn install_uuid(c: &
mut
Cargo, wd: &Path, uuid: ~str) {
let mut ps = ~[];
for_each_package(c, |s, p| {
if p.uuid == uuid {
...
...
@@ -954,7 +955,7 @@ pub fn install_uuid(c: &Cargo, wd: &Path, uuid: ~str) {
}
}
pub fn install_named(c: &Cargo, wd: &Path, name: ~str) {
pub fn install_named(c: &
mut
Cargo, wd: &Path, name: ~str) {
let mut ps = ~[];
for_each_package(c, |s, p| {
if p.name == name {
...
...
@@ -978,7 +979,8 @@ pub fn install_named(c: &Cargo, wd: &Path, name: ~str) {
}
}
pub fn install_uuid_specific(c: &Cargo, wd: &Path, src: ~str, uuid: ~str) {
pub fn install_uuid_specific(c: &mut Cargo, wd: &Path, src: ~str,
uuid: ~str) {
match c.sources.find(src) {
Some(s) => {
for s.packages.each |p| {
...
...
@@ -993,7 +995,8 @@ pub fn install_uuid_specific(c: &Cargo, wd: &Path, src: ~str, uuid: ~str) {
error(~"can't find package: " + src + ~"/" + uuid);
}
pub fn install_named_specific(c: &Cargo, wd: &Path, src: ~str, name: ~str) {
pub fn install_named_specific(c: &mut Cargo, wd: &Path, src: ~str,
name: ~str) {
match c.sources.find(src) {
Some(s) => {
for s.packages.each |p| {
...
...
@@ -1060,7 +1063,7 @@ pub fn cmd_uninstall(c: &Cargo) {
}
}
pub fn install_query(c: &Cargo, wd: &Path, target: ~str) {
pub fn install_query(c: &
mut
Cargo, wd: &Path, target: ~str) {
match c.dep_cache.find(target) {
Some(inst) => {
if inst {
...
...
@@ -1112,10 +1115,7 @@ pub fn install_query(c: &Cargo, wd: &Path, target: ~str) {
// a bit of a hack. It should be cleaned up in the future.
if target == c.current_install {
for c.dep_cache.each |k, _v| {
c.dep_cache.remove(k);
}
c.dep_cache.clear();
c.current_install = ~"";
}
}
...
...
@@ -1128,7 +1128,7 @@ pub fn get_temp_workdir(c: &Cargo) -> Path {
}
}
pub fn cmd_install(c: &Cargo) {
pub fn cmd_install(c: &
mut
Cargo) {
unsafe {
let wd = get_temp_workdir(c);
...
...
@@ -1636,7 +1636,7 @@ pub fn dump_sources(c: &Cargo) {
result::Ok(writer) => {
let mut hash = ~LinearMap::new();
for c.sources.each
|k,
v| {
for c.sources.each
_ref |&k, &
v| {
let mut chash = ~LinearMap::new();
chash.insert(~"url", json::String(v.url));
...
...
@@ -1967,7 +1967,7 @@ pub fn main() {
match o.free[1] {
~"init" => cmd_init(&c),
~"install" => cmd_install(&c),
~"install" => cmd_install(&
mut
c),
~"uninstall" => cmd_uninstall(&c),
~"list" => cmd_list(&c),
~"search" => cmd_search(&c),
...
...
src/librustc/metadata/cstore.rs
浏览文件 @
81b4f36d
...
...
@@ -99,7 +99,7 @@ pub fn have_crate_data(cstore: CStore, cnum: ast::crate_num) -> bool {
pub
fn
iter_crate_data
(
cstore
:
CStore
,
i
:
fn
(
ast
::
crate_num
,
crate_metadata
))
{
for
p
(
cstore
)
.metas.each
|
k
,
v
|
{
i
(
k
,
v
);};
for
p
(
cstore
)
.metas.each
_ref
|
&
k
,
&
v
|
{
i
(
k
,
v
);};
}
pub
fn
add_used_crate_file
(
cstore
:
CStore
,
lib
:
&
Path
)
{
...
...
src/librustc/middle/lang_items.rs
浏览文件 @
81b4f36d
...
...
@@ -391,7 +391,7 @@ fn collect_external_language_items() {
}
fn
check_completeness
()
{
for
self
.item_refs.each
|
key
,
item_ref
|
{
for
self
.item_refs.each
_ref
|
&
key
,
&
item_ref
|
{
match
self
.items.items
[
item_ref
]
{
None
=>
{
self
.session
.err
(
fmt!
(
"no item found for `%s`"
,
key
));
...
...
src/librustc/middle/lint.rs
浏览文件 @
81b4f36d
...
...
@@ -400,7 +400,9 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
sess
:
sess
});
// Install defaults.
for
cx
.dict.each
|
_
k
,
spec
|
{
cx
.set_level
(
spec
.lint
,
spec
.default
);
}
for
cx
.dict.each_value_ref
|
&
spec
|
{
cx
.set_level
(
spec
.lint
,
spec
.default
);
}
// Install command-line options, overriding defaults.
for
sess
.opts.lint_opts.each
|
pair
|
{
...
...
src/librustc/middle/region.rs
浏览文件 @
81b4f36d
...
...
@@ -833,7 +833,7 @@ pub fn determine_rp_in_crate(sess: Session,
debug!
(
"%s"
,
{
debug!
(
"Region variance results:"
);
for
cx
.region_paramd_items.each
|
key
,
value
|
{
for
cx
.region_paramd_items.each
_ref
|
&
key
,
&
value
|
{
debug!
(
"item %? (%s) is parameterized with variance %?"
,
key
,
ast_map
::
node_id_to_str
(
ast_map
,
key
,
...
...
src/librustc/middle/resolve.rs
浏览文件 @
81b4f36d
...
...
@@ -1913,7 +1913,7 @@ fn resolve_imports_for_module_subtree(module_: @Module) {
self
.module_to_str
(
module_
));
self
.resolve_imports_for_module
(
module_
);
for
module_
.children.each
|
_
name
,
child_node
|
{
for
module_
.children.each
_value_ref
|
&
child_node
|
{
match
child_node
.get_module_if_available
()
{
None
=>
{
// Nothing to do.
...
...
@@ -1924,7 +1924,7 @@ fn resolve_imports_for_module_subtree(module_: @Module) {
}
}
for
module_
.anonymous_children.each
|
_
block_id
,
child_module
|
{
for
module_
.anonymous_children.each
_value_ref
|
&
child_module
|
{
self
.resolve_imports_for_module_subtree
(
child_module
);
}
}
...
...
@@ -2430,8 +2430,8 @@ fn resolve_glob_import(privacy: Privacy,
assert
containing_module
.glob_count
==
0
;
// Add all resolved imports from the containing module.
for
containing_module
.import_resolutions.each
|
ident
,
target_import_resolution
|
{
for
containing_module
.import_resolutions.each
_ref
|
&
ident
,
&
target_import_resolution
|
{
debug!
(
"(resolving glob import) writing module resolution
\
%? into `%s`"
,
...
...
@@ -2480,7 +2480,7 @@ fn resolve_glob_import(privacy: Privacy,
}
// Add all children from the containing module.
for
containing_module
.children.each
|
ident
,
name_bindings
|
{
for
containing_module
.children.each
_ref
|
&
ident
,
&
name_bindings
|
{
let
mut
dest_import_resolution
;
match
module_
.import_resolutions
.find
(
ident
)
{
None
=>
{
...
...
@@ -3148,7 +3148,7 @@ fn report_unresolved_imports(module_: @Module) {
}
// Descend into children and anonymous children.
for
module_
.children.each
|
_
name
,
child_node
|
{
for
module_
.children.each
_value_ref
|
&
child_node
|
{
match
child_node
.get_module_if_available
()
{
None
=>
{
// Continue.
...
...
@@ -3159,7 +3159,7 @@ fn report_unresolved_imports(module_: @Module) {
}
}
for
module_
.anonymous_children.each
|
_
name
,
module_
|
{
for
module_
.anonymous_children.each
_value_ref
|
&
module_
|
{
self
.report_unresolved_imports
(
module_
);
}
}
...
...
@@ -3204,7 +3204,7 @@ fn record_exports_for_module_subtree(module_: @Module) {
self
.record_exports_for_module
(
module_
);
for
module_
.children.each
|
_
ident
,
child_name_bindings
|
{
for
module_
.children.each
_value_ref
|
&
child_name_bindings
|
{
match
child_name_bindings
.get_module_if_available
()
{
None
=>
{
// Nothing to do.
...
...
@@ -3215,7 +3215,7 @@ fn record_exports_for_module_subtree(module_: @Module) {
}
}
for
module_
.anonymous_children.each
|
_
node_id
,
child_module
|
{
for
module_
.anonymous_children.each
_value_ref
|
&
child_module
|
{
self
.record_exports_for_module_subtree
(
child_module
);
}
}
...
...
@@ -4068,7 +4068,7 @@ fn check_consistent_bindings(arm: arm) {
for
arm
.pats
.eachi
()
|
i
,
p
|
{
let
map_i
=
self
.binding_mode_map
(
*
p
);
for
map_0
.each
|
key
,
binding_0
|
{
for
map_0
.each
_ref
|
&
key
,
&
binding_0
|
{
match
map_i
.find
(
key
)
{
None
=>
{
self
.session
.span_err
(
...
...
@@ -4089,7 +4089,7 @@ fn check_consistent_bindings(arm: arm) {
}
}
for
map_i
.each
|
key
,
binding
|
{
for
map_i
.each
_ref
|
&
key
,
&
binding
|
{
if
!
map_0
.contains_key_ref
(
&
key
)
{
self
.session
.span_err
(
binding
.span
,
...
...
@@ -5001,7 +5001,7 @@ fn search_for_traits_containing_method(name: ident) -> @DVec<def_id> {
}
// Look for trait children.
for
search_module
.children.each
|
_
name
,
child_name_bindings
|
{
for
search_module
.children.each
_value_ref
|
&
child_name_bindings
|
{
match
child_name_bindings
.def_for_namespace
(
TypeNS
)
{
Some
(
def
)
=>
{
match
def
{
...
...
@@ -5021,8 +5021,8 @@ fn search_for_traits_containing_method(name: ident) -> @DVec<def_id> {
}
// Look for imports.
for
search_module
.import_resolutions.each
|
_
ident
,
import_resolution
|
{
for
search_module
.import_resolutions.each
_value_ref
|
&
import_resolution
|
{
match
import_resolution
.target_for_namespace
(
TypeNS
)
{
None
=>
{
...
...
@@ -5184,7 +5184,7 @@ fn check_for_unused_imports_in_module_subtree(module_: @Module) {
self
.check_for_unused_imports_in_module
(
module_
);
for
module_
.children.each
|
_
ident
,
child_name_bindings
|
{
for
module_
.children.each
_value_ref
|
&
child_name_bindings
|
{
match
(
*
child_name_bindings
)
.get_module_if_available
()
{
None
=>
{
// Nothing to do.
...
...
@@ -5196,13 +5196,13 @@ fn check_for_unused_imports_in_module_subtree(module_: @Module) {
}
}
for
module_
.anonymous_children.each
|
_
node_id
,
child_module
|
{
for
module_
.anonymous_children.each
_value_ref
|
&
child_module
|
{
self
.check_for_unused_imports_in_module_subtree
(
child_module
);
}
}
fn
check_for_unused_imports_in_module
(
module_
:
@
Module
)
{
for
module_
.import_resolutions.each
|
_
name
,
import_resolution
|
{
for
module_
.import_resolutions.each
_value_ref
|
&
import_resolution
|
{
if
!
import_resolution
.used
{
match
self
.unused_import_lint_level
{
warn
=>
{
...
...
@@ -5261,12 +5261,12 @@ fn dump_module(module_: @Module) {
debug!
(
"Dump of module `%s`:"
,
self
.module_to_str
(
module_
));
debug!
(
"Children:"
);
for
module_
.children.each
|
name
,
_
child
|
{
for
module_
.children.each
_key_ref
|
&
name
|
{
debug!
(
"* %s"
,
self
.session
.str_of
(
name
));
}
debug!
(
"Import resolutions:"
);
for
module_
.import_resolutions.each
|
name
,
import_resolution
|
{
for
module_
.import_resolutions.each
_ref
|
&
name
,
&
import_resolution
|
{
let
mut
value_repr
;
match
(
*
import_resolution
)
.target_for_namespace
(
ValueNS
)
{
None
=>
{
value_repr
=
~
""
;
}
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
81b4f36d
...
...
@@ -2806,7 +2806,7 @@ pub fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
lib
::
llvm
::
SetLinkage
(
map
,
lib
::
llvm
::
InternalLinkage
);
}
let
mut
elts
:
~
[
ValueRef
]
=
~
[];
for
ccx
.module_data.each
|
key
,
val
|
{
for
ccx
.module_data.each
_ref
|
&
key
,
&
val
|
{
let
elt
=
C_struct
(
~
[
p2i
(
ccx
,
C_cstr
(
ccx
,
key
)),
p2i
(
ccx
,
val
)]);
elts
.push
(
elt
);
...
...
@@ -3087,7 +3087,7 @@ pub fn trans_crate(sess: session::Session,
}
if
ccx
.sess
.count_llvm_insns
()
{
for
ccx
.stats.llvm_insns.each
|
k
,
v
|
{
for
ccx
.stats.llvm_insns.each
_ref
|
&
k
,
&
v
|
{
io
::
println
(
fmt!
(
"%-7u %s"
,
v
,
k
));
}
}
...
...
src/librustc/middle/trans/glue.rs
浏览文件 @
81b4f36d
...
...
@@ -757,7 +757,7 @@ pub fn emit_tydescs(ccx: @crate_ctxt) {
let
_
icx
=
ccx
.insn_ctxt
(
"emit_tydescs"
);
// As of this point, allow no more tydescs to be created.
ccx
.finished_tydescs
=
true
;
for
ccx
.tydescs.each
|
_
key
,
val
|
{
for
ccx
.tydescs.each
_value_ref
|
&
val
|
{
let
glue_fn_ty
=
T_ptr
(
T_generic_glue_fn
(
ccx
));
let
ti
=
val
;
...
...
src/librustc/rustc.rc
浏览文件 @
81b4f36d
...
...
@@ -186,7 +186,7 @@ Available lint options:
padded(max_key, ~"name"), ~"default", ~"meaning"));
io::println(fmt!(" %s %7.7s %s\n",
padded(max_key, ~"----"), ~"-------", ~"-------"));
for lint_dict.each
|k,
v| {
for lint_dict.each
_ref |&k, &
v| {
let k = str::replace(k, ~"_", ~"-");
io::println(fmt!(" %s %7.7s %s",
padded(max_key, k),
...
...
src/libstd/oldmap.rs
浏览文件 @
81b4f36d
...
...
@@ -316,10 +316,6 @@ fn remove(k: K) -> bool {
}
}
pure
fn
each
(
blk
:
fn
(
key
:
K
,
value
:
V
)
->
bool
)
{
self
.each_ref
(|
k
,
v
|
blk
(
*
k
,
*
v
))
}
pure
fn
each_ref
(
blk
:
fn
(
key
:
&
K
,
value
:
&
V
)
->
bool
)
{
for
self
.each_entry
|
entry
|
{
if
!
blk
(
&
entry
.key
,
&
entry
.value
)
{
break
;
}
...
...
src/test/bench/shootout-k-nucleotide-pipes.rs
浏览文件 @
81b4f36d
...
...
@@ -49,10 +49,9 @@ fn sortKV<TT: Copy Ord, UU: Copy Ord>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] {
let
mut
pairs
=
~
[];
// map -> [(k,%)]
mm
.each
(
fn
&
(
key
:
~
[
u8
],
val
:
uint
)
->
bool
{
for
mm
.each_ref
|
&
key
,
&
val
|
{
pairs
.push
((
key
,
pct
(
val
,
total
)));
return
true
;
});
}
let
pairs_sorted
=
sortKV
(
pairs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录