Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
acb8c1aa
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,发现更多精彩内容 >>
提交
acb8c1aa
编写于
1月 22, 2015
作者:
J
Jorge Aparicio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove more `ExprForLoop`s
上级
76362f0a
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
1 addition
and
93 deletion
+1
-93
src/librustc/middle/check_loop.rs
src/librustc/middle/check_loop.rs
+0
-4
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+0
-13
src/librustc/middle/region.rs
src/librustc/middle/region.rs
+0
-8
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+0
-3
src/librustc/util/common.rs
src/librustc/util/common.rs
+1
-1
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+0
-33
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/expr.rs
+0
-7
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/regionck.rs
+0
-24
未找到文件。
src/librustc/middle/check_loop.rs
浏览文件 @
acb8c1aa
...
...
@@ -45,10 +45,6 @@ fn visit_expr(&mut self, e: &ast::Expr) {
ast
::
ExprLoop
(
ref
b
,
_
)
=>
{
self
.with_context
(
Loop
,
|
v
|
v
.visit_block
(
&**
b
));
}
ast
::
ExprForLoop
(
_
,
ref
e
,
ref
b
,
_
)
=>
{
self
.visit_expr
(
&**
e
);
self
.with_context
(
Loop
,
|
v
|
v
.visit_block
(
&**
b
));
}
ast
::
ExprClosure
(
_
,
_
,
_
,
ref
b
)
=>
{
self
.with_context
(
Closure
,
|
v
|
v
.visit_block
(
&**
b
));
}
...
...
src/librustc/middle/check_match.rs
浏览文件 @
acb8c1aa
...
...
@@ -223,19 +223,6 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
.collect
();
check_exhaustive
(
cx
,
ex
.span
,
&
matrix
,
source
);
},
ast
::
ExprForLoop
(
ref
pat
,
_
,
_
,
_
)
=>
{
let
mut
static_inliner
=
StaticInliner
::
new
(
cx
.tcx
);
is_refutable
(
cx
,
&*
static_inliner
.fold_pat
((
*
pat
)
.clone
()),
|
uncovered_pat
|
{
span_err!
(
cx
.tcx.sess
,
pat
.span
,
E0297
,
"refutable pattern in `for` loop binding:
\
`{}` not covered"
,
pat_to_string
(
uncovered_pat
));
});
// Check legality of move bindings.
check_legality_of_move_bindings
(
cx
,
false
,
slice
::
ref_slice
(
pat
));
check_legality_of_bindings_in_at_patterns
(
cx
,
&**
pat
);
}
_
=>
()
}
}
...
...
src/librustc/middle/region.rs
浏览文件 @
acb8c1aa
...
...
@@ -701,14 +701,6 @@ fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) {
terminating
(
body
.id
);
}
ast
::
ExprForLoop
(
ref
_
pat
,
ref
_
head
,
ref
body
,
_
)
=>
{
terminating
(
body
.id
);
// The variable parent of everything inside (most importantly, the
// pattern) is the body.
visitor
.cx.var_parent
=
InnermostDeclaringBlock
::
Block
(
body
.id
);
}
ast
::
ExprMatch
(
..
)
=>
{
visitor
.cx.var_parent
=
InnermostDeclaringBlock
::
Match
(
expr
.id
);
}
...
...
src/librustc/middle/ty.rs
浏览文件 @
acb8c1aa
...
...
@@ -4493,9 +4493,6 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
// the index method invoked for `a[i]` always yields an `&T`
ast
::
ExprIndex
(
..
)
=>
LvalueExpr
,
// `for` loops are statements
ast
::
ExprForLoop
(
..
)
=>
RvalueStmtExpr
,
// in the general case, result could be any type, use DPS
_
=>
RvalueDpsExpr
};
...
...
src/librustc/util/common.rs
浏览文件 @
acb8c1aa
...
...
@@ -96,7 +96,7 @@ fn visit_expr(&mut self, e: &ast::Expr) {
match
e
.node
{
// Skip inner loops, since a break in the inner loop isn't a
// break inside the outer loop
ast
::
ExprLoop
(
..
)
|
ast
::
ExprWhile
(
..
)
|
ast
::
ExprForLoop
(
..
)
=>
{}
ast
::
ExprLoop
(
..
)
|
ast
::
ExprWhile
(
..
)
=>
{}
_
=>
visit
::
walk_expr
(
self
,
e
)
}
}
...
...
src/librustc_resolve/lib.rs
浏览文件 @
acb8c1aa
...
...
@@ -4562,39 +4562,6 @@ fn resolve_expr(&mut self, expr: &Expr) {
})
}
ExprForLoop
(
ref
pattern
,
ref
head
,
ref
body
,
optional_label
)
=>
{
self
.resolve_expr
(
&**
head
);
self
.value_ribs
.push
(
Rib
::
new
(
NormalRibKind
));
self
.resolve_pattern
(
&**
pattern
,
LocalIrrefutableMode
,
&
mut
HashMap
::
new
());
match
optional_label
{
None
=>
{}
Some
(
label
)
=>
{
self
.label_ribs
.push
(
Rib
::
new
(
NormalRibKind
));
let
def_like
=
DlDef
(
DefLabel
(
expr
.id
));
{
let
rib
=
self
.label_ribs
.last_mut
()
.unwrap
();
let
renamed
=
mtwt
::
resolve
(
label
);
rib
.bindings
.insert
(
renamed
,
def_like
);
}
}
}
self
.resolve_block
(
&**
body
);
if
optional_label
.is_some
()
{
drop
(
self
.label_ribs
.pop
())
}
self
.value_ribs
.pop
();
}
ExprBreak
(
Some
(
label
))
|
ExprAgain
(
Some
(
label
))
=>
{
let
renamed
=
mtwt
::
resolve
(
label
);
match
self
.search_label
(
renamed
)
{
...
...
src/librustc_trans/trans/expr.rs
浏览文件 @
acb8c1aa
...
...
@@ -927,13 +927,6 @@ fn trans_rvalue_stmt_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
ast
::
ExprWhile
(
ref
cond
,
ref
body
,
_
)
=>
{
controlflow
::
trans_while
(
bcx
,
expr
,
&**
cond
,
&**
body
)
}
ast
::
ExprForLoop
(
ref
pat
,
ref
head
,
ref
body
,
_
)
=>
{
controlflow
::
trans_for
(
bcx
,
expr_info
(
expr
),
&**
pat
,
&**
head
,
&**
body
)
}
ast
::
ExprLoop
(
ref
body
,
_
)
=>
{
controlflow
::
trans_loop
(
bcx
,
expr
,
&**
body
)
}
...
...
src/librustc_typeck/check/regionck.rs
浏览文件 @
acb8c1aa
...
...
@@ -658,30 +658,6 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
rcx
.set_repeating_scope
(
repeating_scope
);
}
ast
::
ExprForLoop
(
ref
pat
,
ref
head
,
ref
body
,
_
)
=>
{
constrain_bindings_in_pat
(
&**
pat
,
rcx
);
{
let
mc
=
mc
::
MemCategorizationContext
::
new
(
rcx
.fcx
);
let
pat_ty
=
rcx
.resolve_node_type
(
pat
.id
);
let
pat_cmt
=
mc
.cat_rvalue
(
pat
.id
,
pat
.span
,
ty
::
ReScope
(
CodeExtent
::
from_node_id
(
body
.id
)),
pat_ty
);
link_pattern
(
rcx
,
mc
,
pat_cmt
,
&**
pat
);
}
rcx
.visit_expr
(
&**
head
);
type_of_node_must_outlive
(
rcx
,
infer
::
AddrOf
(
expr
.span
),
head
.id
,
ty
::
ReScope
(
CodeExtent
::
from_node_id
(
expr
.id
)));
let
repeating_scope
=
rcx
.set_repeating_scope
(
body
.id
);
rcx
.visit_block
(
&**
body
);
rcx
.set_repeating_scope
(
repeating_scope
);
}
_
=>
{
visit
::
walk_expr
(
rcx
,
expr
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录