Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4b9acad7
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,发现更多精彩内容 >>
提交
4b9acad7
编写于
7月 27, 2017
作者:
P
Paul Faria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Squash Span into SourceInfo and rename enum and its inner types
上级
059a9a16
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
18 deletion
+21
-18
src/librustc/mir/visit.rs
src/librustc/mir/visit.rs
+17
-14
src/librustc_mir/build/mod.rs
src/librustc_mir/build/mod.rs
+2
-2
src/librustc_mir/transform/erase_regions.rs
src/librustc_mir/transform/erase_regions.rs
+2
-2
未找到文件。
src/librustc/mir/visit.rs
浏览文件 @
4b9acad7
...
...
@@ -211,7 +211,7 @@ fn visit_source_info(&mut self,
fn
visit_ty
(
&
mut
self
,
ty
:
&
$
(
$mutability
)
*
Ty
<
'tcx
>
,
_
:
PositionalInfo
)
{
_
:
Lookup
)
{
self
.super_ty
(
ty
);
}
...
...
@@ -269,7 +269,11 @@ fn super_mir(&mut self,
self
.visit_visibility_scope_data
(
scope
);
}
self
.visit_ty
(
&
$
(
$mutability
)
*
mir
.return_ty
,
PositionalInfo
::
Span
(
mir
.span
));
let
lookup
=
Lookup
::
Src
(
SourceInfo
{
span
:
mir
.span
,
scope
:
ARGUMENT_VISIBILITY_SCOPE
,
});
self
.visit_ty
(
&
$
(
$mutability
)
*
mir
.return_ty
,
lookup
);
for
local_decl
in
&
$
(
$mutability
)
*
mir
.local_decls
{
self
.visit_local_decl
(
local_decl
);
...
...
@@ -388,7 +392,7 @@ fn super_terminator_kind(&mut self,
ref
values
,
ref
targets
}
=>
{
self
.visit_operand
(
discr
,
source_location
);
self
.visit_ty
(
switch_ty
,
PositionalInfo
::
Location
(
source_location
));
self
.visit_ty
(
switch_ty
,
Lookup
::
Loc
(
source_location
));
for
value
in
&
values
[
..
]
{
self
.visit_const_int
(
value
,
source_location
);
}
...
...
@@ -492,7 +496,7 @@ fn super_rvalue(&mut self,
ref
$
(
$mutability
)
*
operand
,
ref
$
(
$mutability
)
*
ty
)
=>
{
self
.visit_operand
(
operand
,
location
);
self
.visit_ty
(
ty
,
PositionalInfo
::
Location
(
location
));
self
.visit_ty
(
ty
,
Lookup
::
Loc
(
location
));
}
Rvalue
::
BinaryOp
(
_
bin_op
,
...
...
@@ -514,7 +518,7 @@ fn super_rvalue(&mut self,
}
Rvalue
::
NullaryOp
(
_
op
,
ref
$
(
$mutability
)
*
ty
)
=>
{
self
.visit_ty
(
ty
,
PositionalInfo
::
Location
(
location
));
self
.visit_ty
(
ty
,
Lookup
::
Loc
(
location
));
}
Rvalue
::
Aggregate
(
ref
$
(
$mutability
)
*
kind
,
...
...
@@ -522,7 +526,7 @@ fn super_rvalue(&mut self,
let
kind
=
&
$
(
$mutability
)
*
**
kind
;
match
*
kind
{
AggregateKind
::
Array
(
ref
$
(
$mutability
)
*
ty
)
=>
{
self
.visit_ty
(
ty
,
PositionalInfo
::
Location
(
location
));
self
.visit_ty
(
ty
,
Lookup
::
Loc
(
location
));
}
AggregateKind
::
Tuple
=>
{
}
...
...
@@ -584,7 +588,7 @@ fn super_static(&mut self,
ref
$
(
$mutability
)
*
ty
,
}
=
*
static_
;
self
.visit_def_id
(
def_id
,
location
);
self
.visit_ty
(
ty
,
PositionalInfo
::
Location
(
location
));
self
.visit_ty
(
ty
,
Lookup
::
Loc
(
location
));
}
fn
super_projection
(
&
mut
self
,
...
...
@@ -614,7 +618,7 @@ fn super_projection_elem(&mut self,
ProjectionElem
::
Subslice
{
from
:
_
,
to
:
_
}
=>
{
}
ProjectionElem
::
Field
(
_
field
,
ref
$
(
$mutability
)
*
ty
)
=>
{
self
.visit_ty
(
ty
,
PositionalInfo
::
Location
(
location
));
self
.visit_ty
(
ty
,
Lookup
::
Loc
(
location
));
}
ProjectionElem
::
Index
(
ref
$
(
$mutability
)
*
operand
)
=>
{
self
.visit_operand
(
operand
,
location
);
...
...
@@ -638,7 +642,7 @@ fn super_local_decl(&mut self,
is_user_variable
:
_
,
}
=
*
local_decl
;
self
.visit_ty
(
ty
,
PositionalInfo
::
SourceInfo
(
*
source_info
));
self
.visit_ty
(
ty
,
Lookup
::
Src
(
*
source_info
));
self
.visit_source_info
(
source_info
);
}
...
...
@@ -661,7 +665,7 @@ fn super_constant(&mut self,
}
=
*
constant
;
self
.visit_span
(
span
);
self
.visit_ty
(
ty
,
PositionalInfo
::
Location
(
location
));
self
.visit_ty
(
ty
,
Lookup
::
Loc
(
location
));
self
.visit_literal
(
literal
,
location
);
}
...
...
@@ -737,10 +741,9 @@ fn visit_location(&mut self, mir: & $($mutability)* Mir<'tcx>, location: Locatio
make_mir_visitor!
(
Visitor
,);
make_mir_visitor!
(
MutVisitor
,
mut
);
pub
enum
PositionalInfo
{
Location
(
Location
),
SourceInfo
(
SourceInfo
),
Span
(
Span
),
pub
enum
Lookup
{
Loc
(
Location
),
Src
(
SourceInfo
),
}
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq)]
...
...
src/librustc_mir/build/mod.rs
浏览文件 @
4b9acad7
...
...
@@ -17,7 +17,7 @@
use
rustc
::
middle
::
region
::
CodeExtent
;
use
rustc
::
mir
::
*
;
use
rustc
::
mir
::
transform
::
MirSource
;
use
rustc
::
mir
::
visit
::{
MutVisitor
,
PositionalInfo
};
use
rustc
::
mir
::
visit
::{
MutVisitor
,
Lookup
};
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc
::
ty
::
subst
::
Substs
;
use
rustc
::
util
::
nodemap
::
NodeMap
;
...
...
@@ -143,7 +143,7 @@ struct GlobalizeMir<'a, 'gcx: 'a> {
}
impl
<
'a
,
'gcx
:
'tcx
,
'tcx
>
MutVisitor
<
'tcx
>
for
GlobalizeMir
<
'a
,
'gcx
>
{
fn
visit_ty
(
&
mut
self
,
ty
:
&
mut
Ty
<
'tcx
>
,
_
:
PositionalInfo
)
{
fn
visit_ty
(
&
mut
self
,
ty
:
&
mut
Ty
<
'tcx
>
,
_
:
Lookup
)
{
if
let
Some
(
lifted
)
=
self
.tcx
.lift
(
ty
)
{
*
ty
=
lifted
;
}
else
{
...
...
src/librustc_mir/transform/erase_regions.rs
浏览文件 @
4b9acad7
...
...
@@ -15,7 +15,7 @@
use
rustc
::
ty
::
subst
::
Substs
;
use
rustc
::
ty
::{
Ty
,
TyCtxt
,
ClosureSubsts
};
use
rustc
::
mir
::
*
;
use
rustc
::
mir
::
visit
::{
MutVisitor
,
PositionalInfo
};
use
rustc
::
mir
::
visit
::{
MutVisitor
,
Lookup
};
use
rustc
::
mir
::
transform
::{
MirPass
,
MirSource
};
struct
EraseRegionsVisitor
<
'a
,
'tcx
:
'a
>
{
...
...
@@ -31,7 +31,7 @@ pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
}
impl
<
'a
,
'tcx
>
MutVisitor
<
'tcx
>
for
EraseRegionsVisitor
<
'a
,
'tcx
>
{
fn
visit_ty
(
&
mut
self
,
ty
:
&
mut
Ty
<
'tcx
>
,
_
:
PositionalInfo
)
{
fn
visit_ty
(
&
mut
self
,
ty
:
&
mut
Ty
<
'tcx
>
,
_
:
Lookup
)
{
let
old_ty
=
*
ty
;
*
ty
=
self
.tcx
.erase_regions
(
&
old_ty
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录