Skip to content

Commit e804352

Browse files
committed
Move a previous run-pass test for kind-lowered unique boxes to compile-fail
This test tries to swap unique boxes containing resources, which is not allowed. Issue #409
1 parent c587745 commit e804352

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/test/run-pass/unique-swap2.rs renamed to src/test/compile-fail/unique-swap2.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// xfail-test
2-
3-
// This no longer works because ~r() is lowered to a pinned type
4-
// (which can't be swapped). Should probably be a compile-fail
5-
// test.
1+
// error-pattern: mismatched kinds
62

73
resource r(i: @mutable int) {
84
*i += 1;
@@ -14,6 +10,8 @@ fn test1() {
1410
{
1511
let x = ~r(i);
1612
let y = ~r(j);
13+
// Unique boxes containing resources are lowered to pinned kinds,
14+
// which can't be swapped
1715
x <-> y;
1816
assert ***x == 200;
1917
assert ***y == 100;

0 commit comments

Comments
 (0)