test more failure cases for approximating the "longer" side
as suggested by arielb1
This commit is contained in:
parent
ca60826110
commit
2a17b9390b
5 changed files with 157 additions and 48 deletions
|
@ -1,46 +0,0 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
--> $DIR/propagate-approximated-to-empty.rs:41:9
|
||||
|
|
||||
41 | demand_y(x, y, x.get())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: free region `'_#6r` does not outlive free region `'_#4r`
|
||||
--> $DIR/propagate-approximated-to-empty.rs:41:21
|
||||
|
|
||||
41 | demand_y(x, y, x.get())
|
||||
| ^
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/propagate-approximated-to-empty.rs:39:47
|
||||
|
|
||||
39 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
||||
| _______________________________________________^
|
||||
40 | | // Only works if 'x: 'y:
|
||||
41 | | demand_y(x, y, x.get())
|
||||
42 | | //~^ WARN not reporting region error due to -Znll
|
||||
43 | | //~| ERROR free region `'_#6r` does not outlive free region `'_#4r`
|
||||
44 | | });
|
||||
| |_____^
|
||||
|
|
||||
= note: defining type: DefId(0/1:18 ~ propagate_approximated_to_empty[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
|
||||
|
|
||||
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| {
|
||||
40 | | // Only works if 'x: 'y:
|
||||
41 | | demand_y(x, y, x.get())
|
||||
... |
|
||||
44 | | });
|
||||
45 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: defining type: DefId(0/0:6 ~ propagate_approximated_to_empty[317d]::supply[0]) with substs []
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
--> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:9
|
||||
|
|
||||
47 | demand_y(x, y, x.get())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: free region `'_#6r` does not outlive free region `'_#4r`
|
||||
--> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:21
|
||||
|
|
||||
47 | demand_y(x, y, x.get())
|
||||
| ^
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:45:47
|
||||
|
|
||||
45 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
||||
| _______________________________________________^
|
||||
46 | | // Only works if 'x: 'y:
|
||||
47 | | demand_y(x, y, x.get())
|
||||
48 | | //~^ WARN not reporting region error due to -Znll
|
||||
49 | | //~| ERROR free region `'_#6r` does not outlive free region `'_#4r`
|
||||
50 | | });
|
||||
| |_____^
|
||||
|
|
||||
= 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-fail-to-approximate-longer-no-bounds.rs:44:1
|
||||
|
|
||||
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| {
|
||||
46 | | // Only works if 'x: 'y:
|
||||
47 | | demand_y(x, y, x.get())
|
||||
... |
|
||||
50 | | });
|
||||
51 | | }
|
||||
| |_^
|
||||
|
|
||||
= 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
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// 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() {}
|
|
@ -0,0 +1,46 @@
|
|||
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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue