Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e9c687b0
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,发现更多精彩内容 >>
提交
e9c687b0
编写于
3月 30, 2019
作者:
M
Matthew Jasper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Evaluate hair::ExprKind::Use in into
This avoids some unnecessary moves
上级
ff4d4b27
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
22 addition
and
24 deletion
+22
-24
src/librustc_mir/build/expr/as_rvalue.rs
src/librustc_mir/build/expr/as_rvalue.rs
+1
-4
src/librustc_mir/build/expr/category.rs
src/librustc_mir/build/expr/category.rs
+1
-1
src/librustc_mir/build/expr/into.rs
src/librustc_mir/build/expr/into.rs
+3
-1
src/test/mir-opt/array-index-is-temporary.rs
src/test/mir-opt/array-index-is-temporary.rs
+10
-11
src/test/mir-opt/retag.rs
src/test/mir-opt/retag.rs
+7
-7
未找到文件。
src/librustc_mir/build/expr/as_rvalue.rs
浏览文件 @
e9c687b0
...
...
@@ -150,10 +150,6 @@ fn expr_as_rvalue(
let
source
=
unpack!
(
block
=
this
.as_operand
(
block
,
scope
,
source
));
block
.and
(
Rvalue
::
Cast
(
CastKind
::
Misc
,
source
,
expr
.ty
))
}
ExprKind
::
Use
{
source
}
=>
{
let
source
=
unpack!
(
block
=
this
.as_operand
(
block
,
scope
,
source
));
block
.and
(
Rvalue
::
Use
(
source
))
}
ExprKind
::
Pointer
{
cast
,
source
}
=>
{
let
source
=
unpack!
(
block
=
this
.as_operand
(
block
,
scope
,
source
));
block
.and
(
Rvalue
::
Cast
(
CastKind
::
Pointer
(
cast
),
source
,
expr
.ty
))
...
...
@@ -363,6 +359,7 @@ fn expr_as_rvalue(
|
ExprKind
::
Match
{
..
}
|
ExprKind
::
If
{
..
}
|
ExprKind
::
NeverToAny
{
..
}
|
ExprKind
::
Use
{
..
}
|
ExprKind
::
Loop
{
..
}
|
ExprKind
::
LogicalOp
{
..
}
|
ExprKind
::
Call
{
..
}
...
...
src/librustc_mir/build/expr/category.rs
浏览文件 @
e9c687b0
...
...
@@ -48,6 +48,7 @@ pub fn of<'tcx>(ek: &ExprKind<'tcx>) -> Option<Category> {
|
ExprKind
::
If
{
..
}
|
ExprKind
::
Match
{
..
}
|
ExprKind
::
NeverToAny
{
..
}
|
ExprKind
::
Use
{
..
}
|
ExprKind
::
Call
{
..
}
=>
Some
(
Category
::
Rvalue
(
RvalueFunc
::
Into
)),
ExprKind
::
Array
{
..
}
...
...
@@ -58,7 +59,6 @@ pub fn of<'tcx>(ek: &ExprKind<'tcx>) -> Option<Category> {
|
ExprKind
::
Binary
{
..
}
|
ExprKind
::
Box
{
..
}
|
ExprKind
::
Cast
{
..
}
|
ExprKind
::
Use
{
..
}
|
ExprKind
::
Pointer
{
..
}
|
ExprKind
::
Repeat
{
..
}
|
ExprKind
::
Borrow
{
..
}
...
...
src/librustc_mir/build/expr/into.rs
浏览文件 @
e9c687b0
...
...
@@ -327,6 +327,9 @@ pub fn into_expr(
success
.unit
()
}
}
ExprKind
::
Use
{
source
}
=>
{
this
.into
(
destination
,
block
,
source
)
}
// These cases don't actually need a destination
ExprKind
::
Assign
{
..
}
...
...
@@ -379,7 +382,6 @@ pub fn into_expr(
|
ExprKind
::
Binary
{
..
}
|
ExprKind
::
Box
{
..
}
|
ExprKind
::
Cast
{
..
}
|
ExprKind
::
Use
{
..
}
|
ExprKind
::
Pointer
{
..
}
|
ExprKind
::
Repeat
{
..
}
|
ExprKind
::
Borrow
{
..
}
...
...
src/test/mir-opt/array-index-is-temporary.rs
浏览文件 @
e9c687b0
...
...
@@ -18,25 +18,24 @@ fn main() {
// START rustc.main.EraseRegions.after.mir
// bb0: {
// ...
// _6 = &mut _2;
// _5 = &mut (*_6);
// _4 = move _5 as *mut usize (Misc);
// _3 = move _4;
// _5 = &mut _2;
// _4 = &mut (*_5);
// _3 = move _4 as *mut usize (Misc);
// ...
// _
8
= _3;
// _
7 = const foo(move _8
) -> bb1;
// _
7
= _3;
// _
6 = const foo(move _7
) -> bb1;
// }
//
// bb1: {
// ...
// _
9
= _2;
// _
10
= Len(_1);
// _1
1 = Lt(_9, _10
);
// assert(move _1
1, "index out of bounds: the len is move _10 but the index is _9
") -> bb2;
// _
8
= _2;
// _
9
= Len(_1);
// _1
0 = Lt(_8, _9
);
// assert(move _1
0, "index out of bounds: the len is move _9 but the index is _8
") -> bb2;
// }
//
// bb2: {
// _1[_
9] = move _7
;
// _1[_
8] = move _6
;
// ...
// return;
// }
...
...
src/test/mir-opt/retag.rs
浏览文件 @
e9c687b0
...
...
@@ -75,18 +75,18 @@ fn main() {
// _10 = move _8;
// Retag(_10);
// ...
// _1
5
= &mut (*_10);
// Retag(_1
5
);
// _1
4 = move _15
as *mut i32 (Misc);
// Retag([raw] _1
4
);
// _1
3
= &mut (*_10);
// Retag(_1
3
);
// _1
2 = move _13
as *mut i32 (Misc);
// Retag([raw] _1
2
);
// ...
// _1
8 = move _19(move _20
) -> bb2;
// _1
6 = move _17(move _18
) -> bb2;
// }
//
// bb2: {
// Retag(_1
8
);
// Retag(_1
6
);
// ...
// _2
2 = const Test::foo_shr(move _23, move _25
) -> bb3;
// _2
0 = const Test::foo_shr(move _21, move _23
) -> bb3;
// }
//
// bb3: {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录