Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9d3c59d6
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
9d3c59d6
编写于
7月 12, 2019
作者:
A
Albin Stjerna
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustfmt all the things!
上级
ac0a3d10
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
246 addition
and
602 deletion
+246
-602
src/librustc/mir/mod.rs
src/librustc/mir/mod.rs
+218
-511
src/librustc_mir/borrow_check/flows.rs
src/librustc_mir/borrow_check/flows.rs
+2
-7
src/librustc_mir/borrow_check/nll/facts.rs
src/librustc_mir/borrow_check/nll/facts.rs
+8
-37
src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs
src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs
+1
-1
src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs
...ibrustc_mir/borrow_check/nll/type_check/liveness/trace.rs
+17
-46
未找到文件。
src/librustc/mir/mod.rs
浏览文件 @
9d3c59d6
此差异已折叠。
点击以展开。
src/librustc_mir/borrow_check/flows.rs
浏览文件 @
9d3c59d6
...
...
@@ -15,8 +15,8 @@
use
crate
::
dataflow
::
move_paths
::
HasMoveData
;
use
crate
::
dataflow
::
Borrows
;
use
crate
::
dataflow
::
EverInitializedPlaces
;
use
crate
::
dataflow
::{
FlowAtLocation
,
FlowsAtLocation
};
use
crate
::
dataflow
::
MaybeUninitializedPlaces
;
use
crate
::
dataflow
::{
FlowAtLocation
,
FlowsAtLocation
};
use
either
::
Either
;
use
std
::
fmt
;
use
std
::
rc
::
Rc
;
...
...
@@ -40,12 +40,7 @@ impl<'b, 'tcx> Flows<'b, 'tcx> {
ever_inits
:
FlowAtLocation
<
'tcx
,
EverInitializedPlaces
<
'b
,
'tcx
>>
,
polonius_output
:
Option
<
Rc
<
PoloniusOutput
>>
,
)
->
Self
{
Flows
{
borrows
,
uninits
,
ever_inits
,
polonius_output
,
}
Flows
{
borrows
,
uninits
,
ever_inits
,
polonius_output
}
}
crate
fn
borrows_in_scope
(
...
...
src/librustc_mir/borrow_check/nll/facts.rs
浏览文件 @
9d3c59d6
...
...
@@ -28,8 +28,7 @@ fn write_to_dir(
impl
AllFactsExt
for
AllFacts
{
/// Return
fn
enabled
(
tcx
:
TyCtxt
<
'_
>
)
->
bool
{
tcx
.sess.opts.debugging_opts.nll_facts
||
tcx
.sess.opts.debugging_opts.polonius
tcx
.sess.opts.debugging_opts.nll_facts
||
tcx
.sess.opts.debugging_opts.polonius
}
fn
write_to_dir
(
...
...
@@ -91,11 +90,7 @@ struct FactWriter<'w> {
}
impl
<
'w
>
FactWriter
<
'w
>
{
fn
write_facts_to_path
<
T
>
(
&
self
,
rows
:
&
[
T
],
file_name
:
&
str
,
)
->
Result
<
(),
Box
<
dyn
Error
>>
fn
write_facts_to_path
<
T
>
(
&
self
,
rows
:
&
[
T
],
file_name
:
&
str
)
->
Result
<
(),
Box
<
dyn
Error
>>
where
T
:
FactRow
,
{
...
...
@@ -109,19 +104,11 @@ fn write_facts_to_path<T>(
}
trait
FactRow
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
,
)
->
Result
<
(),
Box
<
dyn
Error
>>
;
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
)
->
Result
<
(),
Box
<
dyn
Error
>>
;
}
impl
FactRow
for
RegionVid
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
,
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
write_row
(
out
,
location_table
,
&
[
self
])
}
}
...
...
@@ -131,11 +118,7 @@ impl<A, B> FactRow for (A, B)
A
:
FactCell
,
B
:
FactCell
,
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
,
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
write_row
(
out
,
location_table
,
&
[
&
self
.0
,
&
self
.1
])
}
}
...
...
@@ -146,11 +129,7 @@ impl<A, B, C> FactRow for (A, B, C)
B
:
FactCell
,
C
:
FactCell
,
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
,
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
write_row
(
out
,
location_table
,
&
[
&
self
.0
,
&
self
.1
,
&
self
.2
])
}
}
...
...
@@ -162,11 +141,7 @@ impl<A, B, C, D> FactRow for (A, B, C, D)
C
:
FactCell
,
D
:
FactCell
,
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
,
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
fn
write
(
&
self
,
out
:
&
mut
File
,
location_table
:
&
LocationTable
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
write_row
(
out
,
location_table
,
&
[
&
self
.0
,
&
self
.1
,
&
self
.2
,
&
self
.3
])
}
}
...
...
@@ -177,11 +152,7 @@ fn write_row(
columns
:
&
[
&
dyn
FactCell
],
)
->
Result
<
(),
Box
<
dyn
Error
>>
{
for
(
index
,
c
)
in
columns
.iter
()
.enumerate
()
{
let
tail
=
if
index
==
columns
.len
()
-
1
{
"
\n
"
}
else
{
"
\t
"
};
let
tail
=
if
index
==
columns
.len
()
-
1
{
"
\n
"
}
else
{
"
\t
"
};
write!
(
out
,
"{:?}{}"
,
c
.to_string
(
location_table
),
tail
)
?
;
}
Ok
(())
...
...
src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs
浏览文件 @
9d3c59d6
...
...
@@ -7,7 +7,7 @@
use
crate
::
dataflow
::
move_paths
::
MoveData
;
use
crate
::
dataflow
::
FlowAtLocation
;
use
crate
::
dataflow
::
MaybeInitializedPlaces
;
use
rustc
::
mir
::{
Local
,
Body
};
use
rustc
::
mir
::{
Body
,
Local
};
use
rustc
::
ty
::{
RegionVid
,
TyCtxt
};
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
std
::
rc
::
Rc
;
...
...
src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs
浏览文件 @
9d3c59d6
...
...
@@ -247,9 +247,7 @@ fn compute_use_live_points_for(&mut self, local: Local) {
}
if
self
.use_live_at
.insert
(
p
)
{
self
.cx
.elements
.push_predecessors
(
self
.cx.body
,
p
,
&
mut
self
.stack
)
self
.cx.elements
.push_predecessors
(
self
.cx.body
,
p
,
&
mut
self
.stack
)
}
}
}
...
...
@@ -287,10 +285,7 @@ fn compute_drop_live_points_for(&mut self, local: Local) {
}
}
debug!
(
"compute_drop_live_points_for: drop_locations={:?}"
,
self
.drop_locations
);
debug!
(
"compute_drop_live_points_for: drop_locations={:?}"
,
self
.drop_locations
);
// Reverse DFS. But for drops, we do it a bit differently.
// The stack only ever stores *terminators of blocks*. Within
...
...
@@ -326,17 +321,11 @@ fn compute_drop_live_points_for_block(&mut self, mpi: MovePathIndex, term_point:
// block. One of them may be either a definition or use
// live point.
let
term_location
=
self
.cx.elements
.to_location
(
term_point
);
debug_assert_eq!
(
self
.cx.body
.terminator_loc
(
term_location
.block
),
term_location
,
);
debug_assert_eq!
(
self
.cx.body
.terminator_loc
(
term_location
.block
),
term_location
,);
let
block
=
term_location
.block
;
let
entry_point
=
self
.cx.elements
.entry_point
(
term_location
.block
);
for
p
in
(
entry_point
..
term_point
)
.rev
()
{
debug!
(
"compute_drop_live_points_for_block: p = {:?}"
,
self
.cx.elements
.to_location
(
p
),
);
debug!
(
"compute_drop_live_points_for_block: p = {:?}"
,
self
.cx.elements
.to_location
(
p
));
if
self
.defs
.contains
(
p
)
{
debug!
(
"compute_drop_live_points_for_block: def site"
);
...
...
@@ -355,10 +344,7 @@ fn compute_drop_live_points_for_block(&mut self, mpi: MovePathIndex, term_point:
}
for
&
pred_block
in
self
.cx.body
.predecessors_for
(
block
)
.iter
()
{
debug!
(
"compute_drop_live_points_for_block: pred_block = {:?}"
,
pred_block
,
);
debug!
(
"compute_drop_live_points_for_block: pred_block = {:?}"
,
pred_block
,);
// Check whether the variable is (at least partially)
// initialized at the exit of this predecessor. If so, we
...
...
@@ -389,18 +375,12 @@ fn compute_drop_live_points_for_block(&mut self, mpi: MovePathIndex, term_point:
// If the terminator of this predecessor either *assigns*
// our value or is a "normal use", then stop.
if
self
.defs
.contains
(
pred_term_point
)
{
debug!
(
"compute_drop_live_points_for_block: defined at {:?}"
,
pred_term_loc
);
debug!
(
"compute_drop_live_points_for_block: defined at {:?}"
,
pred_term_loc
);
continue
;
}
if
self
.use_live_at
.contains
(
pred_term_point
)
{
debug!
(
"compute_drop_live_points_for_block: use-live at {:?}"
,
pred_term_loc
);
debug!
(
"compute_drop_live_points_for_block: use-live at {:?}"
,
pred_term_loc
);
continue
;
}
...
...
@@ -461,10 +441,7 @@ fn initialized_at_terminator(&mut self, block: BasicBlock, mpi: MovePathIndex) -
// "just ahead" of a terminator.
self
.flow_inits
.reset_to_entry_of
(
block
);
for
statement_index
in
0
..
self
.body
[
block
]
.statements
.len
()
{
let
location
=
Location
{
block
,
statement_index
,
};
let
location
=
Location
{
block
,
statement_index
};
self
.flow_inits
.reconstruct_statement_effect
(
location
);
self
.flow_inits
.apply_local_effect
(
location
);
}
...
...
@@ -531,12 +508,11 @@ fn add_drop_live_facts_for(
if
let
Some
(
data
)
=
&
drop_data
.region_constraint_data
{
for
&
drop_location
in
drop_locations
{
self
.typeck
.push_region_constraints
(
drop_location
.to_locations
(),
ConstraintCategory
::
Boring
,
data
,
);
self
.typeck
.push_region_constraints
(
drop_location
.to_locations
(),
ConstraintCategory
::
Boring
,
data
,
);
}
}
...
...
@@ -602,14 +578,9 @@ fn compute_drop_data(
debug!
(
"compute_drop_data(dropped_ty={:?})"
,
dropped_ty
,);
let
param_env
=
typeck
.param_env
;
let
(
dropck_result
,
region_constraint_data
)
=
param_env
.and
(
DropckOutlives
::
new
(
dropped_ty
))
.fully_perform
(
typeck
.infcx
)
.unwrap
();
DropData
{
dropck_result
,
region_constraint_data
,
}
let
(
dropck_result
,
region_constraint_data
)
=
param_env
.and
(
DropckOutlives
::
new
(
dropped_ty
))
.fully_perform
(
typeck
.infcx
)
.unwrap
();
DropData
{
dropck_result
,
region_constraint_data
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录