forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix closure tests now that MIR typeck works properly
These tests had FIXMEs for errors that were not previously being reported.
- Loading branch information
1 parent
da45109
commit 3eb4284
Showing
6 changed files
with
83 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 26 additions & 15 deletions
41
src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,44 @@ | ||
warning: not reporting region error due to -Znll | ||
--> $DIR/propagate-approximated-ref.rs:60:9 | ||
--> $DIR/propagate-approximated-ref.rs:57:9 | ||
| | ||
60 | demand_y(x, y, x.get()) | ||
57 | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
note: External requirements | ||
--> $DIR/propagate-approximated-ref.rs:58:47 | ||
--> $DIR/propagate-approximated-ref.rs:53:47 | ||
| | ||
58 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ||
53 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ||
| _______________________________________________^ | ||
59 | | // Only works if 'x: 'y: | ||
60 | | demand_y(x, y, x.get()) | ||
61 | | }); | ||
54 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` | ||
55 | | | ||
56 | | // Only works if 'x: 'y: | ||
57 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll | ||
58 | | }); | ||
| |_____^ | ||
| | ||
= note: defining type: [closure@$DIR/propagate-approximated-ref.rs:58:47: 61:6<i16, for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(7715))) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7716))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0(7717))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1(7718))) &'_#2r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2(9542))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7716))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't3(9543))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1(7718))) u32>))>] | ||
= note: defining type: [closure@$DIR/propagate-approximated-ref.rs:53:47: 58:6<i16, for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(7715))) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7716))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0(7717))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1(7718))) &'_#2r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2(9542))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7716))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't3(9543))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1(7718))) u32>))>] | ||
= note: number of external vids: 3 | ||
= note: where '_#1r: '_#2r | ||
|
||
error: free region `'_#1r` does not outlive free region `'_#2r` | ||
--> $DIR/propagate-approximated-ref.rs:53:38 | ||
| | ||
53 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ||
| ^^^^^^^ | ||
|
||
note: No external requirements | ||
--> $DIR/propagate-approximated-ref.rs:57:1 | ||
--> $DIR/propagate-approximated-ref.rs:52:1 | ||
| | ||
57 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ||
58 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ||
59 | | // Only works if 'x: 'y: | ||
60 | | demand_y(x, y, x.get()) | ||
61 | | }); | ||
62 | | } | ||
52 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ||
53 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ||
54 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` | ||
55 | | | ||
... | | ||
58 | | }); | ||
59 | | } | ||
| |_^ | ||
| | ||
= note: defining type: for<'a, 'b> fn(std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(1:16), 'a(90))) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(1:17), 'b(92))) u32>) {supply} | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 27 additions & 10 deletions
37
src/test/ui/nll/closure-requirements/propagate-approximated-to-static.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,50 @@ | ||
warning: not reporting region error due to -Znll | ||
--> $DIR/propagate-approximated-to-static.rs:42:9 | ||
--> $DIR/propagate-approximated-to-static.rs:44:9 | ||
| | ||
42 | demand_y(x, y, x.get()) | ||
44 | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
note: External requirements | ||
--> $DIR/propagate-approximated-to-static.rs:40:47 | ||
| | ||
40 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | ||
| _______________________________________________^ | ||
41 | | // Only works if 'x: 'y: | ||
42 | | demand_y(x, y, x.get()) | ||
43 | | }); | ||
41 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` | ||
42 | | | ||
43 | | // Only works if 'x: 'y: | ||
44 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll | ||
45 | | }); | ||
| |_____^ | ||
| | ||
= note: defining type: [closure@$DIR/propagate-approximated-to-static.rs:40:47: 43:6<i16, for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(7714))) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7715))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0(7716))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7715))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1(9540))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2(9541))) u32>))>] | ||
= note: defining type: [closure@$DIR/propagate-approximated-to-static.rs:40:47: 45:6<i16, for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(7714))) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7715))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0(7716))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(7715))) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1(9540))) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2(9541))) u32>))>] | ||
= note: number of external vids: 2 | ||
= note: where '_#1r: '_#0r | ||
|
||
error: free region `'_#1r` does not outlive free region `ReStatic` | ||
--> $DIR/propagate-approximated-to-static.rs:40:47 | ||
| | ||
40 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | ||
| _______________________________________________^ | ||
41 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` | ||
42 | | | ||
43 | | // Only works if 'x: 'y: | ||
44 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll | ||
45 | | }); | ||
| |_____^ | ||
|
||
note: No external requirements | ||
--> $DIR/propagate-approximated-to-static.rs:39:1 | ||
| | ||
39 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ||
40 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | ||
41 | | // Only works if 'x: 'y: | ||
42 | | demand_y(x, y, x.get()) | ||
43 | | }); | ||
44 | | } | ||
41 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` | ||
42 | | | ||
... | | ||
45 | | }); | ||
46 | | } | ||
| |_^ | ||
| | ||
= note: defining type: for<'a, 'b> fn(std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(1:16), 'a(90))) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(1:17), 'b(92))) u32>) {supply} | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 21 additions & 10 deletions
31
src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,44 @@ | ||
warning: not reporting region error due to -Znll | ||
--> $DIR/propagate-approximated-val.rs:48:9 | ||
--> $DIR/propagate-approximated-val.rs:50:9 | ||
| | ||
48 | demand_y(outlives1, outlives2, x.get()) | ||
50 | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
note: External requirements | ||
--> $DIR/propagate-approximated-val.rs:46:45 | ||
| | ||
46 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | ||
| _____________________________________________^ | ||
47 | | // Only works if 'x: 'y: | ||
48 | | demand_y(outlives1, outlives2, x.get()) | ||
49 | | }); | ||
47 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` | ||
48 | | | ||
49 | | // Only works if 'x: 'y: | ||
50 | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll | ||
51 | | }); | ||
| |_____^ | ||
| | ||
= note: defining type: [closure@$DIR/propagate-approximated-val.rs:46:45: 49:6<i16, for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(9537))) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(9538))) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(9537))) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(9538))) u32>))>] | ||
= note: defining type: [closure@$DIR/propagate-approximated-val.rs:46:45: 51:6<i16, for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(9537))) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(9538))) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r(9537))) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's(9538))) u32>))>] | ||
= note: number of external vids: 3 | ||
= note: where '_#1r: '_#2r | ||
|
||
error: free region `'_#1r` does not outlive free region `'_#2r` | ||
--> $DIR/propagate-approximated-val.rs:46:37 | ||
| | ||
46 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | ||
| ^^^^^^ | ||
|
||
note: No external requirements | ||
--> $DIR/propagate-approximated-val.rs:45:1 | ||
| | ||
45 | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ||
46 | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | ||
47 | | // Only works if 'x: 'y: | ||
48 | | demand_y(outlives1, outlives2, x.get()) | ||
49 | | }); | ||
50 | | } | ||
47 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` | ||
48 | | | ||
... | | ||
51 | | }); | ||
52 | | } | ||
| |_^ | ||
| | ||
= note: defining type: for<'a, 'b> fn(std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(1:16), 'a(90))) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(1:17), 'b(92))) u32>) {test} | ||
|
||
error: aborting due to previous error | ||
|