Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2a17b939
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,发现更多精彩内容 >>
提交
2a17b939
编写于
12月 06, 2017
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test more failure cases for approximating the "longer" side
as suggested by arielb1
上级
ca608261
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
157 addition
and
2 deletion
+157
-2
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs
...rements/propagate-fail-to-approximate-longer-no-bounds.rs
+8
-2
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
...nts/propagate-fail-to-approximate-longer-no-bounds.stderr
+46
-0
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs
...ents/propagate-fail-to-approximate-longer-wrong-bounds.rs
+57
-0
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
.../propagate-fail-to-approximate-longer-wrong-bounds.stderr
+46
-0
未找到文件。
src/test/ui/nll/closure-requirements/propagate-
approximated-to-empty
.rs
→
src/test/ui/nll/closure-requirements/propagate-
fail-to-approximate-longer-no-bounds
.rs
浏览文件 @
2a17b939
...
...
@@ -8,8 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test a case where we fail to approximate one of the regions and
// hence report an error while checking the closure.
// Similarly to escape-argument-callee, a test case where the closure
// requires a relationship between 2 unrelated higher-ranked regions,
// with no helpful relations between the HRRs and free regions.
//
// In this case, the error is reported by the closure itself. This is
// because it is unable to approximate the higher-ranked region `'x`,
// as it knows of no relationships between `'x` and any
// non-higher-ranked regions.
// compile-flags:-Znll -Zborrowck=mir -Zverbose
...
...
src/test/ui/nll/closure-requirements/propagate-
approximated-to-empty
.stderr
→
src/test/ui/nll/closure-requirements/propagate-
fail-to-approximate-longer-no-bounds
.stderr
浏览文件 @
2a17b939
warning: not reporting region error due to -Znll
--> $DIR/propagate-
approximated-to-empty.rs:41
:9
--> $DIR/propagate-
fail-to-approximate-longer-no-bounds.rs:47
:9
|
4
1
| demand_y(x, y, x.get())
4
7
| demand_y(x, y, x.get())
| ^^^^^^^^^^^^^^^^^^^^^^^
error: free region `'_#6r` does not outlive free region `'_#4r`
--> $DIR/propagate-
approximated-to-empty.rs:41
:21
--> $DIR/propagate-
fail-to-approximate-longer-no-bounds.rs:47
:21
|
4
1
| demand_y(x, y, x.get())
4
7
| demand_y(x, y, x.get())
| ^
note: External requirements
--> $DIR/propagate-
approximated-to-empty.rs:39
:47
--> $DIR/propagate-
fail-to-approximate-longer-no-bounds.rs:45
:47
|
39
| establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
45
| establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
| _______________________________________________^
4
0
| | // Only works if 'x: 'y:
4
1
| | demand_y(x, y, x.get())
4
2
| | //~^ WARN not reporting region error due to -Znll
4
3
| | //~| ERROR free region `'_#6r` does not outlive free region `'_#4r`
44
| | });
4
6
| | // Only works if 'x: 'y:
4
7
| | demand_y(x, y, x.get())
4
8
| | //~^ WARN not reporting region error due to -Znll
4
9
| | //~| ERROR free region `'_#6r` does not outlive free region `'_#4r`
50
| | });
| |_____^
|
= note: defining type: DefId(0/1:18 ~ propagate_
approximated_to_empty
[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0/1:18 ~ propagate_
fail_to_approximate_longer_no_bounds
[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>))
]
= note: number of external vids: 2
note: No external requirements
--> $DIR/propagate-
approximated-to-empty.rs:38
:1
--> $DIR/propagate-
fail-to-approximate-longer-no-bounds.rs:44
:1
|
38
| / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
39
| | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
4
0
| | // Only works if 'x: 'y:
4
1
| | demand_y(x, y, x.get())
44
| / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
45
| | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
4
6
| | // Only works if 'x: 'y:
4
7
| | demand_y(x, y, x.get())
... |
44
| | });
45
| | }
50
| | });
51
| | }
| |_^
|
= note: defining type: DefId(0/0:6 ~ propagate_
approximated_to_empty
[317d]::supply[0]) with substs []
= note: defining type: DefId(0/0:6 ~ propagate_
fail_to_approximate_longer_no_bounds
[317d]::supply[0]) with substs []
error: aborting due to previous error
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs
0 → 100644
浏览文件 @
2a17b939
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Similarly to escape-argument-callee, a test case where the closure
// requires a relationship between 2 unrelated higher-ranked regions,
// with no helpful relations between the HRRs and free regions.
//
// In this case, the error is reported by the closure itself. This is
// because it is unable to approximate the higher-ranked region `'x`,
// as it only knows of regions that `'x` is outlived by, and none that
// `'x` outlives.
// compile-flags:-Znll -Zborrowck=mir -Zverbose
#![feature(rustc_attrs)]
use
std
::
cell
::
Cell
;
// Callee knows that:
//
// 'a: 'x
// 'b: 'y
//
// but this doesn't really help us in proving that `'x: 'y`, so
// closure gets an error. In particular, we would need to know that
// `'x: 'a`, so that we could approximate `'x` "downwards" to `'a`.
fn
establish_relationships
<
'a
,
'b
,
F
>
(
_
cell_a
:
&
Cell
<&
'a
u32
>
,
_
cell_b
:
&
Cell
<&
'b
u32
>
,
_
closure
:
F
)
where
F
:
for
<
'x
,
'y
>
FnMut
(
&
Cell
<&
'x
&
'a
u32
>
,
// shows that 'a: 'x
&
Cell
<&
'y
&
'b
u32
>
,
// shows that 'b: 'y
&
Cell
<&
'x
u32
>
,
&
Cell
<&
'y
u32
>
,
),
{
}
fn
demand_y
<
'x
,
'y
>
(
_
cell_x
:
&
Cell
<&
'x
u32
>
,
_
cell_y
:
&
Cell
<&
'y
u32
>
,
_
y
:
&
'y
u32
)
{}
#[rustc_regions]
fn
supply
<
'a
,
'b
>
(
cell_a
:
Cell
<&
'a
u32
>
,
cell_b
:
Cell
<&
'b
u32
>
)
{
establish_relationships
(
&
cell_a
,
&
cell_b
,
|
_
outlives1
,
_
outlives2
,
x
,
y
|
{
// Only works if 'x: 'y:
demand_y
(
x
,
y
,
x
.get
())
//~^ WARN not reporting region error due to -Znll
//~| ERROR free region `'_#5r` does not outlive free region `'_#7r`
});
}
fn
main
()
{}
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
0 → 100644
浏览文件 @
2a17b939
warning: not reporting region error due to -Znll
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:9
|
51 | demand_y(x, y, x.get())
| ^^^^^^^^^^^^^^^^^^^^^^^
error: free region `'_#5r` does not outlive free region `'_#7r`
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:21
|
51 | demand_y(x, y, x.get())
| ^
note: External requirements
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:49:47
|
49 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
| _______________________________________________^
50 | | // Only works if 'x: 'y:
51 | | demand_y(x, y, x.get())
52 | | //~^ WARN not reporting region error due to -Znll
53 | | //~| ERROR free region `'_#5r` does not outlive free region `'_#7r`
54 | | });
| |_____^
|
= note: defining type: DefId(0/1:18 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>))
]
= note: number of external vids: 3
note: No external requirements
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:48:1
|
48 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
49 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
50 | | // Only works if 'x: 'y:
51 | | demand_y(x, y, x.get())
... |
54 | | });
55 | | }
| |_^
|
= note: defining type: DefId(0/0:6 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []
error: aborting due to previous error
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录