Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f2c14689
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,发现更多精彩内容 >>
提交
f2c14689
编写于
1月 25, 2020
作者:
J
Jonas Schievink
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add resume arg place to `Yield` MIR terminator
上级
2101a1fe
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
7 deletion
+26
-7
src/librustc/mir/mod.rs
src/librustc/mir/mod.rs
+8
-3
src/librustc/mir/visit.rs
src/librustc/mir/visit.rs
+6
-0
src/librustc_mir/borrow_check/invalidation.rs
src/librustc_mir/borrow_check/invalidation.rs
+3
-1
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/mod.rs
+3
-1
src/librustc_mir/borrow_check/universal_regions.rs
src/librustc_mir/borrow_check/universal_regions.rs
+3
-1
src/librustc_mir/dataflow/move_paths/builder.rs
src/librustc_mir/dataflow/move_paths/builder.rs
+3
-1
未找到文件。
src/librustc/mir/mod.rs
浏览文件 @
f2c14689
...
...
@@ -1120,6 +1120,8 @@ pub enum TerminatorKind<'tcx> {
value
:
Operand
<
'tcx
>
,
/// Where to resume to.
resume
:
BasicBlock
,
/// The place to store the resume argument in.
resume_arg
:
Place
<
'tcx
>
,
/// Cleanup to be done if the generator is dropped at this suspend point.
drop
:
Option
<
BasicBlock
>
,
},
...
...
@@ -2645,9 +2647,12 @@ fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
target
,
unwind
,
},
Yield
{
ref
value
,
resume
,
drop
}
=>
{
Yield
{
value
:
value
.fold_with
(
folder
),
resume
:
resume
,
drop
:
drop
}
}
Yield
{
ref
value
,
resume
,
ref
resume_arg
,
drop
}
=>
Yield
{
value
:
value
.fold_with
(
folder
),
resume
,
resume_arg
:
resume_arg
.fold_with
(
folder
),
drop
,
},
Call
{
ref
func
,
ref
args
,
ref
destination
,
cleanup
,
from_hir_call
}
=>
{
let
dest
=
destination
.as_ref
()
.map
(|
&
(
ref
loc
,
dest
)|
(
loc
.fold_with
(
folder
),
dest
));
...
...
src/librustc/mir/visit.rs
浏览文件 @
f2c14689
...
...
@@ -516,8 +516,14 @@ fn super_terminator_kind(&mut self,
TerminatorKind
::
Yield
{
value
,
resume
:
_
,
resume_arg
,
drop
:
_
,
}
=>
{
self
.visit_place
(
resume_arg
,
PlaceContext
::
MutatingUse
(
MutatingUseContext
::
Store
),
source_location
,
);
self
.visit_operand
(
value
,
source_location
);
}
...
...
src/librustc_mir/borrow_check/invalidation.rs
浏览文件 @
f2c14689
...
...
@@ -159,7 +159,7 @@ fn visit_terminator_kind(&mut self, kind: &TerminatorKind<'tcx>, location: Locat
self
.consume_operand
(
location
,
index
);
}
}
TerminatorKind
::
Yield
{
ref
value
,
resume
,
drop
:
_
}
=>
{
TerminatorKind
::
Yield
{
ref
value
,
resume
,
resume_arg
,
drop
:
_
}
=>
{
self
.consume_operand
(
location
,
value
);
// Invalidate all borrows of local places
...
...
@@ -170,6 +170,8 @@ fn visit_terminator_kind(&mut self, kind: &TerminatorKind<'tcx>, location: Locat
self
.all_facts.invalidates
.push
((
resume
,
i
));
}
}
self
.mutate_place
(
location
,
resume_arg
,
Deep
,
JustWrite
);
}
TerminatorKind
::
Resume
|
TerminatorKind
::
Return
|
TerminatorKind
::
GeneratorDrop
=>
{
// Invalidate all borrows of local places
...
...
src/librustc_mir/borrow_check/mod.rs
浏览文件 @
f2c14689
...
...
@@ -684,7 +684,7 @@ fn visit_terminator_entry(
}
}
TerminatorKind
::
Yield
{
ref
value
,
resume
:
_
,
drop
:
_
}
=>
{
TerminatorKind
::
Yield
{
ref
value
,
resume
:
_
,
ref
resume_arg
,
drop
:
_
}
=>
{
self
.consume_operand
(
loc
,
(
value
,
span
),
flow_state
);
if
self
.movable_generator
{
...
...
@@ -697,6 +697,8 @@ fn visit_terminator_entry(
}
});
}
self
.mutate_place
(
loc
,
(
resume_arg
,
span
),
Deep
,
JustWrite
,
flow_state
);
}
TerminatorKind
::
Resume
|
TerminatorKind
::
Return
|
TerminatorKind
::
GeneratorDrop
=>
{
...
...
src/librustc_mir/borrow_check/universal_regions.rs
浏览文件 @
f2c14689
...
...
@@ -581,9 +581,11 @@ fn compute_inputs_and_output(
DefiningTy
::
Generator
(
def_id
,
substs
,
movability
)
=>
{
assert_eq!
(
self
.mir_def_id
,
def_id
);
let
resume_ty
=
substs
.as_generator
()
.resume_ty
(
def_id
,
tcx
);
let
output
=
substs
.as_generator
()
.return_ty
(
def_id
,
tcx
);
let
generator_ty
=
tcx
.mk_generator
(
def_id
,
substs
,
movability
);
let
inputs_and_output
=
self
.infcx.tcx
.intern_type_list
(
&
[
generator_ty
,
output
]);
let
inputs_and_output
=
self
.infcx.tcx
.intern_type_list
(
&
[
generator_ty
,
resume_ty
,
output
]);
ty
::
Binder
::
dummy
(
inputs_and_output
)
}
...
...
src/librustc_mir/dataflow/move_paths/builder.rs
浏览文件 @
f2c14689
...
...
@@ -380,7 +380,9 @@ fn gather_terminator(&mut self, term: &Terminator<'tcx>) {
self
.gather_operand
(
discr
);
}
TerminatorKind
::
Yield
{
ref
value
,
..
}
=>
{
TerminatorKind
::
Yield
{
ref
value
,
resume_arg
:
ref
place
,
..
}
=>
{
self
.create_move_path
(
place
);
self
.gather_init
(
place
.as_ref
(),
InitKind
::
Deep
);
self
.gather_operand
(
value
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录