Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7661c084
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,发现更多精彩内容 >>
提交
7661c084
编写于
7月 06, 2011
作者:
M
Marijn Haverbeke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove temporary stdlib placeholders, use actual stdlib functions
(Possible now that a snapshot took place.)
上级
4c315666
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
53 addition
and
87 deletion
+53
-87
src/comp/back/x86.rs
src/comp/back/x86.rs
+0
-1
src/comp/driver/rustc.rs
src/comp/driver/rustc.rs
+1
-1
src/comp/lib/llvm.rs
src/comp/lib/llvm.rs
+3
-4
src/comp/metadata/creader.rs
src/comp/metadata/creader.rs
+1
-1
src/comp/metadata/tyencode.rs
src/comp/metadata/tyencode.rs
+3
-2
src/comp/middle/alias.rs
src/comp/middle/alias.rs
+1
-1
src/comp/middle/resolve.rs
src/comp/middle/resolve.rs
+2
-2
src/comp/middle/trans.rs
src/comp/middle/trans.rs
+5
-5
src/comp/middle/tstate/annotate.rs
src/comp/middle/tstate/annotate.rs
+6
-6
src/comp/middle/tstate/auxiliary.rs
src/comp/middle/tstate/auxiliary.rs
+12
-9
src/comp/middle/tstate/collect_locals.rs
src/comp/middle/tstate/collect_locals.rs
+4
-4
src/comp/middle/tstate/pre_post_conditions.rs
src/comp/middle/tstate/pre_post_conditions.rs
+1
-3
src/comp/middle/tstate/states.rs
src/comp/middle/tstate/states.rs
+0
-1
src/comp/middle/typeck.rs
src/comp/middle/typeck.rs
+2
-2
src/comp/rustc.rc
src/comp/rustc.rc
+0
-1
src/comp/syntax/_std.rs
src/comp/syntax/_std.rs
+0
-29
src/comp/syntax/ext/base.rs
src/comp/syntax/ext/base.rs
+1
-1
src/comp/syntax/parse/parser.rs
src/comp/syntax/parse/parser.rs
+1
-1
src/comp/syntax/parse/token.rs
src/comp/syntax/parse/token.rs
+1
-1
src/comp/syntax/print/pprust.rs
src/comp/syntax/print/pprust.rs
+4
-6
src/comp/util/ppaux.rs
src/comp/util/ppaux.rs
+5
-6
未找到文件。
src/comp/back/x86.rs
浏览文件 @
7661c084
...
...
@@ -4,7 +4,6 @@
import
std
::
str
;
import
std
::
vec
;
import
std
::
os
::
target_os
;
import
syntax
::
_
std
::
istr
;
fn
get_module_asm
()
->
str
{
ret
""
;
}
...
...
src/comp/driver/rustc.rs
浏览文件 @
7661c084
...
...
@@ -343,7 +343,7 @@ fn build_session_options(str binary, getopts::match match, str binary_dir) ->
fn
build_session
(
@
session
::
options
sopts
)
->
session
::
session
{
auto
target_cfg
=
build_target_config
();
auto
crate_cache
=
s
yntax
::
_
std
::
new_int_hash
[
session
::
crate_metadata
]();
auto
crate_cache
=
s
td
::
map
::
new_int_hash
[
session
::
crate_metadata
]();
ret
session
::
session
(
target_cfg
,
sopts
,
crate_cache
,
[],
[],
[],
codemap
::
new_codemap
(),
0u
);
}
...
...
src/comp/lib/llvm.rs
浏览文件 @
7661c084
...
...
@@ -1457,7 +1457,7 @@ fn get_type(str s) -> TypeRef {
}
fn
mk_type_names
()
->
type_names
{
auto
nt
=
s
yntax
::
_
std
::
new_str_hash
[
TypeRef
]();
auto
nt
=
s
td
::
map
::
new_str_hash
[
TypeRef
]();
fn
hash
(
&
TypeRef
t
)
->
uint
{
ret
t
as
uint
;
...
...
@@ -1519,8 +1519,7 @@ fn tys_str(type_names names,
case
(
6
)
{
ret
"Label"
;
}
case
(
7
)
{
ret
"i"
+
syntax
::
_
std
::
istr
(
llvm
::
LLVMGetIntTypeWidth
(
ty
)
as
int
);
ret
"i"
+
std
::
int
::
str
(
llvm
::
LLVMGetIntTypeWidth
(
ty
)
as
int
);
}
case
(
8
)
{
...
...
@@ -1558,7 +1557,7 @@ fn tys_str(type_names names,
i
+=
1u
;
if
(
tout
as
int
==
ty
as
int
)
{
let
uint
n
=
vec
::
len
[
TypeRef
](
outer0
)
-
i
;
ret
"*
\\
"
+
s
yntax
::
_
std
::
i
str
(
n
as
int
);
ret
"*
\\
"
+
s
td
::
int
::
str
(
n
as
int
);
}
}
ret
"*"
+
type_to_str_inner
(
names
,
outer
,
...
...
src/comp/metadata/creader.rs
浏览文件 @
7661c084
...
...
@@ -201,7 +201,7 @@ fn read_crates(session::session sess, resolve::crate_map crate_map,
auto
e
=
@
rec
(
sess
=
sess
,
crate_map
=
crate_map
,
crate_cache
=@
s
yntax
::
_
std
::
new_str_hash
[
int
](),
crate_cache
=@
s
td
::
map
::
new_str_hash
[
int
](),
library_search_paths
=
sess
.get_opts
()
.library_search_paths
,
mutable
next_crate_num
=
1
);
auto
v
=
...
...
src/comp/metadata/tyencode.rs
浏览文件 @
7661c084
...
...
@@ -4,6 +4,7 @@
import
std
::
map
::
hashmap
;
import
std
::
option
::
some
;
import
std
::
option
::
none
;
import
std
::
int
;
import
std
::
uint
;
import
syntax
::
ast
::
*
;
import
middle
::
ty
;
...
...
@@ -182,7 +183,7 @@ fn enc_sty(&io::writer w, &@ctxt cx, &ty::sty st) {
}
case
(
ty
::
ty_var
(
?
id
))
{
w
.write_char
(
'X'
);
w
.write_str
(
syntax
::
_
std
::
i
str
(
id
));
w
.write_str
(
int
::
str
(
id
));
}
case
(
ty
::
ty_native
(
?
def
))
{
w
.write_char
(
'E'
);
...
...
@@ -191,7 +192,7 @@ fn enc_sty(&io::writer w, &@ctxt cx, &ty::sty st) {
}
case
(
ty
::
ty_param
(
?
id
))
{
w
.write_char
(
'p'
);
w
.write_str
(
syntax
::
_
std
::
ui
str
(
id
));
w
.write_str
(
uint
::
str
(
id
));
}
case
(
ty
::
ty_type
)
{
w
.write_char
(
'Y'
);
}
case
(
ty
::
ty_task
)
{
w
.write_char
(
'a'
);
}
...
...
src/comp/middle/alias.rs
浏览文件 @
7661c084
...
...
@@ -45,7 +45,7 @@ fn check_crate(@ty::ctxt tcx, &@ast::crate crate) {
// Stores information about object fields and function
// arguments that's otherwise not easily available.
local_map
=
s
yntax
::
_
std
::
new_int_hash
());
local_map
=
s
td
::
map
::
new_int_hash
());
auto
v
=
@
rec
(
visit_fn
=
bind
visit_fn
(
cx
,
_
,
_
,
_
,
_
,
_
,
_
,
_
),
visit_item
=
bind
visit_item
(
cx
,
_
,
_
,
_
),
...
...
src/comp/middle/resolve.rs
浏览文件 @
7661c084
...
...
@@ -11,8 +11,8 @@
import
metadata
::
decoder
;
import
driver
::
session
::
session
;
import
util
::
common
::
new_def_hash
;
import
s
yntax
::
_
std
::
new_int_hash
;
import
s
yntax
::
_
std
::
new_str_hash
;
import
s
td
::
map
::
new_int_hash
;
import
s
td
::
map
::
new_str_hash
;
import
syntax
::
codemap
::
span
;
import
syntax
::
ast
::
respan
;
import
middle
::
ty
::
constr_table
;
...
...
src/comp/middle/trans.rs
浏览文件 @
7661c084
...
...
@@ -36,10 +36,9 @@
import
syntax
::
visit
;
import
visit
::
vt
;
import
util
::
common
;
import
syntax
::
_
std
::
istr
;
import
util
::
common
::
new_def_hash
;
import
s
yntax
::
_
std
::
new_int_hash
;
import
s
yntax
::
_
std
::
new_str_hash
;
import
s
td
::
map
::
new_int_hash
;
import
s
td
::
map
::
new_str_hash
;
import
util
::
common
::
local_rhs_span
;
import
syntax
::
codemap
::
span
;
import
lib
::
llvm
::
llvm
;
...
...
@@ -73,7 +72,7 @@
import
syntax
::
print
::
pprust
::
path_to_str
;
obj
namegen
(
mutable
int
i
)
{
fn
next
(
str
prefix
)
->
str
{
i
+=
1
;
ret
prefix
+
istr
(
i
);
}
fn
next
(
str
prefix
)
->
str
{
i
+=
1
;
ret
prefix
+
i
nt
::
str
(
i
);
}
}
type
derived_tydesc_info
=
rec
(
ValueRef
lltydesc
,
bool
escapes
);
...
...
@@ -4432,7 +4431,8 @@ fn build_environment(&@block_ctxt cx, &vec[ast::node_id] upvars) ->
case
(
some
(
?
x
))
{
llbinding
=
x
;
}
case
(
_
)
{
cx
.fcx.lcx.ccx.sess
.bug
(
"unbound var
\
in build_environment "
+
istr
(
nid
));
}
in build_environment "
+
int
::
str
(
nid
));
}
}
}
case
(
some
(
?
llval
))
{
llbinding
=
llval
;
}
...
...
src/comp/middle/tstate/annotate.rs
浏览文件 @
7661c084
...
...
@@ -3,12 +3,12 @@
import
std
::
option
;
import
std
::
option
::
some
;
import
std
::
option
::
none
;
import
std
::
int
;
import
std
::
uint
;
import
syntax
::
ast
::
*
;
import
syntax
::
walk
;
import
syntax
::
codemap
::
span
;
import
syntax
::
_
std
::
istr
;
import
syntax
::
_
std
::
uistr
;
import
syntax
::
_
std
::
new_str_hash
;
import
std
::
map
::
new_str_hash
;
import
util
::
common
::
log_expr_err
;
import
util
::
common
::
log_block_err
;
import
util
::
common
::
log_item_err
;
...
...
@@ -35,12 +35,12 @@ fn collect_ids_block(&block b, @mutable vec[node_id] rs) {
fn
collect_ids_stmt
(
&@
stmt
s
,
@
mutable
vec
[
node_id
]
rs
)
{
alt
(
s
.node
)
{
case
(
stmt_decl
(
_
,
?
id
))
{
log
"node_id "
+
istr
(
id
);
log
"node_id "
+
i
nt
::
str
(
id
);
log_stmt
(
*
s
);
vec
::
push
(
*
rs
,
id
);
}
case
(
stmt_expr
(
_
,
?
id
))
{
log
"node_id "
+
istr
(
id
);
log
"node_id "
+
i
nt
::
str
(
id
);
log_stmt
(
*
s
);
vec
::
push
(
*
rs
,
id
);
}
...
...
@@ -65,7 +65,7 @@ fn node_ids_in_fn(&_fn f, &vec[ty_param] tps, &span sp, &fn_ident i,
fn
init_vecs
(
&
crate_ctxt
ccx
,
&
vec
[
node_id
]
node_ids
,
uint
len
)
{
for
(
node_id
i
in
node_ids
)
{
log
i
str
(
i
)
+
" |-> "
+
ui
str
(
len
);
log
i
nt
::
str
(
i
)
+
" |-> "
+
uint
::
str
(
len
);
add_node
(
ccx
,
i
,
empty_ann
(
len
));
}
}
...
...
src/comp/middle/tstate/auxiliary.rs
浏览文件 @
7661c084
...
...
@@ -7,15 +7,15 @@
import
std
::
option
::
none
;
import
std
::
option
::
some
;
import
std
::
option
::
maybe
;
import
std
::
int
;
import
std
::
uint
;
import
syntax
::
ast
::
*
;
import
syntax
::
codemap
::
span
;
import
util
::
common
;
import
util
::
common
::
log_block
;
import
s
yntax
::
_
std
::
new_int_hash
;
import
s
yntax
::
_
std
::
new_uint_hash
;
import
s
td
::
map
::
new_int_hash
;
import
s
td
::
map
::
new_uint_hash
;
import
util
::
common
::
log_expr_err
;
import
syntax
::
_
std
::
istr
;
import
syntax
::
_
std
::
uistr
;
import
util
::
common
::
lit_eq
;
import
syntax
::
print
::
pprust
::
path_to_str
;
import
tstate
::
ann
::
pre_and_post
;
...
...
@@ -44,7 +44,9 @@
/* logging funs */
fn
def_id_to_str
(
def_id
d
)
->
str
{
ret
istr
(
d
._0
)
+
","
+
istr
(
d
._1
);
}
fn
def_id_to_str
(
def_id
d
)
->
str
{
ret
int
::
str
(
d
._0
)
+
","
+
int
::
str
(
d
._1
);
}
fn
comma_str
(
vec
[
@
constr_arg_use
]
args
)
->
str
{
auto
rslt
=
""
;
...
...
@@ -259,7 +261,8 @@ fn get_ts_ann(&crate_ctxt ccx, node_id i) -> option::t[ts_ann] {
fn
node_id_to_ts_ann
(
&
crate_ctxt
ccx
,
node_id
id
)
->
ts_ann
{
alt
(
get_ts_ann
(
ccx
,
id
))
{
case
(
none
)
{
log_err
"node_id_to_ts_ann: no ts_ann for node_id "
+
istr
(
id
);
log_err
"node_id_to_ts_ann: no ts_ann for node_id "
+
int
::
str
(
id
);
fail
;
}
case
(
some
(
?
t
))
{
ret
t
;
}
...
...
@@ -460,7 +463,7 @@ fn constraints_expr(&ty::ctxt cx, @expr e) -> vec[@ty::constr_def] {
fn
node_id_to_def_strict
(
&
ty
::
ctxt
cx
,
node_id
id
)
->
def
{
alt
(
cx
.def_map
.find
(
id
))
{
case
(
none
)
{
log_err
"node_id_to_def: node_id "
+
istr
(
id
)
+
" has no def"
;
log_err
"node_id_to_def: node_id "
+
i
nt
::
str
(
id
)
+
" has no def"
;
fail
;
}
case
(
some
(
?
d
))
{
ret
d
;
}
...
...
@@ -518,7 +521,7 @@ fn eq(&tup(ident, def_id) p, &tup(ident, def_id) q) -> bool {
fn
node_id_for_constr
(
ty
::
ctxt
tcx
,
node_id
t
)
->
node_id
{
alt
(
tcx
.def_map
.find
(
t
))
{
case
(
none
)
{
tcx
.sess
.bug
(
"node_id_for_constr: bad node_id "
+
istr
(
t
));
tcx
.sess
.bug
(
"node_id_for_constr: bad node_id "
+
i
nt
::
str
(
t
));
}
case
(
some
(
def_fn
(
?
i
,
_
)))
{
ret
i
._1
;
}
case
(
_
)
{
...
...
@@ -590,7 +593,7 @@ fn expr_to_constr(ty::ctxt tcx, &@expr e) -> constr {
}
fn
pred_desc_to_str
(
&
pred_desc
p
)
->
str
{
ret
"<"
+
uistr
(
p
.node.bit_num
)
+
", "
+
ret
"<"
+
ui
nt
::
str
(
p
.node.bit_num
)
+
", "
+
constr_args_to_str
(
std
::
util
::
fst
[
ident
,
def_id
],
p
.node.args
)
+
">"
;
}
...
...
src/comp/middle/tstate/collect_locals.rs
浏览文件 @
7661c084
...
...
@@ -21,9 +21,8 @@
import
aux
::
expr_to_constr
;
import
aux
::
constraints_expr
;
import
aux
::
node_id_to_def_strict
;
import
s
yntax
::
_
std
::
new_int_hash
;
import
s
td
::
map
::
new_int_hash
;
import
util
::
common
::
new_def_hash
;
import
syntax
::
_
std
::
uistr
;
import
syntax
::
codemap
::
span
;
import
syntax
::
ast
::
respan
;
...
...
@@ -82,7 +81,7 @@ fn find_locals(&ty::ctxt tcx, &_fn f, &vec[ty_param] tps,
fn
add_constraint
(
&
ty
::
ctxt
tcx
,
aux
::
constr
c
,
uint
next
,
constr_map
tbl
)
->
uint
{
log
aux
::
constraint_to_str
(
tcx
,
c
)
+
" |-> "
+
ui
str
(
next
);
log
aux
::
constraint_to_str
(
tcx
,
c
)
+
" |-> "
+
std
::
uint
::
str
(
next
);
alt
(
c
.node.c
)
{
case
(
ninit
(
?
i
))
{
tbl
.insert
(
c
.node.id
,
cinit
(
next
,
c
.span
,
i
));
}
case
(
npred
(
?
p
,
?
args
))
{
...
...
@@ -142,7 +141,8 @@ fn mk_fn_info(&crate_ctxt ccx, &_fn f, &vec[ty_param] tp,
cf
=
f
.decl.cf
,
used_vars
=
v
);
ccx
.fm
.insert
(
id
,
rslt
);
log
name
+
" has "
+
uistr
(
num_constraints
(
rslt
))
+
" constraints"
;
log
name
+
" has "
+
std
::
uint
::
str
(
num_constraints
(
rslt
))
+
" constraints"
;
}
...
...
src/comp/middle/tstate/pre_post_conditions.rs
浏览文件 @
7661c084
...
...
@@ -66,10 +66,8 @@
import
bitvectors
::
relax_precond_block
;
import
bitvectors
::
gen
;
import
syntax
::
ast
::
*
;
import
s
yntax
::
_
std
::
new_int_hash
;
import
s
td
::
map
::
new_int_hash
;
import
util
::
common
::
new_def_hash
;
import
syntax
::
_
std
::
istr
;
import
syntax
::
_
std
::
uistr
;
import
util
::
common
::
log_expr
;
import
util
::
common
::
log_fn
;
import
util
::
common
::
elt_exprs
;
...
...
src/comp/middle/tstate/states.rs
浏览文件 @
7661c084
...
...
@@ -80,7 +80,6 @@
import
middle
::
ty
::
type_is_nil
;
import
middle
::
ty
::
type_is_bot
;
import
util
::
common
::
new_def_hash
;
import
syntax
::
_
std
::
uistr
;
import
util
::
common
::
log_expr
;
import
util
::
common
::
log_block
;
import
util
::
common
::
log_block_err
;
...
...
src/comp/middle/typeck.rs
浏览文件 @
7661c084
...
...
@@ -9,7 +9,7 @@
import
driver
::
session
;
import
util
::
common
;
import
syntax
::
codemap
::
span
;
import
s
yntax
::
_
std
::
new_int_hash
;
import
s
td
::
map
::
new_int_hash
;
import
util
::
common
::
new_def_hash
;
import
util
::
common
::
log_expr_err
;
import
middle
::
ty
;
...
...
@@ -537,7 +537,7 @@ fn getter(@ctxt cx, &ast::def_id id) -> ty::ty_param_count_and_ty {
}
case
(
_
)
{
cx
.tcx.sess
.fatal
(
"internal error "
+
s
yntax
::
_
std
::
i
str
(
id
._1
));
s
td
::
int
::
str
(
id
._1
));
}
}
ret
tpt
;
...
...
src/comp/rustc.rc
浏览文件 @
7661c084
...
...
@@ -37,7 +37,6 @@ mod middle {
mod
syntax
{
mod
_
std
;
// FIXME remove
mod
ast
;
mod
fold
;
mod
walk
;
...
...
src/comp/syntax/_std.rs
已删除
100644 → 0
浏览文件 @
4c315666
// FIXME all this stuff should be in the standard lib, and in fact is,
// but due to the way our snapshots currently work, rustc can't use it
// until after the next snapshot.
fn
new_str_hash
[
V
]()
->
std
::
map
::
hashmap
[
str
,
V
]
{
let
std
::
map
::
hashfn
[
str
]
hasher
=
std
::
str
::
hash
;
let
std
::
map
::
eqfn
[
str
]
eqer
=
std
::
str
::
eq
;
ret
std
::
map
::
mk_hashmap
[
str
,
V
](
hasher
,
eqer
);
}
fn
new_int_hash
[
V
]()
->
std
::
map
::
hashmap
[
int
,
V
]
{
fn
hash_int
(
&
int
x
)
->
uint
{
ret
x
as
uint
;
}
fn
eq_int
(
&
int
a
,
&
int
b
)
->
bool
{
ret
a
==
b
;
}
auto
hasher
=
hash_int
;
auto
eqer
=
eq_int
;
ret
std
::
map
::
mk_hashmap
[
int
,
V
](
hasher
,
eqer
);
}
fn
new_uint_hash
[
V
]()
->
std
::
map
::
hashmap
[
uint
,
V
]
{
fn
hash_uint
(
&
uint
x
)
->
uint
{
ret
x
;
}
fn
eq_uint
(
&
uint
a
,
&
uint
b
)
->
bool
{
ret
a
==
b
;
}
auto
hasher
=
hash_uint
;
auto
eqer
=
eq_uint
;
ret
std
::
map
::
mk_hashmap
[
uint
,
V
](
hasher
,
eqer
);
}
fn
istr
(
int
i
)
->
str
{
ret
std
::
int
::
to_str
(
i
,
10u
);
}
fn
uistr
(
uint
i
)
->
str
{
ret
std
::
uint
::
to_str
(
i
,
10u
);
}
src/comp/syntax/ext/base.rs
浏览文件 @
7661c084
...
...
@@ -3,7 +3,7 @@
import
std
::
map
::
hashmap
;
import
parse
::
parser
::
parse_sess
;
import
codemap
::
span
;
import
s
yntax
::
_
std
::
new_str_hash
;
import
s
td
::
map
::
new_str_hash
;
import
codemap
;
type
syntax_expander
=
...
...
src/comp/syntax/parse/parser.rs
浏览文件 @
7661c084
...
...
@@ -12,7 +12,7 @@
import
token
::
can_begin_expr
;
import
ex
=
ext
::
base
;
import
codemap
::
span
;
import
_
std
::
new_str_hash
;
import
std
::
map
::
new_str_hash
;
import
util
::
interner
;
tag
restriction
{
UNRESTRICTED
;
RESTRICT_NO_CALL_EXPRS
;
}
...
...
src/comp/syntax/parse/token.rs
浏览文件 @
7661c084
import
ast
::
ty_mach
;
import
ast
::
ty_mach_to_str
;
import
_
std
::
new_str_hash
;
import
std
::
map
::
new_str_hash
;
import
util
::
interner
;
import
std
::
int
;
import
std
::
uint
;
...
...
src/comp/syntax/print/pprust.rs
浏览文件 @
7661c084
...
...
@@ -8,8 +8,6 @@
import
parse
::
lexer
;
import
syntax
::
codemap
::
codemap
;
import
ast
;
import
_
std
::
istr
;
import
_
std
::
uistr
;
import
option
::
some
;
import
option
::
none
;
import
pp
::
printer
;
...
...
@@ -1294,11 +1292,11 @@ fn print_literal(&ps s, &@ast::lit lit) {
word
(
s
.s
,
"'"
+
escape_str
(
str
::
from_bytes
([
ch
as
u8
]),
'\''
)
+
"'"
);
}
case
(
ast
::
lit_int
(
?
val
))
{
word
(
s
.s
,
istr
(
val
));
}
case
(
ast
::
lit_uint
(
?
val
))
{
word
(
s
.s
,
uistr
(
val
)
+
"u"
);
}
case
(
ast
::
lit_int
(
?
val
))
{
word
(
s
.s
,
i
nt
::
str
(
val
));
}
case
(
ast
::
lit_uint
(
?
val
))
{
word
(
s
.s
,
ui
nt
::
str
(
val
)
+
"u"
);
}
case
(
ast
::
lit_float
(
?
fstr
))
{
word
(
s
.s
,
fstr
);
}
case
(
ast
::
lit_mach_int
(
?
mach
,
?
val
))
{
word
(
s
.s
,
istr
(
val
as
int
));
word
(
s
.s
,
i
nt
::
str
(
val
as
int
));
word
(
s
.s
,
ast
::
ty_mach_to_str
(
mach
));
}
case
(
ast
::
lit_mach_float
(
?
mach
,
?
val
))
{
...
...
@@ -1446,7 +1444,7 @@ fn constr_arg_to_str[T](fn(&T) -> str f, &ast::constr_arg_general_[T] c) ->
// needed b/c constr_args_to_str needs
// something that takes an alias
// (argh)
fn
uint_to_str
(
&
uint
i
)
->
str
{
ret
uistr
(
i
);
}
fn
uint_to_str
(
&
uint
i
)
->
str
{
ret
ui
nt
::
str
(
i
);
}
fn
ast_constr_to_str
(
&@
ast
::
constr
c
)
->
str
{
ret
ast
::
path_to_str
(
c
.node.path
)
+
...
...
src/comp/util/ppaux.rs
浏览文件 @
7661c084
import
std
::
io
;
import
std
::
vec
;
import
std
::
str
;
import
std
::
int
;
import
std
::
option
;
import
std
::
option
::
none
;
import
std
::
option
::
some
;
...
...
@@ -12,8 +13,6 @@
import
pp
::
eof
;
import
pp
::
zerobreak
;
import
pp
::
hardbreak
;
import
syntax
::
_
std
::
istr
;
import
syntax
::
_
std
::
uistr
;
import
ast
::
ty_mach_to_str
;
import
syntax
::
ast
;
...
...
@@ -34,7 +33,7 @@ fn mode_str_1(&ty::mode m) -> str {
fn
fn_ident_to_string
(
ast
::
node_id
id
,
&
ast
::
fn_ident
i
)
->
str
{
ret
alt
(
i
)
{
case
(
none
)
{
"anon"
+
istr
(
id
)
}
case
(
none
)
{
"anon"
+
i
nt
::
str
(
id
)
}
case
(
some
(
?
s
))
{
s
}
};
}
...
...
@@ -118,7 +117,7 @@ fn mt_to_str(&ctxt cx, &mt m) -> str {
case
(
ty_tag
(
?
id
,
?
tps
))
{
// The user should never see this if the cname is set properly!
s
+=
"<tag#"
+
i
str
(
id
._0
)
+
":"
+
i
str
(
id
._1
)
+
">"
;
s
+=
"<tag#"
+
i
nt
::
str
(
id
._0
)
+
":"
+
int
::
str
(
id
._1
)
+
">"
;
if
(
vec
::
len
[
t
](
tps
)
>
0u
)
{
auto
f
=
bind
ty_to_str
(
cx
,
_
);
auto
strs
=
vec
::
map
[
t
,
str
](
f
,
tps
);
...
...
@@ -138,9 +137,9 @@ fn mt_to_str(&ctxt cx, &mt m) -> str {
s
+=
"obj {
\n\t
"
+
str
::
connect
(
m
,
"
\n\t
"
)
+
"
\n
}"
;
}
case
(
ty_res
(
?
id
,
_
,
_
))
{
s
+=
"<resource#"
+
i
str
(
id
._0
)
+
":"
+
i
str
(
id
._1
)
+
">"
;
s
+=
"<resource#"
+
i
nt
::
str
(
id
._0
)
+
":"
+
int
::
str
(
id
._1
)
+
">"
;
}
case
(
ty_var
(
?
v
))
{
s
+=
"<T"
+
istr
(
v
)
+
">"
;
}
case
(
ty_var
(
?
v
))
{
s
+=
"<T"
+
i
nt
::
str
(
v
)
+
">"
;
}
case
(
ty_param
(
?
id
))
{
s
+=
"'"
+
str
::
unsafe_from_bytes
([(
'a'
as
u8
)
+
(
id
as
u8
)]);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录