Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1e42c9a3
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,发现更多精彩内容 >>
提交
1e42c9a3
编写于
4月 07, 2012
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not consider ty_bot to be a "resolved type".
Fixes #2149. Fixes #2150. Fixes #2151.
上级
7aaa120b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
51 addition
and
8 deletion
+51
-8
src/rustc/middle/typeck.rs
src/rustc/middle/typeck.rs
+4
-2
src/test/compile-fail/issue-2149.rs
src/test/compile-fail/issue-2149.rs
+14
-0
src/test/compile-fail/issue-2150.rs
src/test/compile-fail/issue-2150.rs
+8
-0
src/test/compile-fail/issue-2151.rs
src/test/compile-fail/issue-2151.rs
+6
-0
src/test/compile-fail/unreachable-code-1.rs
src/test/compile-fail/unreachable-code-1.rs
+14
-0
src/test/pretty/disamb-stmt-expr.rs
src/test/pretty/disamb-stmt-expr.rs
+3
-1
src/test/run-pass/early-ret-binop-add.rs
src/test/run-pass/early-ret-binop-add.rs
+1
-1
src/test/run-pass/unreachable-code.rs
src/test/run-pass/unreachable-code.rs
+1
-4
未找到文件。
src/rustc/middle/typeck.rs
浏览文件 @
1e42c9a3
...
...
@@ -232,8 +232,10 @@ fn instantiate_path(fcx: @fn_ctxt, pth: @ast::path,
// Type tests
fn
structurally_resolved_type
(
fcx
:
@
fn_ctxt
,
sp
:
span
,
tp
:
ty
::
t
)
->
ty
::
t
{
alt
infer
::
resolve_type_structure
(
fcx
.infcx
,
tp
)
{
result
::
ok
(
typ_s
)
{
ret
typ_s
;
}
result
::
err
(
_
)
{
// note: the bot type doesn't count as resolved; it's what we use when
// there is no information about a variable.
result
::
ok
(
t_s
)
if
!
ty
::
type_is_bot
(
t_s
)
{
ret
t_s
;
}
_
{
fcx
.ccx.tcx.sess
.span_fatal
(
sp
,
"the type of this value must be known in this context"
);
}
...
...
src/test/compile-fail/issue-2149.rs
0 → 100644
浏览文件 @
1e42c9a3
iface
monad
<
A
>
{
fn
bind
<
B
>
(
fn
(
A
)
->
self
<
B
>
);
}
impl
monad
<
A
>
of
monad
<
A
>
for
[
A
]
{
fn
bind
<
B
>
(
f
:
fn
(
A
)
->
[
B
])
{
let
mut
r
=
fail
;
for
self
.each
{|
elt
|
r
+=
f
(
elt
);
}
//!^ WARNING unreachable expression
//!^^ ERROR the type of this value must be known
}
}
fn
main
()
{
[
"hi"
]
.bind
{|
x
|
[
x
]
};
}
\ No newline at end of file
src/test/compile-fail/issue-2150.rs
0 → 100644
浏览文件 @
1e42c9a3
fn
fail_len
(
v
:
[
const
int
])
->
uint
{
let
mut
i
=
fail
;
for
v
.each
{|
x
|
i
+=
1u
;
}
//!^ WARNING unreachable statement
//!^^ ERROR the type of this value must be known
ret
i
;
}
fn
main
()
{}
\ No newline at end of file
src/test/compile-fail/issue-2151.rs
0 → 100644
浏览文件 @
1e42c9a3
fn
main
()
{
vec
::
iter
(
fail
)
{|
i
|
log
(
debug
,
i
*
2
);
//!^ ERROR the type of this value must be known
};
}
\ No newline at end of file
src/test/compile-fail/unreachable-code-1.rs
0 → 100644
浏览文件 @
1e42c9a3
// xfail-pretty
fn
id
(
x
:
bool
)
->
bool
{
x
}
fn
call_id
()
{
let
c
<-
fail
;
id
(
c
);
//! WARNING unreachable statement
}
fn
call_id_3
()
{
id
(
ret
)
&&
id
(
ret
);
}
//!^ ERROR the type of this value must be known
fn
main
()
{
}
src/test/pretty/disamb-stmt-expr.rs
浏览文件 @
1e42c9a3
...
...
@@ -4,5 +4,7 @@
// preserved. They are needed to disambiguate `{ret n+1}; - 0` from
// `({ret n+1}-0)`.
fn
wsucc
(
n
:
int
)
->
int
{
({
ret
n
+
1
})
-
0
;
}
fn
id
(
f
:
fn
()
->
int
)
->
int
{
f
()
}
fn
wsucc
(
n
:
int
)
->
int
{
(
id
{||
1
})
-
0
}
fn
main
()
{
}
src/test/run-pass/early-ret-binop-add.rs
浏览文件 @
1e42c9a3
fn
wsucc
(
n
:
int
)
->
int
{
({
ret
n
+
1
}
+
0
);
}
fn
wsucc
(
n
:
int
)
->
int
{
0
+
{
ret
n
+
1
}
}
fn
main
()
{
}
src/test/run-pass/unreachable-code.rs
浏览文件 @
1e42c9a3
...
...
@@ -9,8 +9,6 @@ fn call_id() {
fn
call_id_2
()
{
id
(
true
)
&&
id
(
ret
);
}
fn
call_id_3
()
{
id
(
ret
)
&&
id
(
ret
);
}
fn
call_id_4
()
{
while
id
(
ret
)
{
}
}
fn
bind_id_1
()
{
bind
id
(
fail
);
}
...
...
@@ -27,7 +25,7 @@ fn call_id_4() { while id(ret) { } }
fn
log_cont
()
{
do
{
log
(
error
,
cont
);
}
while
false
}
fn
ret_ret
()
->
int
{
ret
(
ret
2
)
+
3
;
}
fn
ret_ret
()
->
int
{
ret
3
+
(
ret
2
)
;
}
fn
ret_guard
()
{
alt
check
2
{
...
...
@@ -53,7 +51,6 @@ fn main() {
ret_ret
();
log_ret
();
call_id_2
();
call_id_3
();
call_id_4
();
bind_id_2
();
ret_guard
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录