Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7b2026bf
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
7b2026bf
编写于
7月 31, 2012
作者:
B
Brian Anderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Introduce 'return', 'match' and 'module' as synonyms
上级
7d183698
变更
21
展开全部
隐藏空白更改
内联
并排
Showing
21 changed file
with
349 addition
and
319 deletion
+349
-319
src/cargo/cargo.rs
src/cargo/cargo.rs
+9
-9
src/compiletest/compiletest.rs
src/compiletest/compiletest.rs
+16
-16
src/libcore/dvec.rs
src/libcore/dvec.rs
+6
-6
src/libstd/list.rs
src/libstd/list.rs
+5
-5
src/libstd/test.rs
src/libstd/test.rs
+5
-5
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+4
-4
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+21
-7
src/libsyntax/parse/token.rs
src/libsyntax/parse/token.rs
+2
-2
src/rustc/driver/driver.rs
src/rustc/driver/driver.rs
+30
-30
src/rustc/driver/rustc.rs
src/rustc/driver/rustc.rs
+13
-13
src/rustc/metadata/creader.rs
src/rustc/metadata/creader.rs
+3
-3
src/rustc/metadata/encoder.rs
src/rustc/metadata/encoder.rs
+3
-3
src/rustc/metadata/loader.rs
src/rustc/metadata/loader.rs
+3
-3
src/rustc/middle/check_alt.rs
src/rustc/middle/check_alt.rs
+4
-4
src/rustc/middle/resolve3.rs
src/rustc/middle/resolve3.rs
+166
-166
src/rustc/middle/trans/alt.rs
src/rustc/middle/trans/alt.rs
+25
-25
src/rustc/middle/typeck/coherence.rs
src/rustc/middle/typeck/coherence.rs
+3
-3
src/rustdoc/config.rs
src/rustdoc/config.rs
+11
-10
src/rustdoc/extract.rs
src/rustdoc/extract.rs
+4
-4
src/test/compile-fail/attr-bad-crate-attr.rc
src/test/compile-fail/attr-bad-crate-attr.rc
+1
-1
src/test/run-pass/keyword-changes-2012-07-31.rs
src/test/run-pass/keyword-changes-2012-07-31.rs
+15
-0
未找到文件。
src/cargo/cargo.rs
浏览文件 @
7b2026bf
...
...
@@ -600,21 +600,21 @@ fn load_source_packages(c: cargo, src: source) {
}
fn
build_cargo_options
(
argv
:
~
[
~
str
])
->
options
{
let
match
=
alt
getopts
::
getopts
(
argv
,
opts
())
{
let
match
es
=
alt
getopts
::
getopts
(
argv
,
opts
())
{
result
::
ok
(
m
)
{
m
}
result
::
err
(
f
)
{
fail
fmt!
{
"%s"
,
getopts
::
fail_str
(
f
)};
}
};
let
test
=
opt_present
(
match
,
~
"test"
);
let
G
=
opt_present
(
match
,
~
"G"
);
let
g
=
opt_present
(
match
,
~
"g"
);
let
help
=
opt_present
(
match
,
~
"h"
)
||
opt_present
(
match
,
~
"help"
);
let
len
=
vec
::
len
(
match
.free
);
let
test
=
opt_present
(
match
es
,
~
"test"
);
let
G
=
opt_present
(
match
es
,
~
"G"
);
let
g
=
opt_present
(
match
es
,
~
"g"
);
let
help
=
opt_present
(
match
es
,
~
"h"
)
||
opt_present
(
matches
,
~
"help"
);
let
len
=
vec
::
len
(
match
es
.free
);
let
is_install
=
len
>
1u
&&
match
.free
[
1
]
==
~
"install"
;
let
is_uninstall
=
len
>
1u
&&
match
.free
[
1
]
==
~
"uninstall"
;
let
is_install
=
len
>
1u
&&
match
es
.free
[
1
]
==
~
"install"
;
let
is_uninstall
=
len
>
1u
&&
match
es
.free
[
1
]
==
~
"uninstall"
;
if
G
&&
g
{
fail
~
"-G and -g both provided"
;
}
...
...
@@ -627,7 +627,7 @@ fn build_cargo_options(argv: ~[~str]) -> options {
else
if
G
{
system_mode
}
else
{
local_mode
};
{
test
:
test
,
mode
:
mode
,
free
:
match
.free
,
help
:
help
}
{
test
:
test
,
mode
:
mode
,
free
:
match
es
.free
,
help
:
help
}
}
fn
configure
(
opts
:
options
)
->
cargo
{
...
...
src/compiletest/compiletest.rs
浏览文件 @
7b2026bf
...
...
@@ -41,29 +41,29 @@ fn parse_config(args: ~[~str]) -> config {
assert
(
vec
::
is_not_empty
(
args
));
let
args_
=
vec
::
tail
(
args
);
let
match
=
let
match
es
=
alt
getopts
::
getopts
(
args_
,
opts
)
{
ok
(
m
)
{
m
}
err
(
f
)
{
fail
getopts
::
fail_str
(
f
)
}
};
ret
{
compile_lib_path
:
getopts
::
opt_str
(
match
,
~
"compile-lib-path"
),
run_lib_path
:
getopts
::
opt_str
(
match
,
~
"run-lib-path"
),
rustc_path
:
getopts
::
opt_str
(
match
,
~
"rustc-path"
),
src_base
:
getopts
::
opt_str
(
match
,
~
"src-base"
),
build_base
:
getopts
::
opt_str
(
match
,
~
"build-base"
),
aux_base
:
getopts
::
opt_str
(
match
,
~
"aux-base"
),
stage_id
:
getopts
::
opt_str
(
match
,
~
"stage-id"
),
mode
:
str_mode
(
getopts
::
opt_str
(
match
,
~
"mode"
)),
run_ignored
:
getopts
::
opt_present
(
match
,
~
"ignored"
),
ret
{
compile_lib_path
:
getopts
::
opt_str
(
match
es
,
~
"compile-lib-path"
),
run_lib_path
:
getopts
::
opt_str
(
match
es
,
~
"run-lib-path"
),
rustc_path
:
getopts
::
opt_str
(
match
es
,
~
"rustc-path"
),
src_base
:
getopts
::
opt_str
(
match
es
,
~
"src-base"
),
build_base
:
getopts
::
opt_str
(
match
es
,
~
"build-base"
),
aux_base
:
getopts
::
opt_str
(
match
es
,
~
"aux-base"
),
stage_id
:
getopts
::
opt_str
(
match
es
,
~
"stage-id"
),
mode
:
str_mode
(
getopts
::
opt_str
(
match
es
,
~
"mode"
)),
run_ignored
:
getopts
::
opt_present
(
match
es
,
~
"ignored"
),
filter
:
if
vec
::
len
(
match
.free
)
>
0u
{
option
::
some
(
match
.free
[
0
])
if
vec
::
len
(
match
es
.free
)
>
0u
{
option
::
some
(
match
es
.free
[
0
])
}
else
{
option
::
none
},
logfile
:
getopts
::
opt_maybe_str
(
match
,
~
"logfile"
),
runtool
:
getopts
::
opt_maybe_str
(
match
,
~
"runtool"
),
rustcflags
:
getopts
::
opt_maybe_str
(
match
,
~
"rustcflags"
),
verbose
:
getopts
::
opt_present
(
match
,
~
"verbose"
)};
logfile
:
getopts
::
opt_maybe_str
(
match
es
,
~
"logfile"
),
runtool
:
getopts
::
opt_maybe_str
(
match
es
,
~
"runtool"
),
rustcflags
:
getopts
::
opt_maybe_str
(
match
es
,
~
"rustcflags"
),
verbose
:
getopts
::
opt_present
(
match
es
,
~
"verbose"
)};
}
fn
log_config
(
config
:
config
)
{
...
...
src/libcore/dvec.rs
浏览文件 @
7b2026bf
...
...
@@ -97,7 +97,7 @@ fn borrow<B>(f: fn(-~[mut A]) -> B) -> B {
}
#[inline(always)]
fn
return
(
-
data
:
~
[
mut
A
])
{
fn
give_back
(
-
data
:
~
[
mut
A
])
{
unsafe
{
self
.data
<-
data
;
}
...
...
@@ -120,7 +120,7 @@ fn reserve(count: uint) {
*/
#[inline(always)]
fn
swap
(
f
:
fn
(
-~
[
mut
A
])
->
~
[
mut
A
])
{
self
.borrow
(|
v
|
self
.
return
(
f
(
v
)))
self
.borrow
(|
v
|
self
.
give_back
(
f
(
v
)))
}
/// Returns the number of elements currently in the dvec
...
...
@@ -128,7 +128,7 @@ fn swap(f: fn(-~[mut A]) -> ~[mut A]) {
unchecked
{
do
self
.borrow
|
v
|
{
let
l
=
v
.len
();
self
.
return
(
v
);
self
.
give_back
(
v
);
l
}
}
...
...
@@ -145,7 +145,7 @@ fn pop() -> A {
do
self
.borrow
|
v
|
{
let
mut
v
<-
v
;
let
result
=
vec
::
pop
(
v
);
self
.
return
(
v
);
self
.
give_back
(
v
);
result
}
}
...
...
@@ -175,7 +175,7 @@ fn shift() -> A {
do
self
.borrow
|
v
|
{
let
mut
v
=
vec
::
from_mut
(
v
);
let
result
=
vec
::
shift
(
v
);
self
.
return
(
vec
::
to_mut
(
v
));
self
.
give_back
(
vec
::
to_mut
(
v
));
result
}
}
...
...
@@ -247,7 +247,7 @@ fn append_iter<A, I:iter::base_iter<A>>(ts: I) {
unchecked
{
do
self
.borrow
|
v
|
{
let
w
=
vec
::
from_mut
(
copy
v
);
self
.
return
(
v
);
self
.
give_back
(
v
);
w
}
}
...
...
src/libstd/list.rs
浏览文件 @
7b2026bf
...
...
@@ -192,18 +192,18 @@ fn sub(&&a: int, &&b: int) -> int {
#[test]
fn
test_find_success
()
{
fn
match
(
&&
i
:
int
)
->
bool
{
ret
i
==
2
;
}
fn
match
_
(
&&
i
:
int
)
->
bool
{
ret
i
==
2
;
}
let
l
=
from_vec
(
~
[
0
,
1
,
2
]);
assert
(
list
::
find
(
l
,
match
)
==
option
::
some
(
2
));
assert
(
list
::
find
(
l
,
match
_
)
==
option
::
some
(
2
));
}
#[test]
fn
test_find_fail
()
{
fn
match
(
&&
_
i
:
int
)
->
bool
{
ret
false
;
}
fn
match
_
(
&&
_
i
:
int
)
->
bool
{
ret
false
;
}
let
l
=
from_vec
(
~
[
0
,
1
,
2
]);
let
empty
=
@
list
::
nil
::
<
int
>
;
assert
(
list
::
find
(
l
,
match
)
==
option
::
none
::
<
int
>
);
assert
(
list
::
find
(
empty
,
match
)
==
option
::
none
::
<
int
>
);
assert
(
list
::
find
(
l
,
match
_
)
==
option
::
none
::
<
int
>
);
assert
(
list
::
find
(
empty
,
match
_
)
==
option
::
none
::
<
int
>
);
}
#[test]
...
...
src/libstd/test.rs
浏览文件 @
7b2026bf
...
...
@@ -68,19 +68,19 @@ fn test_main(args: ~[~str], tests: ~[test_desc]) {
fn
parse_opts
(
args
:
~
[
~
str
])
->
opt_res
{
let
args_
=
vec
::
tail
(
args
);
let
opts
=
~
[
getopts
::
optflag
(
~
"ignored"
),
getopts
::
optopt
(
~
"logfile"
)];
let
match
=
let
match
es
=
alt
getopts
::
getopts
(
args_
,
opts
)
{
ok
(
m
)
{
m
}
err
(
f
)
{
ret
either
::
right
(
getopts
::
fail_str
(
f
))
}
};
let
filter
=
if
vec
::
len
(
match
.free
)
>
0u
{
option
::
some
(
match
.free
[
0
])
if
vec
::
len
(
match
es
.free
)
>
0u
{
option
::
some
(
match
es
.free
[
0
])
}
else
{
option
::
none
};
let
run_ignored
=
getopts
::
opt_present
(
match
,
~
"ignored"
);
let
logfile
=
getopts
::
opt_maybe_str
(
match
,
~
"logfile"
);
let
run_ignored
=
getopts
::
opt_present
(
match
es
,
~
"ignored"
);
let
logfile
=
getopts
::
opt_maybe_str
(
match
es
,
~
"logfile"
);
let
test_opts
=
{
filter
:
filter
,
run_ignored
:
run_ignored
,
logfile
:
logfile
};
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
7b2026bf
...
...
@@ -129,17 +129,17 @@ fn expand_expr(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
// NB: there is some redundancy between this and expand_item, below, and
// they might benefit from some amount of semantic and language-UI merger.
fn
expand_mod_items
(
exts
:
hashmap
<~
str
,
syntax_extension
>
,
cx
:
ext_ctxt
,
module
:
ast
::
_
mod
,
fld
:
ast_fold
,
module
_
:
ast
::
_
mod
,
fld
:
ast_fold
,
orig
:
fn
@
(
ast
::
_
mod
,
ast_fold
)
->
ast
::
_
mod
)
->
ast
::
_
mod
{
// Fold the contents first:
let
module
=
orig
(
module
,
fld
);
let
module
_
=
orig
(
module_
,
fld
);
// For each item, look through the attributes. If any of them are
// decorated with "item decorators", then use that function to transform
// the item into a new set of items.
let
new_items
=
do
vec
::
flat_map
(
module
.items
)
|
item
|
{
let
new_items
=
do
vec
::
flat_map
(
module
_
.items
)
|
item
|
{
do
vec
::
foldr
(
item
.attrs
,
~
[
item
])
|
attr
,
items
|
{
let
mname
=
alt
attr
.node.value.node
{
ast
::
meta_word
(
n
)
{
n
}
...
...
@@ -159,7 +159,7 @@ fn expand_mod_items(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
}
};
ret
{
items
:
new_items
with
module
};
ret
{
items
:
new_items
with
module
_
};
}
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
7b2026bf
...
...
@@ -789,7 +789,7 @@ fn parse_bottom_expr() -> pexpr {
ret
pexpr
(
self
.parse_while_expr
());
}
else
if
self
.eat_keyword
(
~
"loop"
)
{
ret
pexpr
(
self
.parse_loop_expr
());
}
else
if
self
.eat_keyword
(
~
"alt"
)
{
}
else
if
self
.eat_keyword
(
~
"alt"
)
||
self
.eat_keyword
(
~
"match"
)
{
ret
pexpr
(
self
.parse_alt_expr
());
}
else
if
self
.eat_keyword
(
~
"fn"
)
{
let
proto
=
self
.parse_fn_ty_proto
();
...
...
@@ -838,7 +838,7 @@ fn parse_bottom_expr() -> pexpr {
let
e
=
self
.parse_expr
();
ex
=
expr_assert
(
e
);
hi
=
e
.span.hi
;
}
else
if
self
.eat_keyword
(
~
"ret"
)
{
}
else
if
self
.eat_keyword
(
~
"ret"
)
||
self
.eat_keyword
(
~
"return"
)
{
if
can_begin_expr
(
self
.token
)
{
let
e
=
self
.parse_expr
();
hi
=
e
.span.hi
;
...
...
@@ -2569,7 +2569,11 @@ fn parse_foreign_mod_items(+first_item_attrs: ~[attribute]) ->
}
fn
parse_item_foreign_mod
()
->
item_info
{
self
.expect_keyword
(
~
"mod"
);
if
self
.is_keyword
(
~
"mod"
)
{
self
.expect_keyword
(
~
"mod"
);
}
else
{
self
.expect_keyword
(
~
"module"
);
}
let
id
=
self
.parse_ident
();
self
.expect
(
token
::
LBRACE
);
let
more_attrs
=
self
.parse_inner_attrs_and_next
();
...
...
@@ -2714,7 +2718,7 @@ fn parse_item(+attrs: ~[attribute], vis: visibility)
}
else
{
self
.parse_item_foreign_mod
()
}
}
else
if
self
.eat_keyword
(
~
"mod"
)
{
}
else
if
self
.eat_keyword
(
~
"mod"
)
||
self
.eat_keyword
(
~
"module"
)
{
self
.parse_item_mod
()
}
else
if
self
.eat_keyword
(
~
"type"
)
{
self
.parse_item_type
()
...
...
@@ -2919,8 +2923,14 @@ fn parse_crate_directive(first_outer_attr: ~[attribute]) ->
let
expect_mod
=
vec
::
len
(
outer_attrs
)
>
0u
;
let
lo
=
self
.span.lo
;
if
expect_mod
||
self
.is_keyword
(
~
"mod"
)
{
self
.expect_keyword
(
~
"mod"
);
if
expect_mod
||
self
.is_keyword
(
~
"mod"
)
||
self
.is_keyword
(
~
"module"
)
{
if
self
.is_keyword
(
~
"mod"
)
{
self
.expect_keyword
(
~
"mod"
);
}
else
{
self
.expect_keyword
(
~
"module"
);
}
let
id
=
self
.parse_ident
();
alt
self
.token
{
// mod x = "foo.rs";
...
...
@@ -2958,7 +2968,11 @@ fn parse_crate_directives(term: token::token,
// accept seeing the terminator next, so if we do see it then fail the
// same way parse_crate_directive would
if
vec
::
len
(
first_outer_attr
)
>
0u
&&
self
.token
==
term
{
self
.expect_keyword
(
~
"mod"
);
if
self
.is_keyword
(
~
"mod"
)
{
self
.expect_keyword
(
~
"mod"
);
}
else
{
self
.expect_keyword
(
~
"module"
);
}
}
let
mut
cdirs
:
~
[
@
crate_directive
]
=
~
[];
...
...
src/libsyntax/parse/token.rs
浏览文件 @
7b2026bf
...
...
@@ -327,11 +327,11 @@ fn restricted_keyword_table() -> hashmap<~str, ()> {
~
"fail"
,
~
"false"
,
~
"fn"
,
~
"for"
,
~
"if"
,
~
"iface"
,
~
"impl"
,
~
"import"
,
~
"let"
,
~
"log"
,
~
"loop"
,
~
"m
od
"
,
~
"mut"
,
~
"m
atch"
,
~
"mod"
,
~
"module
"
,
~
"mut"
,
~
"new"
,
~
"owned"
,
~
"pure"
,
~
"ret"
,
~
"ret"
,
~
"return"
,
~
"struct"
,
~
"true"
,
~
"trait"
,
~
"type"
,
~
"unchecked"
,
~
"unsafe"
,
...
...
src/rustc/driver/driver.rs
浏览文件 @
7b2026bf
...
...
@@ -408,19 +408,19 @@ fn host_triple() -> ~str {
};
}
fn
build_session_options
(
match
:
getopts
::
matches
,
fn
build_session_options
(
match
es
:
getopts
::
matches
,
demitter
:
diagnostic
::
emitter
)
->
@
session
::
options
{
let
crate_type
=
if
opt_present
(
match
,
~
"lib"
)
{
let
crate_type
=
if
opt_present
(
match
es
,
~
"lib"
)
{
session
::
lib_crate
}
else
if
opt_present
(
match
,
~
"bin"
)
{
}
else
if
opt_present
(
match
es
,
~
"bin"
)
{
session
::
bin_crate
}
else
{
session
::
unknown_crate
};
let
static
=
opt_present
(
match
,
~
"static"
);
let
static
=
opt_present
(
match
es
,
~
"static"
);
let
parse_only
=
opt_present
(
match
,
~
"parse-only"
);
let
no_trans
=
opt_present
(
match
,
~
"no-trans"
);
let
parse_only
=
opt_present
(
match
es
,
~
"parse-only"
);
let
no_trans
=
opt_present
(
match
es
,
~
"no-trans"
);
let
lint_levels
=
[
lint
::
allow
,
lint
::
warn
,
lint
::
deny
,
lint
::
forbid
];
...
...
@@ -429,8 +429,8 @@ fn build_session_options(match: getopts::matches,
for
lint_levels
.each
|
level
|
{
let
level_name
=
lint
::
level_to_str
(
level
);
let
level_short
=
level_name
.substr
(
0
,
1
)
.to_upper
();
let
flags
=
vec
::
append
(
getopts
::
opt_strs
(
match
,
level_short
),
getopts
::
opt_strs
(
match
,
level_name
));
let
flags
=
vec
::
append
(
getopts
::
opt_strs
(
match
es
,
level_short
),
getopts
::
opt_strs
(
match
es
,
level_name
));
for
flags
.each
|
lint_name
|
{
let
lint_name
=
str
::
replace
(
lint_name
,
~
"-"
,
~
"_"
);
alt
lint_dict
.find
(
lint_name
)
{
...
...
@@ -446,7 +446,7 @@ fn build_session_options(match: getopts::matches,
}
let
mut
debugging_opts
=
0u
;
let
debug_flags
=
getopts
::
opt_strs
(
match
,
~
"Z"
);
let
debug_flags
=
getopts
::
opt_strs
(
match
es
,
~
"Z"
);
let
debug_map
=
session
::
debugging_opts_map
();
for
debug_flags
.each
|
debug_flag
|
{
let
mut
this_bit
=
0u
;
...
...
@@ -466,34 +466,34 @@ fn build_session_options(match: getopts::matches,
let
output_type
=
if
parse_only
||
no_trans
{
link
::
output_type_none
}
else
if
opt_present
(
match
,
~
"S"
)
&&
opt_present
(
match
,
~
"emit-llvm"
)
{
}
else
if
opt_present
(
match
es
,
~
"S"
)
&&
opt_present
(
match
es
,
~
"emit-llvm"
)
{
link
::
output_type_llvm_assembly
}
else
if
opt_present
(
match
,
~
"S"
)
{
}
else
if
opt_present
(
match
es
,
~
"S"
)
{
link
::
output_type_assembly
}
else
if
opt_present
(
match
,
~
"c"
)
{
}
else
if
opt_present
(
match
es
,
~
"c"
)
{
link
::
output_type_object
}
else
if
opt_present
(
match
,
~
"emit-llvm"
)
{
}
else
if
opt_present
(
match
es
,
~
"emit-llvm"
)
{
link
::
output_type_bitcode
}
else
{
link
::
output_type_exe
};
let
extra_debuginfo
=
opt_present
(
match
,
~
"xg"
);
let
debuginfo
=
opt_present
(
match
,
~
"g"
)
||
extra_debuginfo
;
let
sysroot_opt
=
getopts
::
opt_maybe_str
(
match
,
~
"sysroot"
);
let
target_opt
=
getopts
::
opt_maybe_str
(
match
,
~
"target"
);
let
save_temps
=
getopts
::
opt_present
(
match
,
~
"save-temps"
);
let
extra_debuginfo
=
opt_present
(
match
es
,
~
"xg"
);
let
debuginfo
=
opt_present
(
match
es
,
~
"g"
)
||
extra_debuginfo
;
let
sysroot_opt
=
getopts
::
opt_maybe_str
(
match
es
,
~
"sysroot"
);
let
target_opt
=
getopts
::
opt_maybe_str
(
match
es
,
~
"target"
);
let
save_temps
=
getopts
::
opt_present
(
match
es
,
~
"save-temps"
);
alt
output_type
{
// unless we're emitting huamn-readable assembly, omit comments.
link
::
output_type_llvm_assembly
|
link
::
output_type_assembly
{}
_
{
debugging_opts
|
=
session
::
no_asm_comments
;
}
}
let
opt_level
:
uint
=
if
opt_present
(
match
,
~
"O"
)
{
if
opt_present
(
match
,
~
"opt-level"
)
{
if
opt_present
(
match
es
,
~
"O"
)
{
if
opt_present
(
match
es
,
~
"opt-level"
)
{
early_error
(
demitter
,
~
"-O and --opt-level both provided"
);
}
2u
}
else
if
opt_present
(
match
,
~
"opt-level"
)
{
alt
getopts
::
opt_str
(
match
,
~
"opt-level"
)
{
}
else
if
opt_present
(
match
es
,
~
"opt-level"
)
{
alt
getopts
::
opt_str
(
match
es
,
~
"opt-level"
)
{
~
"0"
{
0u
}
~
"1"
{
1u
}
~
"2"
{
2u
}
...
...
@@ -510,9 +510,9 @@ fn build_session_options(match: getopts::matches,
some
(
s
)
{
s
}
};
let
addl_lib_search_paths
=
getopts
::
opt_strs
(
match
,
~
"L"
);
let
cfg
=
parse_cfgspecs
(
getopts
::
opt_strs
(
match
,
~
"cfg"
));
let
test
=
opt_present
(
match
,
~
"test"
);
let
addl_lib_search_paths
=
getopts
::
opt_strs
(
match
es
,
~
"L"
);
let
cfg
=
parse_cfgspecs
(
getopts
::
opt_strs
(
match
es
,
~
"cfg"
));
let
test
=
opt_present
(
match
es
,
~
"test"
);
let
sopts
:
@
session
::
options
=
@
{
crate_type
:
crate_type
,
static
:
static
,
...
...
@@ -719,13 +719,13 @@ mod test {
// When the user supplies --test we should implicitly supply --cfg test
#[test]
fn
test_switch_implies_cfg_test
()
{
let
match
=
let
match
es
=
alt
getopts
::
getopts
(
~
[
~
"--test"
],
opts
())
{
ok
(
m
)
{
m
}
err
(
f
)
{
fail
~
"test_switch_implies_cfg_test: "
+
getopts
::
fail_str
(
f
);
}
};
let
sessopts
=
build_session_options
(
match
,
diagnostic
::
emit
);
let
sessopts
=
build_session_options
(
match
es
,
diagnostic
::
emit
);
let
sess
=
build_session
(
sessopts
,
diagnostic
::
emit
);
let
cfg
=
build_configuration
(
sess
,
~
"whatever"
,
str_input
(
~
""
));
assert
(
attr
::
contains_name
(
cfg
,
~
"test"
));
...
...
@@ -735,7 +735,7 @@ fn test_switch_implies_cfg_test() {
// another --cfg test
#[test]
fn
test_switch_implies_cfg_test_unless_cfg_test
()
{
let
match
=
let
match
es
=
alt
getopts
::
getopts
(
~
[
~
"--test"
,
~
"--cfg=test"
],
opts
())
{
ok
(
m
)
{
m
}
err
(
f
)
{
...
...
@@ -743,7 +743,7 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
getopts
::
fail_str
(
f
);
}
};
let
sessopts
=
build_session_options
(
match
,
diagnostic
::
emit
);
let
sessopts
=
build_session_options
(
match
es
,
diagnostic
::
emit
);
let
sess
=
build_session
(
sessopts
,
diagnostic
::
emit
);
let
cfg
=
build_configuration
(
sess
,
~
"whatever"
,
str_input
(
~
""
));
let
test_items
=
attr
::
find_meta_items_by_name
(
cfg
,
~
"test"
);
...
...
src/rustc/driver/rustc.rs
浏览文件 @
7b2026bf
...
...
@@ -128,7 +128,7 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
if
vec
::
len
(
args
)
==
0u
{
usage
(
binary
);
ret
;
}
let
match
=
let
match
es
=
alt
getopts
::
getopts
(
args
,
opts
())
{
ok
(
m
)
{
m
}
err
(
f
)
{
...
...
@@ -136,31 +136,31 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
}
};
if
opt_present
(
match
,
~
"h"
)
||
opt_present
(
match
,
~
"help"
)
{
if
opt_present
(
match
es
,
~
"h"
)
||
opt_present
(
matches
,
~
"help"
)
{
usage
(
binary
);
ret
;
}
let
lint_flags
=
vec
::
append
(
getopts
::
opt_strs
(
match
,
~
"W"
),
getopts
::
opt_strs
(
match
,
~
"warn"
));
let
lint_flags
=
vec
::
append
(
getopts
::
opt_strs
(
match
es
,
~
"W"
),
getopts
::
opt_strs
(
match
es
,
~
"warn"
));
if
lint_flags
.contains
(
~
"help"
)
{
describe_warnings
();
ret
;
}
if
getopts
::
opt_strs
(
match
,
~
"Z"
)
.contains
(
~
"help"
)
{
if
getopts
::
opt_strs
(
match
es
,
~
"Z"
)
.contains
(
~
"help"
)
{
describe_debug_flags
();
ret
;
}
if
opt_present
(
match
,
~
"v"
)
||
opt_present
(
match
,
~
"version"
)
{
if
opt_present
(
match
es
,
~
"v"
)
||
opt_present
(
matches
,
~
"version"
)
{
version
(
binary
);
ret
;
}
let
input
=
alt
vec
::
len
(
match
.free
)
{
let
input
=
alt
vec
::
len
(
match
es
.free
)
{
0u
{
early_error
(
demitter
,
~
"no input filename given"
)
}
1u
{
let
ifile
=
match
.free
[
0
];
let
ifile
=
match
es
.free
[
0
];
if
ifile
==
~
"-"
{
let
src
=
str
::
from_bytes
(
io
::
stdin
()
.read_whole_stream
());
str_input
(
src
)
...
...
@@ -171,20 +171,20 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
_
{
early_error
(
demitter
,
~
"multiple input filenames provided"
)
}
};
let
sopts
=
build_session_options
(
match
,
demitter
);
let
sopts
=
build_session_options
(
match
es
,
demitter
);
let
sess
=
build_session
(
sopts
,
demitter
);
let
odir
=
getopts
::
opt_maybe_str
(
match
,
~
"out-dir"
);
let
ofile
=
getopts
::
opt_maybe_str
(
match
,
~
"o"
);
let
odir
=
getopts
::
opt_maybe_str
(
match
es
,
~
"out-dir"
);
let
ofile
=
getopts
::
opt_maybe_str
(
match
es
,
~
"o"
);
let
cfg
=
build_configuration
(
sess
,
binary
,
input
);
let
pretty
=
option
::
map
(
getopts
::
opt_default
(
match
,
~
"pretty"
,
option
::
map
(
getopts
::
opt_default
(
match
es
,
~
"pretty"
,
~
"normal"
),
|
a
|
parse_pretty
(
sess
,
a
)
);
alt
pretty
{
some
::
<
pp_mode
>
(
ppm
)
{
pretty_print_input
(
sess
,
cfg
,
input
,
ppm
);
ret
;
}
none
::
<
pp_mode
>
{
/* continue */
}
}
let
ls
=
opt_present
(
match
,
~
"ls"
);
let
ls
=
opt_present
(
match
es
,
~
"ls"
);
if
ls
{
alt
input
{
file_input
(
ifile
)
{
...
...
src/rustc/metadata/creader.rs
浏览文件 @
7b2026bf
...
...
@@ -78,10 +78,10 @@ fn warn_if_multiple_versions(diag: span_handler,
if
matches
.len
()
!=
1u
{
diag
.handler
()
.warn
(
fmt!
{
"using multiple versions of crate `%s`"
,
*
name
});
for
matches
.each
|
match
|
{
diag
.span_note
(
match
.span
,
~
"used here"
);
for
matches
.each
|
match
_
|
{
diag
.span_note
(
match
_
.span
,
~
"used here"
);
let
attrs
=
~
[
attr
::
mk_attr
(
attr
::
mk_list_item
(
@~
"link"
,
*
match
.metas
))
attr
::
mk_attr
(
attr
::
mk_list_item
(
@~
"link"
,
*
match
_
.metas
))
];
loader
::
note_linkage_attrs
(
diag
,
attrs
);
}
...
...
src/rustc/metadata/encoder.rs
浏览文件 @
7b2026bf
...
...
@@ -157,11 +157,11 @@ fn encode_class_item_paths(ebml_w: ebml::writer,
}
fn
encode_module_item_paths
(
ebml_w
:
ebml
::
writer
,
ecx
:
@
encode_ctxt
,
module
:
_
mod
,
path
:
~
[
ident
],
module
_
:
_
mod
,
path
:
~
[
ident
],
&
index
:
~
[
entry
<~
str
>
])
{
for
module
.items.each
|
it
|
{
for
module
_
.items.each
|
it
|
{
if
!
reachable
(
ecx
,
it
.id
)
||
!
ast_util
::
is_exported
(
it
.ident
,
module
)
{
again
;
}
!
ast_util
::
is_exported
(
it
.ident
,
module
_
)
{
again
;
}
if
!
ast_util
::
is_item_impl
(
it
)
{
add_to_index
(
ebml_w
,
path
,
index
,
it
.ident
);
}
...
...
src/rustc/metadata/loader.rs
浏览文件 @
7b2026bf
...
...
@@ -106,9 +106,9 @@ fn find_library_crate_aux(cx: ctxt,
cx
.diag
.span_err
(
cx
.span
,
fmt!
{
"multiple matching crates for `%s`"
,
*
crate_name
});
cx
.diag
.handler
()
.note
(
~
"candidates:"
);
for
matches
.each
|
match
|
{
cx
.diag
.handler
()
.note
(
fmt!
{
"path: %s"
,
match
.ident
});
let
attrs
=
decoder
::
get_crate_attributes
(
match
.data
);
for
matches
.each
|
match
_
|
{
cx
.diag
.handler
()
.note
(
fmt!
{
"path: %s"
,
match
_
.ident
});
let
attrs
=
decoder
::
get_crate_attributes
(
match
_
.data
);
note_linkage_attrs
(
cx
.diag
,
attrs
);
}
cx
.diag
.handler
()
.abort_if_errors
();
...
...
src/rustc/middle/check_alt.rs
浏览文件 @
7b2026bf
...
...
@@ -332,13 +332,13 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
pat_box
(
a
)
|
pat_uniq
(
a
)
{
some
(
vec
::
append
(
~
[
a
],
vec
::
tail
(
r
)))
}
pat_lit
(
expr
)
{
let
e_v
=
eval_const_expr
(
tcx
,
expr
);
let
match
=
alt
check
ctor_id
{
let
match
_
=
alt
check
ctor_id
{
val
(
v
)
{
compare_const_vals
(
e_v
,
v
)
==
0
}
range
(
c_lo
,
c_hi
)
{
compare_const_vals
(
c_lo
,
e_v
)
>=
0
&&
compare_const_vals
(
c_hi
,
e_v
)
<=
0
}
single
{
true
}
};
if
match
{
some
(
vec
::
tail
(
r
))
}
else
{
none
}
if
match
_
{
some
(
vec
::
tail
(
r
))
}
else
{
none
}
}
pat_range
(
lo
,
hi
)
{
let
(
c_lo
,
c_hi
)
=
alt
check
ctor_id
{
...
...
@@ -348,9 +348,9 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
};
let
v_lo
=
eval_const_expr
(
tcx
,
lo
),
v_hi
=
eval_const_expr
(
tcx
,
hi
);
let
match
=
compare_const_vals
(
c_lo
,
v_lo
)
>=
0
&&
let
match
_
=
compare_const_vals
(
c_lo
,
v_lo
)
>=
0
&&
compare_const_vals
(
c_hi
,
v_hi
)
<=
0
;
if
match
{
some
(
vec
::
tail
(
r
))
}
else
{
none
}
if
match
_
{
some
(
vec
::
tail
(
r
))
}
else
{
none
}
}
}
}
...
...
src/rustc/middle/resolve3.rs
浏览文件 @
7b2026bf
此差异已折叠。
点击以展开。
src/rustc/middle/trans/alt.rs
浏览文件 @
7b2026bf
...
...
@@ -93,9 +93,9 @@ fn assoc(key: ast::ident, list: bind_map) -> option<ValueRef> {
data
:
@
{
bodycx
:
block
,
guard
:
option
<@
ast
::
expr
>
,
id_map
:
pat_id_map
}};
type
match
=
~
[
match_branch
];
type
match
_
=
~
[
match_branch
];
fn
has_nested_bindings
(
m
:
match
,
col
:
uint
)
->
bool
{
fn
has_nested_bindings
(
m
:
match
_
,
col
:
uint
)
->
bool
{
for
vec
::
each
(
m
)
|
br
|
{
alt
br
.pats
[
col
]
.node
{
ast
::
pat_ident
(
_
,
some
(
_
))
{
ret
true
;
}
...
...
@@ -105,7 +105,7 @@ fn has_nested_bindings(m: match, col: uint) -> bool {
ret
false
;
}
fn
expand_nested_bindings
(
m
:
match
,
col
:
uint
,
val
:
ValueRef
)
->
match
{
fn
expand_nested_bindings
(
m
:
match
_
,
col
:
uint
,
val
:
ValueRef
)
->
match_
{
let
mut
result
=
~
[];
for
vec
::
each
(
m
)
|
br
|
{
alt
br
.pats
[
col
]
.node
{
...
...
@@ -129,8 +129,8 @@ fn expand_nested_bindings(m: match, col: uint, val: ValueRef) -> match {
type
enter_pat
=
fn
(
@
ast
::
pat
)
->
option
<~
[
@
ast
::
pat
]
>
;
fn
enter_match
(
dm
:
DefMap
,
m
:
match
,
col
:
uint
,
val
:
ValueRef
,
e
:
enter_pat
)
->
match
{
fn
enter_match
(
dm
:
DefMap
,
m
:
match
_
,
col
:
uint
,
val
:
ValueRef
,
e
:
enter_pat
)
->
match
_
{
let
mut
result
=
~
[];
for
vec
::
each
(
m
)
|
br
|
{
alt
e
(
br
.pats
[
col
])
{
...
...
@@ -154,7 +154,7 @@ fn enter_match(dm: DefMap, m: match, col: uint, val: ValueRef,
ret
result
;
}
fn
enter_default
(
dm
:
DefMap
,
m
:
match
,
col
:
uint
,
val
:
ValueRef
)
->
match
{
fn
enter_default
(
dm
:
DefMap
,
m
:
match
_
,
col
:
uint
,
val
:
ValueRef
)
->
match_
{
do
enter_match
(
dm
,
m
,
col
,
val
)
|
p
|
{
alt
p
.node
{
ast
::
pat_wild
|
ast
::
pat_rec
(
_
,
_
)
|
ast
::
pat_tup
(
_
)
{
some
(
~
[])
}
...
...
@@ -166,8 +166,8 @@ fn enter_default(dm: DefMap, m: match, col: uint, val: ValueRef) -> match {
}
}
fn
enter_opt
(
tcx
:
ty
::
ctxt
,
m
:
match
,
opt
:
opt
,
col
:
uint
,
variant_size
:
uint
,
val
:
ValueRef
)
->
match
{
fn
enter_opt
(
tcx
:
ty
::
ctxt
,
m
:
match
_
,
opt
:
opt
,
col
:
uint
,
variant_size
:
uint
,
val
:
ValueRef
)
->
match
_
{
let
dummy
=
@
{
id
:
0
,
node
:
ast
::
pat_wild
,
span
:
dummy_sp
()};
do
enter_match
(
tcx
.def_map
,
m
,
col
,
val
)
|
p
|
{
alt
p
.node
{
...
...
@@ -192,8 +192,8 @@ fn enter_opt(tcx: ty::ctxt, m: match, opt: opt, col: uint,
}
}
fn
enter_rec
(
dm
:
DefMap
,
m
:
match
,
col
:
uint
,
fields
:
~
[
ast
::
ident
],
val
:
ValueRef
)
->
match
{
fn
enter_rec
(
dm
:
DefMap
,
m
:
match
_
,
col
:
uint
,
fields
:
~
[
ast
::
ident
],
val
:
ValueRef
)
->
match
_
{
let
dummy
=
@
{
id
:
0
,
node
:
ast
::
pat_wild
,
span
:
dummy_sp
()};
do
enter_match
(
dm
,
m
,
col
,
val
)
|
p
|
{
alt
p
.node
{
...
...
@@ -213,8 +213,8 @@ fn enter_rec(dm: DefMap, m: match, col: uint, fields: ~[ast::ident],
}
}
fn
enter_tup
(
dm
:
DefMap
,
m
:
match
,
col
:
uint
,
val
:
ValueRef
,
n_elts
:
uint
)
->
match
{
fn
enter_tup
(
dm
:
DefMap
,
m
:
match
_
,
col
:
uint
,
val
:
ValueRef
,
n_elts
:
uint
)
->
match
_
{
let
dummy
=
@
{
id
:
0
,
node
:
ast
::
pat_wild
,
span
:
dummy_sp
()};
do
enter_match
(
dm
,
m
,
col
,
val
)
|
p
|
{
alt
p
.node
{
...
...
@@ -224,7 +224,7 @@ fn enter_tup(dm: DefMap, m: match, col: uint, val: ValueRef,
}
}
fn
enter_box
(
dm
:
DefMap
,
m
:
match
,
col
:
uint
,
val
:
ValueRef
)
->
match
{
fn
enter_box
(
dm
:
DefMap
,
m
:
match
_
,
col
:
uint
,
val
:
ValueRef
)
->
match_
{
let
dummy
=
@
{
id
:
0
,
node
:
ast
::
pat_wild
,
span
:
dummy_sp
()};
do
enter_match
(
dm
,
m
,
col
,
val
)
|
p
|
{
alt
p
.node
{
...
...
@@ -234,7 +234,7 @@ fn enter_box(dm: DefMap, m: match, col: uint, val: ValueRef) -> match {
}
}
fn
enter_uniq
(
dm
:
DefMap
,
m
:
match
,
col
:
uint
,
val
:
ValueRef
)
->
match
{
fn
enter_uniq
(
dm
:
DefMap
,
m
:
match
_
,
col
:
uint
,
val
:
ValueRef
)
->
match_
{
let
dummy
=
@
{
id
:
0
,
node
:
ast
::
pat_wild
,
span
:
dummy_sp
()};
do
enter_match
(
dm
,
m
,
col
,
val
)
|
p
|
{
alt
p
.node
{
...
...
@@ -244,7 +244,7 @@ fn enter_uniq(dm: DefMap, m: match, col: uint, val: ValueRef) -> match {
}
}
fn
get_options
(
ccx
:
@
crate_ctxt
,
m
:
match
,
col
:
uint
)
->
~
[
opt
]
{
fn
get_options
(
ccx
:
@
crate_ctxt
,
m
:
match
_
,
col
:
uint
)
->
~
[
opt
]
{
fn
add_to_set
(
tcx
:
ty
::
ctxt
,
&&
set
:
dvec
<
opt
>
,
val
:
opt
)
{
if
set
.any
(|
l
|
opt_eq
(
tcx
,
l
,
val
))
{
ret
;}
set
.push
(
val
);
...
...
@@ -294,7 +294,7 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
ret
{
vals
:
args
,
bcx
:
bcx
};
}
fn
collect_record_fields
(
m
:
match
,
col
:
uint
)
->
~
[
ast
::
ident
]
{
fn
collect_record_fields
(
m
:
match
_
,
col
:
uint
)
->
~
[
ast
::
ident
]
{
let
mut
fields
:
~
[
ast
::
ident
]
=
~
[];
for
vec
::
each
(
m
)
|
br
|
{
alt
br
.pats
[
col
]
.node
{
...
...
@@ -311,7 +311,7 @@ fn collect_record_fields(m: match, col: uint) -> ~[ast::ident] {
ret
fields
;
}
fn
root_pats_as_necessary
(
bcx
:
block
,
m
:
match
,
col
:
uint
,
val
:
ValueRef
)
{
fn
root_pats_as_necessary
(
bcx
:
block
,
m
:
match
_
,
col
:
uint
,
val
:
ValueRef
)
{
for
vec
::
each
(
m
)
|
br
|
{
let
pat_id
=
br
.pats
[
col
]
.id
;
...
...
@@ -331,21 +331,21 @@ fn root_pats_as_necessary(bcx: block, m: match, col: uint, val: ValueRef) {
}
}
fn
any_box_pat
(
m
:
match
,
col
:
uint
)
->
bool
{
fn
any_box_pat
(
m
:
match
_
,
col
:
uint
)
->
bool
{
for
vec
::
each
(
m
)
|
br
|
{
alt
br
.pats
[
col
]
.node
{
ast
::
pat_box
(
_
)
{
ret
true
;
}
_
{
}
}
}
ret
false
;
}
fn
any_uniq_pat
(
m
:
match
,
col
:
uint
)
->
bool
{
fn
any_uniq_pat
(
m
:
match
_
,
col
:
uint
)
->
bool
{
for
vec
::
each
(
m
)
|
br
|
{
alt
br
.pats
[
col
]
.node
{
ast
::
pat_uniq
(
_
)
{
ret
true
;
}
_
{
}
}
}
ret
false
;
}
fn
any_tup_pat
(
m
:
match
,
col
:
uint
)
->
bool
{
fn
any_tup_pat
(
m
:
match
_
,
col
:
uint
)
->
bool
{
for
vec
::
each
(
m
)
|
br
|
{
alt
br
.pats
[
col
]
.node
{
ast
::
pat_tup
(
_
)
{
ret
true
;
}
_
{
}
}
}
...
...
@@ -355,7 +355,7 @@ fn any_tup_pat(m: match, col: uint) -> bool {
type
exit_node
=
{
bound
:
bind_map
,
from
:
BasicBlockRef
,
to
:
BasicBlockRef
};
type
mk_fail
=
fn
@
()
->
BasicBlockRef
;
fn
pick_col
(
m
:
match
)
->
uint
{
fn
pick_col
(
m
:
match
_
)
->
uint
{
fn
score
(
p
:
@
ast
::
pat
)
->
uint
{
alt
p
.node
{
ast
::
pat_lit
(
_
)
|
ast
::
pat_enum
(
_
,
_
)
|
ast
::
pat_range
(
_
,
_
)
{
1u
}
...
...
@@ -383,7 +383,7 @@ fn score(p: @ast::pat) -> uint {
ret
best_col
;
}
fn
compile_submatch
(
bcx
:
block
,
m
:
match
,
vals
:
~
[
ValueRef
],
fn
compile_submatch
(
bcx
:
block
,
m
:
match
_
,
vals
:
~
[
ValueRef
],
chk
:
option
<
mk_fail
>
,
&
exits
:
~
[
exit_node
])
{
/*
For an empty match, a fall-through case must exist
...
...
@@ -651,7 +651,7 @@ fn trans_alt_inner(scope_cx: block, expr: @ast::expr, arms: ~[ast::arm],
mode
:
ast
::
alt_mode
,
dest
:
dest
)
->
block
{
let
_
icx
=
scope_cx
.insn_ctxt
(
~
"alt::trans_alt_inner"
);
let
bcx
=
scope_cx
,
tcx
=
bcx
.tcx
();
let
mut
bodies
=
~
[],
match
=
~
[];
let
mut
bodies
=
~
[],
match
es
=
~
[];
let
{
bcx
,
val
,
_
}
=
trans_temp_expr
(
bcx
,
expr
);
if
bcx
.unreachable
{
ret
bcx
;
}
...
...
@@ -661,7 +661,7 @@ fn trans_alt_inner(scope_cx: block, expr: @ast::expr, arms: ~[ast::arm],
let
id_map
=
pat_util
::
pat_id_map
(
tcx
.def_map
,
a
.pats
[
0
]);
vec
::
push
(
bodies
,
body
);
for
vec
::
each
(
a
.pats
)
|
p
|
{
vec
::
push
(
match
,
@
{
pats
:
~
[
p
],
vec
::
push
(
match
es
,
@
{
pats
:
~
[
p
],
bound
:
~
[],
data
:
@
{
bodycx
:
body
,
guard
:
a
.guard
,
id_map
:
id_map
}});
...
...
@@ -698,7 +698,7 @@ fn mk_fail(bcx: block, sp: span, msg: ~str,
};
let
mut
exit_map
=
~
[];
let
spilled
=
spill_if_immediate
(
bcx
,
val
,
t
);
compile_submatch
(
bcx
,
match
,
~
[
spilled
],
mk_fail
,
exit_map
);
compile_submatch
(
bcx
,
match
es
,
~
[
spilled
],
mk_fail
,
exit_map
);
let
mut
arm_cxs
=
~
[],
arm_dests
=
~
[],
i
=
0u
;
for
vec
::
each
(
arms
)
|
a
|
{
...
...
src/rustc/middle/typeck/coherence.rs
浏览文件 @
7b2026bf
...
...
@@ -363,10 +363,10 @@ fn check_privileged_scopes(crate: @crate) {
visit_crate
(
*
crate
,
(),
mk_vt
(
@
{
visit_item
:
|
item
,
_
context
,
visitor
|
{
alt
item
.node
{
item_mod
(
module
)
{
item_mod
(
module
_
)
{
// First, gather up all privileged types.
let
privileged_types
=
self
.gather_privileged_types
(
module
.items
);
self
.gather_privileged_types
(
module
_
.items
);
for
privileged_types
.each
|
privileged_type
|
{
debug!
{
"(checking privileged scopes) entering
\
privileged scope of %d:%d"
,
...
...
@@ -377,7 +377,7 @@ fn check_privileged_scopes(crate: @crate) {
}
// Then visit the module items.
visit_mod
(
module
,
item
.span
,
item
.id
,
(),
visitor
);
visit_mod
(
module
_
,
item
.span
,
item
.id
,
(),
visitor
);
// Finally, remove privileged types from the map.
for
privileged_types
.each
|
privileged_type
|
{
...
...
src/rustdoc/config.rs
浏览文件 @
7b2026bf
...
...
@@ -101,11 +101,11 @@ fn parse_config_(
let
args
=
vec
::
tail
(
args
);
let
opts
=
vec
::
unzip
(
opts
())
.first
();
alt
getopts
::
getopts
(
args
,
opts
)
{
result
::
ok
(
match
)
{
if
vec
::
len
(
match
.free
)
==
1u
{
let
input_crate
=
vec
::
head
(
match
.free
);
config_from_opts
(
input_crate
,
match
,
program_output
)
}
else
if
vec
::
is_empty
(
match
.free
)
{
result
::
ok
(
match
es
)
{
if
vec
::
len
(
match
es
.free
)
==
1u
{
let
input_crate
=
vec
::
head
(
match
es
.free
);
config_from_opts
(
input_crate
,
match
es
,
program_output
)
}
else
if
vec
::
is_empty
(
match
es
.free
)
{
result
::
err
(
~
"no crates specified"
)
}
else
{
result
::
err
(
~
"multiple crates specified"
)
...
...
@@ -119,14 +119,14 @@ fn parse_config_(
fn
config_from_opts
(
input_crate
:
~
str
,
match
:
getopts
::
matches
,
match
es
:
getopts
::
matches
,
program_output
:
program_output
)
->
result
<
config
,
~
str
>
{
let
config
=
default_config
(
input_crate
);
let
result
=
result
::
ok
(
config
);
let
result
=
do
result
::
chain
(
result
)
|
config
|
{
let
output_dir
=
getopts
::
opt_maybe_str
(
match
,
opt_output_dir
());
let
output_dir
=
getopts
::
opt_maybe_str
(
match
es
,
opt_output_dir
());
result
::
ok
({
output_dir
:
option
::
get_default
(
output_dir
,
config
.output_dir
)
with
config
...
...
@@ -134,7 +134,7 @@ fn config_from_opts(
};
let
result
=
do
result
::
chain
(
result
)
|
config
|
{
let
output_format
=
getopts
::
opt_maybe_str
(
match
,
opt_output_format
());
match
es
,
opt_output_format
());
do
option
::
map_default
(
output_format
,
result
::
ok
(
config
))
|
output_format
|
{
do
result
::
chain
(
parse_output_format
(
output_format
))
...
...
@@ -148,7 +148,8 @@ fn config_from_opts(
}
};
let
result
=
do
result
::
chain
(
result
)
|
config
|
{
let
output_style
=
getopts
::
opt_maybe_str
(
match
,
opt_output_style
());
let
output_style
=
getopts
::
opt_maybe_str
(
matches
,
opt_output_style
());
do
option
::
map_default
(
output_style
,
result
::
ok
(
config
))
|
output_style
|
{
do
result
::
chain
(
parse_output_style
(
output_style
))
...
...
@@ -161,7 +162,7 @@ fn config_from_opts(
}
};
let
result
=
do
result
::
chain
(
result
)
|
config
|
{
let
pandoc_cmd
=
getopts
::
opt_maybe_str
(
match
,
opt_pandoc_cmd
());
let
pandoc_cmd
=
getopts
::
opt_maybe_str
(
match
es
,
opt_pandoc_cmd
());
let
pandoc_cmd
=
maybe_find_pandoc
(
config
,
pandoc_cmd
,
program_output
);
do
result
::
chain
(
pandoc_cmd
)
|
pandoc_cmd
|
{
...
...
src/rustdoc/extract.rs
浏览文件 @
7b2026bf
...
...
@@ -52,11 +52,11 @@ fn mk_itemdoc(id: ast::node_id, name: ast::ident) -> doc::itemdoc {
fn
moddoc_from_mod
(
itemdoc
:
doc
::
itemdoc
,
module
:
ast
::
_
mod
module
_
:
ast
::
_
mod
)
->
doc
::
moddoc
{
doc
::
moddoc_
({
item
:
itemdoc
,
items
:
do
vec
::
filter_map
(
module
.items
)
|
item
|
{
items
:
do
vec
::
filter_map
(
module
_
.items
)
|
item
|
{
let
itemdoc
=
mk_itemdoc
(
item
.id
,
item
.ident
);
alt
item
.node
{
ast
::
item_mod
(
m
)
{
...
...
@@ -110,11 +110,11 @@ fn moddoc_from_mod(
fn
nmoddoc_from_mod
(
itemdoc
:
doc
::
itemdoc
,
module
:
ast
::
foreign_mod
module
_
:
ast
::
foreign_mod
)
->
doc
::
nmoddoc
{
{
item
:
itemdoc
,
fns
:
do
vec
::
map
(
module
.items
)
|
item
|
{
fns
:
do
vec
::
map
(
module
_
.items
)
|
item
|
{
let
itemdoc
=
mk_itemdoc
(
item
.id
,
item
.ident
);
alt
item
.node
{
ast
::
foreign_item_fn
(
_
,
_
)
{
...
...
src/test/compile-fail/attr-bad-crate-attr.rc
浏览文件 @
7b2026bf
// error-pattern: expected `mod`
// error-pattern: expected `mod
ule
`
#[attr = "val"];
#[attr = "val"] // Unterminated
src/test/run-pass/keyword-changes-2012-07-31.rs
0 → 100644
浏览文件 @
7b2026bf
// ret -> return
// mod -> module
// alt -> match
fn
main
()
{
}
mod
foo
{
}
fn
bar
()
->
int
{
match
0
{
_
{
0
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录