Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2dcf7dbb
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
2dcf7dbb
编写于
6月 11, 2020
作者:
D
Dylan MacKenzie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add tests for `const_precise_live_drops`
上级
9e2ee322
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
9 deletion
+49
-9
src/test/ui/consts/control-flow/drop-fail.precise.stderr
src/test/ui/consts/control-flow/drop-fail.precise.stderr
+15
-0
src/test/ui/consts/control-flow/drop-fail.rs
src/test/ui/consts/control-flow/drop-fail.rs
+8
-5
src/test/ui/consts/control-flow/drop-fail.stock.stderr
src/test/ui/consts/control-flow/drop-fail.stock.stderr
+4
-4
src/test/ui/consts/control-flow/drop-pass.rs
src/test/ui/consts/control-flow/drop-pass.rs
+2
-0
src/test/ui/consts/control-flow/drop-precise.rs
src/test/ui/consts/control-flow/drop-precise.rs
+20
-0
未找到文件。
src/test/ui/consts/control-flow/drop-fail.precise.stderr
0 → 100644
浏览文件 @
2dcf7dbb
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-fail.rs:10:9
|
LL | let x = Some(Vec::new());
| ^ constants cannot evaluate destructors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-fail.rs:41:9
|
LL | let mut tmp = None;
| ^^^^^^^ constants cannot evaluate destructors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0493`.
src/test/ui/consts/control-flow/drop-fail
ure
.rs
→
src/test/ui/consts/control-flow/drop-fail.rs
浏览文件 @
2dcf7dbb
// revisions: stock precise
#![feature(const_if_match)]
#![feature(const_loop)]
#![cfg_attr(precise,
feature(const_precise_live_drops))]
// `x` is *not* always moved into the final value may be dropped inside the initializer.
// `x` is *not* always moved into the final value
and
may be dropped inside the initializer.
const
_
:
Option
<
Vec
<
i32
>>
=
{
let
y
:
Option
<
Vec
<
i32
>>
=
None
;
let
x
=
Some
(
Vec
::
new
());
//~^ ERROR destructors cannot be evaluated at compile-time
//
[stock,precise]
~^ ERROR destructors cannot be evaluated at compile-time
if
true
{
x
...
...
@@ -18,7 +21,7 @@
// existing analysis.
const
_
:
Vec
<
i32
>
=
{
let
vec_tuple
=
(
Vec
::
new
(),);
//~^ ERROR destructors cannot be evaluated at compile-time
//
[stock]
~^ ERROR destructors cannot be evaluated at compile-time
vec_tuple
.0
};
...
...
@@ -26,7 +29,7 @@
// This applies to single-field enum variants as well.
const
_
:
Vec
<
i32
>
=
{
let
x
:
Result
<
_
,
Vec
<
i32
>>
=
Ok
(
Vec
::
new
());
//~^ ERROR destructors cannot be evaluated at compile-time
//
[stock]
~^ ERROR destructors cannot be evaluated at compile-time
match
x
{
Ok
(
x
)
|
Err
(
x
)
=>
x
,
...
...
@@ -36,7 +39,7 @@
const
_
:
Option
<
Vec
<
i32
>>
=
{
let
mut
some
=
Some
(
Vec
::
new
());
let
mut
tmp
=
None
;
//~^ ERROR destructors cannot be evaluated at compile-time
//
[stock,precise]
~^ ERROR destructors cannot be evaluated at compile-time
let
mut
i
=
0
;
while
i
<
10
{
...
...
src/test/ui/consts/control-flow/drop-fail
ure
.stderr
→
src/test/ui/consts/control-flow/drop-fail
.stock
.stderr
浏览文件 @
2dcf7dbb
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-fail
ure.rs:7
:9
--> $DIR/drop-fail
.rs:10
:9
|
LL | let x = Some(Vec::new());
| ^ constants cannot evaluate destructors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-fail
ure.rs:20
:9
--> $DIR/drop-fail
.rs:23
:9
|
LL | let vec_tuple = (Vec::new(),);
| ^^^^^^^^^ constants cannot evaluate destructors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-fail
ure.rs:28
:9
--> $DIR/drop-fail
.rs:31
:9
|
LL | let x: Result<_, Vec<i32>> = Ok(Vec::new());
| ^ constants cannot evaluate destructors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop-fail
ure.rs:38
:9
--> $DIR/drop-fail
.rs:41
:9
|
LL | let mut tmp = None;
| ^^^^^^^ constants cannot evaluate destructors
...
...
src/test/ui/consts/control-flow/drop-
succe
ss.rs
→
src/test/ui/consts/control-flow/drop-
pa
ss.rs
浏览文件 @
2dcf7dbb
// run-pass
// revisions: stock precise
#![feature(const_if_match)]
#![feature(const_loop)]
#![cfg_attr(precise,
feature(const_precise_live_drops))]
// `x` is always moved into the final value and is not dropped inside the initializer.
const
_
:
Option
<
Vec
<
i32
>>
=
{
...
...
src/test/ui/consts/control-flow/drop-precise.rs
0 → 100644
浏览文件 @
2dcf7dbb
// run-pass
// gate-test-const_precise_live_drops
#![feature(const_if_match)]
#![feature(const_loop)]
#![feature(const_precise_live_drops)]
const
_
:
Vec
<
i32
>
=
{
let
vec_tuple
=
(
Vec
::
new
(),);
vec_tuple
.0
};
const
_
:
Vec
<
i32
>
=
{
let
x
:
Result
<
_
,
Vec
<
i32
>>
=
Ok
(
Vec
::
new
());
match
x
{
Ok
(
x
)
|
Err
(
x
)
=>
x
,
}
};
fn
main
()
{}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录