Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b04e6c73
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,发现更多精彩内容 >>
未验证
提交
b04e6c73
编写于
8月 24, 2019
作者:
S
Santiago Pastorino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make move_path_children_matching closure take a PlaceElem instead of a slice
上级
7efee8dd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
16 deletion
+16
-16
src/librustc_mir/dataflow/drop_flag_effects.rs
src/librustc_mir/dataflow/drop_flag_effects.rs
+7
-4
src/librustc_mir/transform/elaborate_drops.rs
src/librustc_mir/transform/elaborate_drops.rs
+9
-12
未找到文件。
src/librustc_mir/dataflow/drop_flag_effects.rs
浏览文件 @
b04e6c73
...
...
@@ -10,14 +10,17 @@ pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>,
path
:
MovePathIndex
,
mut
cond
:
F
)
->
Option
<
MovePathIndex
>
where
F
:
FnMut
(
&
[
mir
::
PlaceElem
<
'tcx
>
]
)
->
bool
where
F
:
FnMut
(
&
mir
::
PlaceElem
<
'tcx
>
)
->
bool
{
let
mut
next_child
=
move_data
.move_paths
[
path
]
.first_child
;
while
let
Some
(
child_index
)
=
next_child
{
if
cond
(
&
move_data
.move_paths
[
child_index
]
.place.projection
)
{
return
Some
(
child_index
)
let
move_path_children
=
&
move_data
.move_paths
[
child_index
];
if
let
Some
(
elem
)
=
move_path_children
.place.projection
.last
()
{
if
cond
(
elem
)
{
return
Some
(
child_index
)
}
}
next_child
=
move_
data
.move_paths
[
child_index
]
.next_sibling
;
next_child
=
move_
path_children
.next_sibling
;
}
None
...
...
src/librustc_mir/transform/elaborate_drops.rs
浏览文件 @
b04e6c73
...
...
@@ -236,18 +236,18 @@ fn clear_drop_flag(&mut self, loc: Location, path: Self::Path, mode: DropFlagMod
}
fn
field_subpath
(
&
self
,
path
:
Self
::
Path
,
field
:
Field
)
->
Option
<
Self
::
Path
>
{
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
p
|
match
p
{
[
..
,
ProjectionElem
::
Field
(
idx
,
_
)]
=>
*
idx
==
field
,
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
e
|
match
e
{
ProjectionElem
::
Field
(
idx
,
_
)
=>
*
idx
==
field
,
_
=>
false
,
})
}
fn
array_subpath
(
&
self
,
path
:
Self
::
Path
,
index
:
u32
,
size
:
u32
)
->
Option
<
Self
::
Path
>
{
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
p
|
match
p
{
[
..
,
ProjectionElem
::
ConstantIndex
{
offset
,
min_length
:
_
,
from_end
:
false
}]
=>
{
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
e
|
match
e
{
ProjectionElem
::
ConstantIndex
{
offset
,
min_length
:
_
,
from_end
:
false
}
=>
{
*
offset
==
index
}
[
..
,
ProjectionElem
::
ConstantIndex
{
offset
,
min_length
:
_
,
from_end
:
true
}]
=>
{
ProjectionElem
::
ConstantIndex
{
offset
,
min_length
:
_
,
from_end
:
true
}
=>
{
size
-
offset
==
index
}
_
=>
false
,
...
...
@@ -255,17 +255,14 @@ fn array_subpath(&self, path: Self::Path, index: u32, size: u32) -> Option<Self:
}
fn
deref_subpath
(
&
self
,
path
:
Self
::
Path
)
->
Option
<
Self
::
Path
>
{
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
p
|
{
match
p
{
[
..
,
ProjectionElem
::
Deref
]
=>
true
,
_
=>
false
}
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
e
|
{
*
e
==
ProjectionElem
::
Deref
})
}
fn
downcast_subpath
(
&
self
,
path
:
Self
::
Path
,
variant
:
VariantIdx
)
->
Option
<
Self
::
Path
>
{
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
p
|
match
p
{
[
..
,
ProjectionElem
::
Downcast
(
_
,
idx
)]
=>
*
idx
==
variant
,
dataflow
::
move_path_children_matching
(
self
.ctxt
.move_data
(),
path
,
|
e
|
match
e
{
ProjectionElem
::
Downcast
(
_
,
idx
)
=>
*
idx
==
variant
,
_
=>
false
})
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录