Add xfailed tests that resources can't be copied into various things
This commit is contained in:
parent
b8bb663df7
commit
8217e4bd38
16
src/test/compile-fail/copy-res-into-box.rs
Normal file
16
src/test/compile-fail/copy-res-into-box.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// xfail-test
|
||||
// error-pattern:mismatched kinds
|
||||
resource r(i: @mutable int) {
|
||||
*i = *i + 1;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i = @mutable 0;
|
||||
{
|
||||
let j <- r(i);
|
||||
// No no no no no
|
||||
let k = @j;
|
||||
}
|
||||
log_err *i;
|
||||
assert *i == 2;
|
||||
}
|
16
src/test/compile-fail/copy-res-into-rec.rs
Normal file
16
src/test/compile-fail/copy-res-into-rec.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// xfail-test
|
||||
// error-pattern:mismatched kinds
|
||||
resource r(i: @mutable int) {
|
||||
*i = *i + 1;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i = @mutable 0;
|
||||
{
|
||||
let j <- r(i);
|
||||
// No no no no no
|
||||
let k <- {x: j};
|
||||
}
|
||||
log_err *i;
|
||||
assert *i == 2;
|
||||
}
|
20
src/test/compile-fail/copy-res-into-tag.rs
Normal file
20
src/test/compile-fail/copy-res-into-tag.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// xfail-test
|
||||
// error-pattern:mismatched kinds
|
||||
resource r(i: @mutable int) {
|
||||
*i = *i + 1;
|
||||
}
|
||||
|
||||
tag t {
|
||||
t0(r);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i = @mutable 0;
|
||||
{
|
||||
let j <- r(i);
|
||||
// No no no no no
|
||||
let k <- t0(j);
|
||||
}
|
||||
log_err *i;
|
||||
assert *i == 2;
|
||||
}
|
16
src/test/compile-fail/copy-res-into-tup.rs
Normal file
16
src/test/compile-fail/copy-res-into-tup.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// xfail-test
|
||||
// error-pattern:mismatched kinds
|
||||
resource r(i: @mutable int) {
|
||||
*i = *i + 1;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i = @mutable 0;
|
||||
{
|
||||
let j <- r(i);
|
||||
// No no no no no
|
||||
let k <- (j, 0);
|
||||
}
|
||||
log_err *i;
|
||||
assert *i == 2;
|
||||
}
|
Loading…
Reference in New Issue
Block a user