Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b2b8002f
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,发现更多精彩内容 >>
提交
b2b8002f
编写于
6月 15, 2011
作者:
M
Marijn Haverbeke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix unsafe uses of aliases in tail calls
上级
0987b17d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
27 deletion
+44
-27
src/comp/middle/trans.rs
src/comp/middle/trans.rs
+4
-4
src/comp/middle/typeck.rs
src/comp/middle/typeck.rs
+5
-5
src/lib/list.rs
src/lib/list.rs
+35
-18
未找到文件。
src/comp/middle/trans.rs
浏览文件 @
b2b8002f
...
...
@@ -1115,7 +1115,7 @@ fn trans_non_gc_free(&@block_ctxt cx, ValueRef v) -> result {
fn
find_scope_cx
(
&@
block_ctxt
cx
)
->
@
block_ctxt
{
if
(
cx
.kind
!=
NON_SCOPE_BLOCK
)
{
ret
cx
;
}
alt
(
cx
.parent
)
{
case
(
parent_some
(
?
b
))
{
be
find_scope_cx
(
b
);
}
case
(
parent_some
(
?
b
))
{
ret
find_scope_cx
(
b
);
}
case
(
parent_none
)
{
cx
.fcx.lcx.ccx.sess
.bug
(
"trans::find_scope_cx() "
+
"called on parentless block_ctxt"
);
...
...
@@ -2455,7 +2455,7 @@ fn adaptor_fn(val_and_ty_fn f, &@block_ctxt cx, ValueRef av, ValueRef bv,
ty
::
t
t
)
->
result
{
ret
f
(
cx
,
av
,
t
);
}
be
iter_structural_ty_full
(
cx
,
v
,
v
,
t
,
bind
adaptor_fn
(
f
,
_
,
_
,
_
,
_
));
ret
iter_structural_ty_full
(
cx
,
v
,
v
,
t
,
bind
adaptor_fn
(
f
,
_
,
_
,
_
,
_
));
}
fn
iter_structural_ty_full
(
&@
block_ctxt
cx
,
ValueRef
av
,
ValueRef
bv
,
...
...
@@ -2693,8 +2693,8 @@ fn adaptor_fn(val_and_ty_fn f, ty::t elt_ty, &@block_ctxt cx,
ret
f
(
cx
,
load_if_immediate
(
cx
,
p
,
elt_ty
),
elt_ty
);
}
auto
elt_sz
=
size_of
(
cx
,
elt_ty
);
be
iter_sequence_raw
(
elt_sz
.bcx
,
src
,
src
,
src_lim
,
elt_sz
.val
,
bind
adaptor_fn
(
f
,
elt_ty
,
_
,
_
,
_
));
ret
iter_sequence_raw
(
elt_sz
.bcx
,
src
,
src
,
src_lim
,
elt_sz
.val
,
bind
adaptor_fn
(
f
,
elt_ty
,
_
,
_
,
_
));
}
...
...
src/comp/middle/typeck.rs
浏览文件 @
b2b8002f
...
...
@@ -388,7 +388,7 @@ fn inner(&node_type_table ntt, uint node_id,
// Writes a type parameter count and type pair into the node type table.
fn
ty
(
&
ty
::
ctxt
tcx
,
uint
node_id
,
&
ty_param_substs_opt_and_ty
tpot
)
{
assert
(
!
ty
::
type_contains_vars
(
tcx
,
tpot
._1
));
be
inner
(
tcx
.node_types
,
node_id
,
tpot
);
ret
inner
(
tcx
.node_types
,
node_id
,
tpot
);
}
// Writes a type parameter count and type pair into the node type table.
...
...
@@ -404,23 +404,23 @@ fn ty_fixup(@fn_ctxt fcx, uint node_id,
// Writes a type with no type parameters into the node type table.
fn
ty_only
(
&
ty
::
ctxt
tcx
,
uint
node_id
,
ty
::
t
typ
)
{
be
ty
(
tcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
typ
));
ret
ty
(
tcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
typ
));
}
// Writes a type with no type parameters into the node type table. This
// function allows for the possibility of type variables.
fn
ty_only_fixup
(
@
fn_ctxt
fcx
,
uint
node_id
,
ty
::
t
typ
)
{
be
ty_fixup
(
fcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
typ
));
ret
ty_fixup
(
fcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
typ
));
}
// Writes a nil type into the node type table.
fn
nil_ty
(
&
ty
::
ctxt
tcx
,
uint
node_id
)
{
be
ty
(
tcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
ty
::
mk_nil
(
tcx
)));
ret
ty
(
tcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
ty
::
mk_nil
(
tcx
)));
}
// Writes the bottom type into the node type table.
fn
bot_ty
(
&
ty
::
ctxt
tcx
,
uint
node_id
)
{
be
ty
(
tcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
ty
::
mk_bot
(
tcx
)));
ret
ty
(
tcx
,
node_id
,
tup
(
none
[
vec
[
ty
::
t
]],
ty
::
mk_bot
(
tcx
)));
}
}
...
...
src/lib/list.rs
浏览文件 @
b2b8002f
...
...
@@ -18,35 +18,52 @@ fn from_vec[T](vec[T] v) -> list[T] {
ret
l
;
}
fn
foldl
[
T
,
U
](
&
list
[
T
]
ls
,
&
U
u
,
fn
(
&
T
,
&
U
)
->
U
f
)
->
U
{
alt
(
ls
)
{
case
(
cons
(
?
hd
,
?
tl
))
{
auto
u_
=
f
(
hd
,
u
);
be
foldl
[
T
,
U
](
*
tl
,
u_
,
f
);
fn
foldl
[
T
,
U
](
&
list
[
T
]
ls_
,
&
U
u
,
fn
(
&
T
,
&
U
)
->
U
f
)
->
U
{
let
U
accum
=
u
;
auto
ls
=
ls_
;
while
(
true
)
{
alt
(
ls
)
{
case
(
cons
(
?
hd
,
?
tl
))
{
accum
=
f
(
hd
,
accum
);
ls
=
*
tl
;
}
case
(
nil
)
{
break
;
}
}
case
(
nil
)
{
ret
u
;
}
}
ret
accum
;
}
fn
find
[
T
,
U
](
&
list
[
T
]
ls
,
fn
(
&
T
)
->
option
::
t
[
U
]
f
)
->
option
::
t
[
U
]
{
alt
(
ls
)
{
case
(
cons
(
?
hd
,
?
tl
))
{
alt
(
f
(
hd
))
{
case
(
none
)
{
be
find
[
T
,
U
](
*
tl
,
f
);
}
case
(
some
(
?
res
))
{
ret
some
[
U
](
res
);
}
fn
find
[
T
,
U
](
&
list
[
T
]
ls_
,
fn
(
&
T
)
->
option
::
t
[
U
]
f
)
->
option
::
t
[
U
]
{
auto
ls
=
ls_
;
while
(
true
)
{
alt
(
ls
)
{
case
(
cons
(
?
hd
,
?
tl
))
{
alt
(
f
(
hd
))
{
case
(
none
)
{
ls
=
*
tl
;
}
case
(
some
(
?
res
))
{
ret
some
(
res
);
}
}
}
case
(
nil
)
{
break
;
}
}
case
(
nil
)
{
ret
none
[
U
];
}
}
ret
none
;
}
fn
has
[
T
](
&
list
[
T
]
ls
,
&
T
elt
)
->
bool
{
alt
(
ls
)
{
case
(
cons
(
?
hd
,
?
tl
))
{
if
(
elt
==
hd
)
{
ret
true
;
}
else
{
be
has
(
*
tl
,
elt
);
}
fn
has
[
T
](
&
list
[
T
]
ls_
,
&
T
elt
)
->
bool
{
auto
ls
=
ls_
;
while
(
true
)
{
alt
(
ls
)
{
case
(
cons
(
?
hd
,
?
tl
))
{
if
(
elt
==
hd
)
{
ret
true
;
}
else
{
ls
=
*
tl
;
}
}
case
(
nil
)
{
ret
false
;
}
}
case
(
nil
)
{
ret
false
;
}
}
ret
false
;
// Typestate checker doesn't understand infinite loops
}
fn
length
[
T
](
&
list
[
T
]
ls
)
->
uint
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录