Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
14893ba9
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,发现更多精彩内容 >>
提交
14893ba9
编写于
7月 11, 2018
作者:
C
csmoe
提交者:
Oliver Schneider
7月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DeclKind
上级
114314c9
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
36 addition
and
37 deletion
+36
-37
src/librustc/cfg/construct.rs
src/librustc/cfg/construct.rs
+2
-2
src/librustc/hir/intravisit.rs
src/librustc/hir/intravisit.rs
+2
-2
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+3
-3
src/librustc/hir/mod.rs
src/librustc/hir/mod.rs
+9
-10
src/librustc/hir/print.rs
src/librustc/hir/print.rs
+4
-4
src/librustc/ich/impls_hir.rs
src/librustc/ich/impls_hir.rs
+4
-4
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/expr_use_visitor.rs
+2
-2
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+2
-2
src/librustc_mir/hair/cx/block.rs
src/librustc_mir/hair/cx/block.rs
+2
-2
src/librustc_passes/rvalue_promotion.rs
src/librustc_passes/rvalue_promotion.rs
+2
-2
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+4
-4
未找到文件。
src/librustc/cfg/construct.rs
浏览文件 @
14893ba9
...
@@ -126,12 +126,12 @@ fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex {
...
@@ -126,12 +126,12 @@ fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex {
fn
decl
(
&
mut
self
,
decl
:
&
hir
::
Decl
,
pred
:
CFGIndex
)
->
CFGIndex
{
fn
decl
(
&
mut
self
,
decl
:
&
hir
::
Decl
,
pred
:
CFGIndex
)
->
CFGIndex
{
match
decl
.node
{
match
decl
.node
{
hir
::
DeclLocal
(
ref
local
)
=>
{
hir
::
Decl
Kind
::
Local
(
ref
local
)
=>
{
let
init_exit
=
self
.opt_expr
(
&
local
.init
,
pred
);
let
init_exit
=
self
.opt_expr
(
&
local
.init
,
pred
);
self
.pat
(
&
local
.pat
,
init_exit
)
self
.pat
(
&
local
.pat
,
init_exit
)
}
}
hir
::
DeclItem
(
_
)
=>
pred
,
hir
::
Decl
Kind
::
Item
(
_
)
=>
pred
,
}
}
}
}
...
...
src/librustc/hir/intravisit.rs
浏览文件 @
14893ba9
...
@@ -949,8 +949,8 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
...
@@ -949,8 +949,8 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
pub
fn
walk_decl
<
'v
,
V
:
Visitor
<
'v
>>
(
visitor
:
&
mut
V
,
declaration
:
&
'v
Decl
)
{
pub
fn
walk_decl
<
'v
,
V
:
Visitor
<
'v
>>
(
visitor
:
&
mut
V
,
declaration
:
&
'v
Decl
)
{
match
declaration
.node
{
match
declaration
.node
{
DeclLocal
(
ref
local
)
=>
visitor
.visit_local
(
local
),
Decl
Kind
::
Local
(
ref
local
)
=>
visitor
.visit_local
(
local
),
DeclItem
(
item
)
=>
visitor
.visit_nested_item
(
item
),
Decl
Kind
::
Item
(
item
)
=>
visitor
.visit_nested_item
(
item
),
}
}
}
}
...
...
src/librustc/hir/lowering.rs
浏览文件 @
14893ba9
...
@@ -4248,7 +4248,7 @@ fn lower_stmt(&mut self, s: &Stmt) -> SmallVector<hir::Stmt> {
...
@@ -4248,7 +4248,7 @@ fn lower_stmt(&mut self, s: &Stmt) -> SmallVector<hir::Stmt> {
StmtKind
::
Local
(
ref
l
)
=>
Spanned
{
StmtKind
::
Local
(
ref
l
)
=>
Spanned
{
node
:
hir
::
StmtKind
::
Decl
(
node
:
hir
::
StmtKind
::
Decl
(
P
(
Spanned
{
P
(
Spanned
{
node
:
hir
::
DeclLocal
(
self
.lower_local
(
l
)),
node
:
hir
::
Decl
Kind
::
Local
(
self
.lower_local
(
l
)),
span
:
s
.span
,
span
:
s
.span
,
}),
}),
self
.lower_node_id
(
s
.id
)
.node_id
,
self
.lower_node_id
(
s
.id
)
.node_id
,
...
@@ -4263,7 +4263,7 @@ fn lower_stmt(&mut self, s: &Stmt) -> SmallVector<hir::Stmt> {
...
@@ -4263,7 +4263,7 @@ fn lower_stmt(&mut self, s: &Stmt) -> SmallVector<hir::Stmt> {
.map
(|
item_id
|
Spanned
{
.map
(|
item_id
|
Spanned
{
node
:
hir
::
StmtKind
::
Decl
(
node
:
hir
::
StmtKind
::
Decl
(
P
(
Spanned
{
P
(
Spanned
{
node
:
hir
::
DeclItem
(
item_id
),
node
:
hir
::
Decl
Kind
::
Item
(
item_id
),
span
:
s
.span
,
span
:
s
.span
,
}),
}),
id
.take
()
id
.take
()
...
@@ -4493,7 +4493,7 @@ fn stmt_let_pat(
...
@@ -4493,7 +4493,7 @@ fn stmt_let_pat(
attrs
:
ThinVec
::
new
(),
attrs
:
ThinVec
::
new
(),
source
,
source
,
});
});
let
decl
=
respan
(
sp
,
hir
::
DeclLocal
(
local
));
let
decl
=
respan
(
sp
,
hir
::
Decl
Kind
::
Local
(
local
));
respan
(
sp
,
hir
::
StmtKind
::
Decl
(
P
(
decl
),
self
.next_id
()
.node_id
))
respan
(
sp
,
hir
::
StmtKind
::
Decl
(
P
(
decl
),
self
.next_id
()
.node_id
))
}
}
...
...
src/librustc/hir/mod.rs
浏览文件 @
14893ba9
...
@@ -12,8 +12,7 @@
...
@@ -12,8 +12,7 @@
pub
use
self
::
BlockCheckMode
::
*
;
pub
use
self
::
BlockCheckMode
::
*
;
pub
use
self
::
CaptureClause
::
*
;
pub
use
self
::
CaptureClause
::
*
;
pub
use
self
::
Decl_
::
*
;
pub
use
self
::
ExprKind
::
*
;
pub
use
self
::
Expr_
::
*
;
pub
use
self
::
FunctionRetTy
::
*
;
pub
use
self
::
FunctionRetTy
::
*
;
pub
use
self
::
ForeignItem_
::
*
;
pub
use
self
::
ForeignItem_
::
*
;
pub
use
self
::
Item_
::
*
;
pub
use
self
::
Item_
::
*
;
...
@@ -1158,27 +1157,27 @@ pub struct Local {
...
@@ -1158,27 +1157,27 @@ pub struct Local {
pub
source
:
LocalSource
,
pub
source
:
LocalSource
,
}
}
pub
type
Decl
=
Spanned
<
Decl
_
>
;
pub
type
Decl
=
Spanned
<
Decl
Kind
>
;
#[derive(Clone,
RustcEncodable,
RustcDecodable,
Debug)]
#[derive(Clone,
RustcEncodable,
RustcDecodable,
Debug)]
pub
enum
Decl
_
{
pub
enum
Decl
Kind
{
/// A local (let) binding:
/// A local (let) binding:
Decl
Local
(
P
<
Local
>
),
Local
(
P
<
Local
>
),
/// An item binding:
/// An item binding:
Decl
Item
(
ItemId
),
Item
(
ItemId
),
}
}
impl
Decl
_
{
impl
Decl
Kind
{
pub
fn
attrs
(
&
self
)
->
&
[
Attribute
]
{
pub
fn
attrs
(
&
self
)
->
&
[
Attribute
]
{
match
*
self
{
match
*
self
{
DeclLocal
(
ref
l
)
=>
&
l
.attrs
,
Decl
Kind
::
Local
(
ref
l
)
=>
&
l
.attrs
,
DeclItem
(
_
)
=>
&
[]
Decl
Kind
::
Item
(
_
)
=>
&
[]
}
}
}
}
pub
fn
is_local
(
&
self
)
->
bool
{
pub
fn
is_local
(
&
self
)
->
bool
{
match
*
self
{
match
*
self
{
Decl
_
::
Decl
Local
(
_
)
=>
true
,
Decl
Kind
::
Local
(
_
)
=>
true
,
_
=>
false
,
_
=>
false
,
}
}
}
}
...
...
src/librustc/hir/print.rs
浏览文件 @
14893ba9
...
@@ -1575,7 +1575,7 @@ pub fn print_local_decl(&mut self, loc: &hir::Local) -> io::Result<()> {
...
@@ -1575,7 +1575,7 @@ pub fn print_local_decl(&mut self, loc: &hir::Local) -> io::Result<()> {
pub
fn
print_decl
(
&
mut
self
,
decl
:
&
hir
::
Decl
)
->
io
::
Result
<
()
>
{
pub
fn
print_decl
(
&
mut
self
,
decl
:
&
hir
::
Decl
)
->
io
::
Result
<
()
>
{
self
.maybe_print_comment
(
decl
.span
.lo
())
?
;
self
.maybe_print_comment
(
decl
.span
.lo
())
?
;
match
decl
.node
{
match
decl
.node
{
hir
::
DeclLocal
(
ref
loc
)
=>
{
hir
::
Decl
Kind
::
Local
(
ref
loc
)
=>
{
self
.space_if_not_bol
()
?
;
self
.space_if_not_bol
()
?
;
self
.ibox
(
indent_unit
)
?
;
self
.ibox
(
indent_unit
)
?
;
self
.word_nbsp
(
"let"
)
?
;
self
.word_nbsp
(
"let"
)
?
;
...
@@ -1590,7 +1590,7 @@ pub fn print_decl(&mut self, decl: &hir::Decl) -> io::Result<()> {
...
@@ -1590,7 +1590,7 @@ pub fn print_decl(&mut self, decl: &hir::Decl) -> io::Result<()> {
}
}
self
.end
()
self
.end
()
}
}
hir
::
DeclItem
(
item
)
=>
{
hir
::
Decl
Kind
::
Item
(
item
)
=>
{
self
.ann
.nested
(
self
,
Nested
::
Item
(
item
))
self
.ann
.nested
(
self
,
Nested
::
Item
(
item
))
}
}
}
}
...
@@ -2400,8 +2400,8 @@ fn stmt_ends_with_semi(stmt: &hir::StmtKind) -> bool {
...
@@ -2400,8 +2400,8 @@ fn stmt_ends_with_semi(stmt: &hir::StmtKind) -> bool {
match
*
stmt
{
match
*
stmt
{
hir
::
StmtKind
::
Decl
(
ref
d
,
_
)
=>
{
hir
::
StmtKind
::
Decl
(
ref
d
,
_
)
=>
{
match
d
.node
{
match
d
.node
{
hir
::
DeclLocal
(
_
)
=>
true
,
hir
::
Decl
Kind
::
Local
(
_
)
=>
true
,
hir
::
DeclItem
(
_
)
=>
false
,
hir
::
Decl
Kind
::
Item
(
_
)
=>
false
,
}
}
}
}
hir
::
StmtKind
::
Expr
(
ref
e
,
_
)
=>
{
hir
::
StmtKind
::
Expr
(
ref
e
,
_
)
=>
{
...
...
src/librustc/ich/impls_hir.rs
浏览文件 @
14893ba9
...
@@ -479,10 +479,10 @@ fn hash_stable<W: StableHasherResult>(&self,
...
@@ -479,10 +479,10 @@ fn hash_stable<W: StableHasherResult>(&self,
source
source
});
});
impl_stable_hash_for_spanned!
(
hir
::
Decl
_
);
impl_stable_hash_for_spanned!
(
hir
::
Decl
Kind
);
impl_stable_hash_for!
(
enum
hir
::
Decl
_
{
impl_stable_hash_for!
(
enum
hir
::
Decl
Kind
{
Decl
Local
(
local
),
Local
(
local
),
Decl
Item
(
item_id
)
Item
(
item_id
)
});
});
impl_stable_hash_for!
(
struct
hir
::
Arm
{
impl_stable_hash_for!
(
struct
hir
::
Arm
{
...
...
src/librustc/middle/expr_use_visitor.rs
浏览文件 @
14893ba9
...
@@ -588,11 +588,11 @@ fn walk_stmt(&mut self, stmt: &hir::Stmt) {
...
@@ -588,11 +588,11 @@ fn walk_stmt(&mut self, stmt: &hir::Stmt) {
match
stmt
.node
{
match
stmt
.node
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
match
decl
.node
{
match
decl
.node
{
hir
::
DeclLocal
(
ref
local
)
=>
{
hir
::
Decl
Kind
::
Local
(
ref
local
)
=>
{
self
.walk_local
(
&
local
);
self
.walk_local
(
&
local
);
}
}
hir
::
DeclItem
(
_
)
=>
{
hir
::
Decl
Kind
::
Item
(
_
)
=>
{
// we don't visit nested items in this visitor,
// we don't visit nested items in this visitor,
// only the fn body we were given.
// only the fn body we were given.
}
}
...
...
src/librustc/middle/liveness.rs
浏览文件 @
14893ba9
...
@@ -873,10 +873,10 @@ fn propagate_through_stmt(&mut self, stmt: &hir::Stmt, succ: LiveNode)
...
@@ -873,10 +873,10 @@ fn propagate_through_stmt(&mut self, stmt: &hir::Stmt, succ: LiveNode)
fn
propagate_through_decl
(
&
mut
self
,
decl
:
&
hir
::
Decl
,
succ
:
LiveNode
)
fn
propagate_through_decl
(
&
mut
self
,
decl
:
&
hir
::
Decl
,
succ
:
LiveNode
)
->
LiveNode
{
->
LiveNode
{
match
decl
.node
{
match
decl
.node
{
hir
::
DeclLocal
(
ref
local
)
=>
{
hir
::
Decl
Kind
::
Local
(
ref
local
)
=>
{
self
.propagate_through_local
(
&
local
,
succ
)
self
.propagate_through_local
(
&
local
,
succ
)
}
}
hir
::
DeclItem
(
_
)
=>
succ
,
hir
::
Decl
Kind
::
Item
(
_
)
=>
succ
,
}
}
}
}
...
...
src/librustc_mir/hair/cx/block.rs
浏览文件 @
14893ba9
...
@@ -67,10 +67,10 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
...
@@ -67,10 +67,10 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
}
}
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
match
decl
.node
{
match
decl
.node
{
hir
::
DeclItem
(
..
)
=>
{
hir
::
Decl
Kind
::
Item
(
..
)
=>
{
// ignore for purposes of the MIR
// ignore for purposes of the MIR
}
}
hir
::
DeclLocal
(
ref
local
)
=>
{
hir
::
Decl
Kind
::
Local
(
ref
local
)
=>
{
let
remainder_scope
=
region
::
Scope
::
Remainder
(
BlockRemainder
{
let
remainder_scope
=
region
::
Scope
::
Remainder
(
BlockRemainder
{
block
:
block_id
,
block
:
block_id
,
first_statement_index
:
region
::
FirstStatementIndex
::
new
(
index
),
first_statement_index
:
region
::
FirstStatementIndex
::
new
(
index
),
...
...
src/librustc_passes/rvalue_promotion.rs
浏览文件 @
14893ba9
...
@@ -263,7 +263,7 @@ fn check_stmt(&mut self, stmt: &'tcx hir::Stmt) -> Promotability {
...
@@ -263,7 +263,7 @@ fn check_stmt(&mut self, stmt: &'tcx hir::Stmt) -> Promotability {
match
stmt
.node
{
match
stmt
.node
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
node_id
)
=>
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
node_id
)
=>
{
match
&
decl
.node
{
match
&
decl
.node
{
hir
::
DeclLocal
(
local
)
=>
{
hir
::
Decl
Kind
::
Local
(
local
)
=>
{
if
self
.remove_mut_rvalue_borrow
(
&
local
.pat
)
{
if
self
.remove_mut_rvalue_borrow
(
&
local
.pat
)
{
if
let
Some
(
init
)
=
&
local
.init
{
if
let
Some
(
init
)
=
&
local
.init
{
self
.mut_rvalue_borrows
.insert
(
init
.id
);
self
.mut_rvalue_borrows
.insert
(
init
.id
);
...
@@ -277,7 +277,7 @@ fn check_stmt(&mut self, stmt: &'tcx hir::Stmt) -> Promotability {
...
@@ -277,7 +277,7 @@ fn check_stmt(&mut self, stmt: &'tcx hir::Stmt) -> Promotability {
NotPromotable
NotPromotable
}
}
// Item statements are allowed
// Item statements are allowed
hir
::
DeclItem
(
_
)
=>
Promotable
hir
::
Decl
Kind
::
Item
(
_
)
=>
Promotable
}
}
}
}
hir
::
StmtKind
::
Expr
(
ref
box_expr
,
_
node_id
)
|
hir
::
StmtKind
::
Expr
(
ref
box_expr
,
_
node_id
)
|
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
14893ba9
...
@@ -4379,8 +4379,8 @@ pub fn check_stmt(&self, stmt: &'gcx hir::Stmt) {
...
@@ -4379,8 +4379,8 @@ pub fn check_stmt(&self, stmt: &'gcx hir::Stmt) {
match
stmt
.node
{
match
stmt
.node
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
match
decl
.node
{
match
decl
.node
{
hir
::
DeclLocal
(
_
)
=>
{}
hir
::
Decl
Kind
::
Local
(
_
)
=>
{}
hir
::
DeclItem
(
_
)
=>
{
hir
::
Decl
Kind
::
Item
(
_
)
=>
{
return
;
return
;
}
}
}
}
...
@@ -4399,10 +4399,10 @@ pub fn check_stmt(&self, stmt: &'gcx hir::Stmt) {
...
@@ -4399,10 +4399,10 @@ pub fn check_stmt(&self, stmt: &'gcx hir::Stmt) {
match
stmt
.node
{
match
stmt
.node
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
hir
::
StmtKind
::
Decl
(
ref
decl
,
_
)
=>
{
match
decl
.node
{
match
decl
.node
{
hir
::
DeclLocal
(
ref
l
)
=>
{
hir
::
Decl
Kind
::
Local
(
ref
l
)
=>
{
self
.check_decl_local
(
&
l
);
self
.check_decl_local
(
&
l
);
}
}
hir
::
DeclItem
(
_
)
=>
{
/* ignore for now */
}
hir
::
Decl
Kind
::
Item
(
_
)
=>
{
/* ignore for now */
}
}
}
}
}
hir
::
StmtKind
::
Expr
(
ref
expr
,
_
)
=>
{
hir
::
StmtKind
::
Expr
(
ref
expr
,
_
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录