Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
59221e9a
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,发现更多精彩内容 >>
提交
59221e9a
编写于
6月 28, 2012
作者:
E
Eric Holk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace more vector + (issue #2719)
上级
58a39d1c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
106 addition
and
66 deletion
+106
-66
src/libcore/vec.rs
src/libcore/vec.rs
+8
-0
src/libsyntax/ast_map.rs
src/libsyntax/ast_map.rs
+1
-1
src/libsyntax/ext/auto_serialize.rs
src/libsyntax/ext/auto_serialize.rs
+9
-8
src/rustc/middle/trans/alt.rs
src/rustc/middle/trans/alt.rs
+23
-17
src/rustc/middle/trans/base.rs
src/rustc/middle/trans/base.rs
+42
-26
src/rustc/middle/trans/closure.rs
src/rustc/middle/trans/closure.rs
+8
-5
src/rustc/middle/trans/common.rs
src/rustc/middle/trans/common.rs
+6
-4
src/rustc/middle/trans/impl.rs
src/rustc/middle/trans/impl.rs
+8
-4
src/rustc/middle/trans/type_of.rs
src/rustc/middle/trans/type_of.rs
+1
-1
未找到文件。
src/libcore/vec.rs
浏览文件 @
59221e9a
...
...
@@ -5,6 +5,7 @@
import
libc
::
size_t
;
export
append
;
export
append_one
;
export
init_op
;
export
is_empty
;
export
is_not_empty
;
...
...
@@ -492,6 +493,13 @@ fn push_all_move<T>(&v: [const T]/~, -rhs: [const T]/~) {
ret
v
;
}
#[inline(always)]
pure
fn
append_one
<
T
>
(
+
lhs
:
[
T
]
/~
,
+
x
:
T
)
->
[
T
]
/~
{
let
mut
v
<-
lhs
;
unchecked
{
push
(
v
,
x
);
}
v
}
#[inline(always)]
pure
fn
append_mut
<
T
:
copy
>
(
lhs
:
[
mut
T
]
/&
,
rhs
:
[
const
T
]
/&
)
->
[
mut
T
]
/~
{
let
mut
v
=
[
mut
]
/~
;
...
...
src/libsyntax/ast_map.rs
浏览文件 @
59221e9a
...
...
@@ -57,7 +57,7 @@ enum ast_node {
type
vt
=
visit
::
vt
<
ctx
>
;
fn
extend
(
cx
:
ctx
,
+
elt
:
ident
)
->
@
path
{
@
(
cx
.path
+
[
path_name
(
elt
)]
/~
)
@
(
vec
::
append
(
cx
.path
,
[
path_name
(
elt
)]
/~
)
)
}
fn
mk_ast_map_visitor
()
->
vt
{
...
...
src/libsyntax/ext/auto_serialize.rs
浏览文件 @
59221e9a
...
...
@@ -740,14 +740,15 @@ fn mk_deser_fn(cx: ext_ctxt, span: span,
[]
/~
))]
/~
;
let
deser_tps
:
[
ast
::
ty_param
]
/~
=
[{
ident
:
@
"__D"
,
id
:
cx
.next_id
(),
bounds
:
deser_bnds
}]
/~
+
vec
::
map
(
tps
)
{|
tp
|
let
cloned
=
cx
.clone_ty_param
(
tp
);
{
bounds
:
@
(
vec
::
append
(
*
cloned
.bounds
,
[
ast
::
bound_copy
]
/~
))
with
cloned
}
};
vec
::
append
([{
ident
:
@
"__D"
,
id
:
cx
.next_id
(),
bounds
:
deser_bnds
}]
/~
,
vec
::
map
(
tps
)
{|
tp
|
let
cloned
=
cx
.clone_ty_param
(
tp
);
{
bounds
:
@
(
vec
::
append
(
*
cloned
.bounds
,
[
ast
::
bound_copy
]
/~
))
with
cloned
}
});
let
deser_blk
=
cx
.expr_blk
(
f
(
cx
,
tps_map
,
#
ast
(
expr
){
__
d
}));
...
...
src/rustc/middle/trans/alt.rs
浏览文件 @
59221e9a
...
...
@@ -108,12 +108,16 @@ fn expand_nested_bindings(m: match, col: uint, val: ValueRef) -> match {
for
vec
::
each
(
m
)
{|
br
|
alt
br
.pats
[
col
]
.node
{
ast
::
pat_ident
(
name
,
some
(
inner
))
{
let
pats
=
vec
::
slice
(
br
.pats
,
0u
,
col
)
+
[
inner
]
/~
+
vec
::
slice
(
br
.pats
,
col
+
1u
,
br
.pats
.len
());
vec
::
push
(
result
,
@
{
pats
:
pats
,
bound
:
br
.bound
+
[{
ident
:
path_to_ident
(
name
),
val
:
val
}]
/~
with
*
br
});
let
pats
=
vec
::
append
(
vec
::
slice
(
br
.pats
,
0u
,
col
),
vec
::
append
([
inner
]
/~
,
vec
::
view
(
br
.pats
,
col
+
1u
,
br
.pats
.len
())));
vec
::
push
(
result
,
@
{
pats
:
pats
,
bound
:
vec
::
append
(
br
.bound
,
[{
ident
:
path_to_ident
(
name
),
val
:
val
}]
/~
)
with
*
br
});
}
_
{
vec
::
push
(
result
,
br
);
}
}
...
...
@@ -129,12 +133,14 @@ fn enter_match(dm: def_map, m: match, col: uint, val: ValueRef,
for
vec
::
each
(
m
)
{|
br
|
alt
e
(
br
.pats
[
col
])
{
some
(
sub
)
{
let
pats
=
sub
+
vec
::
slice
(
br
.pats
,
0u
,
col
)
+
vec
::
slice
(
br
.pats
,
col
+
1u
,
br
.pats
.len
());
let
pats
=
vec
::
append
(
vec
::
append
(
sub
,
vec
::
view
(
br
.pats
,
0u
,
col
)),
vec
::
view
(
br
.pats
,
col
+
1u
,
br
.pats
.len
()));
let
self
=
br
.pats
[
col
];
let
bound
=
alt
self
.node
{
ast
::
pat_ident
(
name
,
none
)
if
!
pat_is_variant
(
dm
,
self
)
{
br
.bound
+
[{
ident
:
path_to_ident
(
name
),
val
:
val
}]
/~
vec
::
append
(
br
.bound
,
[{
ident
:
path_to_ident
(
name
),
val
:
val
}]
/~
)
}
_
{
br
.bound
}
};
...
...
@@ -417,8 +423,8 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef]/~,
expand_nested_bindings
(
m
,
col
,
val
)
}
else
{
m
};
let
vals_left
=
vec
::
slice
(
vals
,
0u
,
col
)
+
vec
::
slice
(
vals
,
col
+
1u
,
vals
.len
(
));
let
vals_left
=
vec
::
append
(
vec
::
slice
(
vals
,
0u
,
col
),
vec
::
view
(
vals
,
col
+
1u
,
vals
.len
()
));
let
ccx
=
bcx
.fcx.ccx
;
let
mut
pat_id
=
0
;
for
vec
::
each
(
m
)
{|
br
|
...
...
@@ -439,7 +445,7 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef]/~,
vec
::
push
(
rec_vals
,
GEPi
(
bcx
,
val
,
[
0u
,
ix
]
/~
));
}
compile_submatch
(
bcx
,
enter_rec
(
dm
,
m
,
col
,
rec_fields
,
val
),
rec_vals
+
vals_left
,
chk
,
exits
);
vec
::
append
(
rec_vals
,
vals_left
)
,
chk
,
exits
);
ret
;
}
...
...
@@ -455,7 +461,7 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef]/~,
i
+=
1u
;
}
compile_submatch
(
bcx
,
enter_tup
(
dm
,
m
,
col
,
val
,
n_tup_elts
),
tup_vals
+
vals_left
,
chk
,
exits
);
vec
::
append
(
tup_vals
,
vals_left
)
,
chk
,
exits
);
ret
;
}
...
...
@@ -465,8 +471,8 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef]/~,
let
box_no_addrspace
=
non_gc_box_cast
(
bcx
,
llbox
);
let
unboxed
=
GEPi
(
bcx
,
box_no_addrspace
,
[
0u
,
abi
::
box_field_body
]
/~
);
compile_submatch
(
bcx
,
enter_box
(
dm
,
m
,
col
,
val
),
[
unboxed
]
/~
+
vals_left
,
chk
,
exits
);
compile_submatch
(
bcx
,
enter_box
(
dm
,
m
,
col
,
val
),
vec
::
append
([
unboxed
]
/~
,
vals_left
)
,
chk
,
exits
);
ret
;
}
...
...
@@ -476,7 +482,7 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef]/~,
let
unboxed
=
GEPi
(
bcx
,
box_no_addrspace
,
[
0u
,
abi
::
box_field_body
]
/~
);
compile_submatch
(
bcx
,
enter_uniq
(
dm
,
m
,
col
,
val
),
[
unboxed
]
/~
+
vals_left
,
chk
,
exits
);
vec
::
append
([
unboxed
]
/~
,
vals_left
)
,
chk
,
exits
);
ret
;
}
...
...
@@ -580,7 +586,7 @@ enum branch_kind { no_branch, single, switch, compare, }
lit
(
_
)
|
range
(
_
,
_
)
{
}
}
compile_submatch
(
opt_cx
,
enter_opt
(
tcx
,
m
,
opt
,
col
,
size
,
val
),
unpacked
+
vals_left
,
chk
,
exits
);
vec
::
append
(
unpacked
,
vals_left
)
,
chk
,
exits
);
}
// Compile the fall-through case, if any
...
...
src/rustc/middle/trans/base.rs
浏览文件 @
59221e9a
...
...
@@ -2203,7 +2203,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
}
ccx
.monomorphizing
.insert
(
fn_id
,
depth
+
1u
);
let
pt
=
*
pt
+
[
path_name
(
@
ccx
.names
(
*
name
))]
/~
;
let
pt
=
vec
::
append
(
*
pt
,
[
path_name
(
@
ccx
.names
(
*
name
))]
/~
)
;
let
s
=
mangle_exported_name
(
ccx
,
pt
,
mono_ty
);
let
mk_lldecl
=
{||
...
...
@@ -2346,8 +2346,9 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
ty
::
lookup_item_type
(
ccx
.tcx
,
impl_did
);
if
(
*
impl_bnds
)
.len
()
+
mth
.tps
.len
()
==
0u
{
let
llfn
=
get_item_val
(
ccx
,
mth
.id
);
let
path
=
ty
::
item_path
(
ccx
.tcx
,
impl_did
)
+
[
path_name
(
mth
.ident
)]
/~
;
let
path
=
vec
::
append
(
ty
::
item_path
(
ccx
.tcx
,
impl_did
),
[
path_name
(
mth
.ident
)]
/~
);
trans_fn
(
ccx
,
path
,
mth
.decl
,
mth
.body
,
llfn
,
impl_self
(
impl_ty
),
none
,
mth
.id
);
}
...
...
@@ -3113,7 +3114,7 @@ fn trans_args(cx: block, llenv: ValueRef, args: call_args, fn_ty: ty::t,
}
}
arg_vals
(
vs
)
{
llargs
+=
vs
;
vec
::
push_all
(
llargs
,
vs
)
;
}
}
...
...
@@ -3867,10 +3868,11 @@ fn trans_log(log_ex: @ast::expr, lvl: @ast::expr,
ret
trans_expr
(
bcx
,
lvl
,
ignore
);
}
let
modpath
=
[
path_mod
(
ccx
.link_meta.name
)]
/~
+
let
modpath
=
vec
::
append
(
[
path_mod
(
ccx
.link_meta.name
)]
/~
,
vec
::
filter
(
bcx
.fcx.path
,
{|
e
|
alt
e
{
path_mod
(
_
)
{
true
}
_
{
false
}
}
});
})
)
;
let
modname
=
path_str
(
modpath
);
let
global
=
if
ccx
.module_data
.contains_key
(
modname
)
{
...
...
@@ -4901,12 +4903,16 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
ast
::
item_fn
(
decl
,
tps
,
body
)
{
if
decl
.purity
==
ast
::
extern_fn
{
let
llfndecl
=
get_item_val
(
ccx
,
item
.id
);
foreign
::
trans_extern_fn
(
ccx
,
*
path
+
[
path_name
(
item
.ident
)]
/~
,
foreign
::
trans_extern_fn
(
ccx
,
vec
::
append
(
*
path
,
[
path_name
(
item
.ident
)]
/~
),
decl
,
body
,
llfndecl
,
item
.id
);
}
else
if
tps
.len
()
==
0u
{
let
llfndecl
=
get_item_val
(
ccx
,
item
.id
);
trans_fn
(
ccx
,
*
path
+
[
path_name
(
item
.ident
)]
/~
,
decl
,
body
,
llfndecl
,
no_self
,
none
,
item
.id
);
trans_fn
(
ccx
,
vec
::
append
(
*
path
,
[
path_name
(
item
.ident
)]
/~
),
decl
,
body
,
llfndecl
,
no_self
,
none
,
item
.id
);
}
else
{
for
vec
::
each
(
body
.node.stmts
)
{|
stmt
|
alt
stmt
.node
{
...
...
@@ -5112,9 +5118,11 @@ fn fill_fn_pair(bcx: block, pair: ValueRef, llfn: ValueRef,
}
fn
item_path
(
ccx
:
@
crate_ctxt
,
i
:
@
ast
::
item
)
->
path
{
*
alt
check
ccx
.tcx.items
.get
(
i
.id
)
{
ast_map
::
node_item
(
_
,
p
)
{
p
}
}
+
[
path_name
(
i
.ident
)]
/~
vec
::
append
(
*
alt
check
ccx
.tcx.items
.get
(
i
.id
)
{
ast_map
::
node_item
(
_
,
p
)
{
p
}
},
[
path_name
(
i
.ident
)]
/~
)
}
/* If there's already a symbol for the dtor with <id> and substs <substs>,
...
...
@@ -5125,9 +5133,10 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
alt
ccx
.item_symbols
.find
(
id
)
{
some
(
s
)
{
s
}
none
if
is_none
(
substs
)
{
let
s
=
mangle_exported_name
(
ccx
,
path
+
[
path_name
(
@
ccx
.names
(
"dtor"
))]
/~
,
t
);
let
s
=
mangle_exported_name
(
ccx
,
vec
::
append
(
path
,
[
path_name
(
@
ccx
.names
(
"dtor"
))]
/~
),
t
);
ccx
.item_symbols
.insert
(
id
,
s
);
s
}
...
...
@@ -5137,8 +5146,11 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
alt
substs
{
some
(
ss
)
{
let
mono_ty
=
ty
::
subst_tps
(
ccx
.tcx
,
ss
.tys
,
t
);
mangle_exported_name
(
ccx
,
path
+
[
path_name
(
@
ccx
.names
(
"dtor"
))]
/~
,
mono_ty
)
mangle_exported_name
(
ccx
,
vec
::
append
(
path
,
[
path_name
(
@
ccx
.names
(
"dtor"
))]
/~
),
mono_ty
)
}
none
{
ccx
.sess
.bug
(
#
fmt
(
"get_dtor_symbol: not monomorphizing and
\
...
...
@@ -5157,7 +5169,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
let
mut
exprt
=
false
;
let
val
=
alt
check
ccx
.tcx.items
.get
(
id
)
{
ast_map
::
node_item
(
i
,
pth
)
{
let
my_path
=
*
pth
+
[
path_name
(
i
.ident
)]
/~
;
let
my_path
=
vec
::
append
(
*
pth
,
[
path_name
(
i
.ident
)]
/~
)
;
alt
check
i
.node
{
ast
::
item_const
(
_
,
_
)
{
let
typ
=
ty
::
node_id_to_type
(
ccx
.tcx
,
i
.id
);
...
...
@@ -5182,18 +5194,20 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
ast_map
::
node_method
(
m
,
impl_id
,
pth
)
{
exprt
=
true
;
let
mty
=
ty
::
node_id_to_type
(
ccx
.tcx
,
id
);
let
pth
=
*
pth
+
[
path_name
(
@
ccx
.names
(
"meth"
)),
path_name
(
m
.ident
)]
/~
;
let
pth
=
vec
::
append
(
*
pth
,
[
path_name
(
@
ccx
.names
(
"meth"
)),
path_name
(
m
.ident
)]
/~
)
;
let
llfn
=
register_fn_full
(
ccx
,
m
.span
,
pth
,
id
,
mty
);
set_inline_hint_if_appr
(
m
.attrs
,
llfn
);
llfn
}
ast_map
::
node_foreign_item
(
ni
,
_
,
pth
)
{
exprt
=
true
;
register_fn
(
ccx
,
ni
.span
,
*
pth
+
[
path_name
(
ni
.ident
)]
/~
,
ni
.id
)
register_fn
(
ccx
,
ni
.span
,
vec
::
append
(
*
pth
,
[
path_name
(
ni
.ident
)]
/~
),
ni
.id
)
}
ast_map
::
node_ctor
(
nm
,
tps
,
ctor
,
_
,
pt
)
{
let
my_path
=
*
pt
+
[
path_name
(
nm
)]
/~
;
let
my_path
=
vec
::
append
(
*
pt
,
[
path_name
(
nm
)]
/~
)
;
register_fn
(
ccx
,
ctor
.span
,
my_path
,
ctor
.node.id
)
}
ast_map
::
node_dtor
(
tps
,
dt
,
parent_id
,
pt
)
{
...
...
@@ -5219,7 +5233,9 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
ast_map
::
node_variant
(
v
,
enm
,
pth
)
{
assert
v
.node.args
.len
()
!=
0u
;
let
pth
=
*
pth
+
[
path_name
(
enm
.ident
),
path_name
(
v
.node.name
)]
/~
;
let
pth
=
vec
::
append
(
*
pth
,
[
path_name
(
enm
.ident
),
path_name
(
v
.node.name
)]
/~
);
let
llfn
=
alt
check
enm
.node
{
ast
::
item_enum
(
_
,
_
,
_
)
{
register_fn
(
ccx
,
v
.span
,
pth
,
id
)
...
...
@@ -5248,8 +5264,8 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
let
mut
i
=
0
;
let
path
=
item_path
(
ccx
,
it
);
for
vec
::
each
(
variants
)
{|
variant
|
let
p
=
path
+
[
path_name
(
variant
.node.name
),
path_name
(
@
"discrim"
)]
/~
;
let
p
=
vec
::
append
(
path
,
[
path_name
(
variant
.node.name
),
path_name
(
@
"discrim"
)]
/~
)
;
let
s
=
mangle_exported_name
(
ccx
,
p
,
ty
::
mk_int
(
ccx
.tcx
));
let
disr_val
=
vi
[
i
]
.disr_val
;
note_unique_llvm_symbol
(
ccx
,
s
);
...
...
@@ -5454,7 +5470,7 @@ fn impl_map(cx: @crate_ctxt,
let
mut
result
=
[]
/~
;
for
list
::
each
(
cx
.maps.impl_map
.get
(
id
))
{
|
impls
|
result
+=
(
*
impls
)
.map
({|
i
|
(
i
.ident
,
i
.did
)
}
);
vec
::
push_all
(
result
,
(
*
impls
)
.map
({|
i
|
(
i
.ident
,
i
.did
)
})
);
}
ret
result
;
}
...
...
src/rustc/middle/trans/closure.rs
浏览文件 @
59221e9a
...
...
@@ -329,9 +329,11 @@ fn build_closure(bcx0: block,
none
{
bcx
.fcx.llretptr
}
};
let
nil_ret
=
PointerCast
(
bcx
,
our_ret
,
T_ptr
(
T_nil
()));
env_vals
+=
[
env_ref
(
flagptr
,
ty
::
mk_mut_ptr
(
tcx
,
ty
::
mk_bool
(
tcx
)),
owned
),
env_ref
(
nil_ret
,
ty
::
mk_nil_ptr
(
tcx
),
owned
)]
/~
;
vec
::
push
(
env_vals
,
env_ref
(
flagptr
,
ty
::
mk_mut_ptr
(
tcx
,
ty
::
mk_bool
(
tcx
)),
owned
));
vec
::
push
(
env_vals
,
env_ref
(
nil_ret
,
ty
::
mk_nil_ptr
(
tcx
),
owned
));
}
ret
store_environment
(
bcx
,
env_vals
,
ck
);
}
...
...
@@ -391,7 +393,7 @@ fn trans_expr_fn(bcx: block,
let
ccx
=
bcx
.ccx
(),
bcx
=
bcx
;
let
fty
=
node_id_type
(
bcx
,
id
);
let
llfnty
=
type_of_fn_from_ty
(
ccx
,
fty
);
let
sub_path
=
bcx
.fcx.path
+
[
path_name
(
@
"anon"
)]
/~
;
let
sub_path
=
vec
::
append_one
(
bcx
.fcx.path
,
path_name
(
@
"anon"
))
;
let
s
=
mangle_internal_name_by_path
(
ccx
,
sub_path
);
let
llfn
=
decl_internal_cdecl_fn
(
ccx
.llmod
,
s
,
llfnty
);
...
...
@@ -475,7 +477,8 @@ fn trans_bind_1(cx: block, outgoing_fty: ty::t,
// Actually construct the closure
let
{
llbox
,
cdata_ty
,
bcx
}
=
store_environment
(
bcx
,
env_vals
+
vec
::
map
(
bound
,
{|
x
|
env_expr
(
x
,
expr_ty
(
bcx
,
x
))}),
bcx
,
vec
::
append
(
env_vals
,
vec
::
map
(
bound
,
{|
x
|
env_expr
(
x
,
expr_ty
(
bcx
,
x
))})),
ty
::
ck_box
);
// Make thunk
...
...
src/rustc/middle/trans/common.rs
浏览文件 @
59221e9a
...
...
@@ -312,8 +312,10 @@ fn revoke_clean(cx: block, val: ValueRef) {
alt
cu
{
clean_temp
(
v
,
_
,
_
)
if
v
==
val
{
true
}
_
{
false
}
}
}))
{|
i
|
info
.cleanups
=
vec
::
slice
(
info
.cleanups
,
0u
,
i
)
+
vec
::
slice
(
info
.cleanups
,
i
+
1u
,
info
.cleanups
.len
());
vec
::
append
(
vec
::
slice
(
info
.cleanups
,
0u
,
i
),
vec
::
view
(
info
.cleanups
,
i
+
1u
,
info
.cleanups
.len
()));
scope_clean_changed
(
info
);
}
}
...
...
@@ -706,7 +708,7 @@ fn T_box_header(cx: @crate_ctxt) -> TypeRef {
}
fn
T_box
(
cx
:
@
crate_ctxt
,
t
:
TypeRef
)
->
TypeRef
{
ret
T_struct
(
T_box_header_fields
(
cx
)
+
[
t
]
/~
);
ret
T_struct
(
vec
::
append
(
T_box_header_fields
(
cx
),
[
t
]
/~
)
);
}
fn
T_box_ptr
(
t
:
TypeRef
)
->
TypeRef
{
...
...
@@ -723,7 +725,7 @@ fn T_opaque_box_ptr(cx: @crate_ctxt) -> TypeRef {
}
fn
T_unique
(
cx
:
@
crate_ctxt
,
t
:
TypeRef
)
->
TypeRef
{
ret
T_struct
(
T_box_header_fields
(
cx
)
+
[
t
]
/~
);
ret
T_struct
(
vec
::
append
(
T_box_header_fields
(
cx
),
[
t
]
/~
)
);
}
fn
T_unique_ptr
(
t
:
TypeRef
)
->
TypeRef
{
...
...
src/rustc/middle/trans/impl.rs
浏览文件 @
59221e9a
...
...
@@ -19,11 +19,13 @@ fn trans_impl(ccx: @crate_ctxt, path: path, name: ast::ident,
methods
:
[
@
ast
::
method
]
/~
,
tps
:
[
ast
::
ty_param
]
/~
)
{
let
_
icx
=
ccx
.insn_ctxt
(
"impl::trans_impl"
);
if
tps
.len
()
>
0u
{
ret
;
}
let
sub_path
=
path
+
[
path_name
(
name
)]
/~
;
let
sub_path
=
vec
::
append_one
(
path
,
path_name
(
name
))
;
for
vec
::
each
(
methods
)
{|
m
|
if
m
.tps
.len
()
==
0u
{
let
llfn
=
get_item_val
(
ccx
,
m
.id
);
trans_fn
(
ccx
,
sub_path
+
[
path_name
(
m
.ident
)]
/~
,
m
.decl
,
m
.body
,
trans_fn
(
ccx
,
vec
::
append_one
(
sub_path
,
path_name
(
m
.ident
)),
m
.decl
,
m
.body
,
llfn
,
impl_self
(
ty
::
node_id_to_type
(
ccx
.tcx
,
m
.self_id
)),
none
,
m
.id
);
}
...
...
@@ -121,8 +123,10 @@ fn trans_monomorphized_callee(bcx: block, callee_id: ast::node_id,
let
mth_id
=
method_with_name
(
bcx
.ccx
(),
impl_did
,
mname
);
let
n_m_tps
=
method_ty_param_count
(
ccx
,
mth_id
,
impl_did
);
let
node_substs
=
node_id_type_params
(
bcx
,
callee_id
);
let
ty_substs
=
impl_substs
+
vec
::
tailn
(
node_substs
,
node_substs
.len
()
-
n_m_tps
);
let
ty_substs
=
vec
::
append
(
impl_substs
,
vec
::
tailn
(
node_substs
,
node_substs
.len
()
-
n_m_tps
));
let
{
bcx
,
val
}
=
trans_self_arg
(
bcx
,
base
,
derefs
);
let
lval
=
lval_static_fn_inner
(
bcx
,
mth_id
,
callee_id
,
ty_substs
,
some
(
sub_origins
));
...
...
src/rustc/middle/trans/type_of.rs
浏览文件 @
59221e9a
...
...
@@ -37,7 +37,7 @@ fn type_of_fn(cx: @crate_ctxt, inputs: [ty::arg]/~,
vec
::
push
(
atys
,
T_opaque_box_ptr
(
cx
));
// ... then explicit args.
atys
+=
type_of_explicit_args
(
cx
,
inputs
);
vec
::
push_all
(
atys
,
type_of_explicit_args
(
cx
,
inputs
)
);
ret
T_fn
(
atys
,
llvm
::
LLVMVoidType
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录