mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Add a test that two mutable borrows is not ok
This commit is contained in:
parent
eebe8b21a2
commit
ebc97438e7
@ -124,6 +124,12 @@ fn exceptions() {
|
||||
pub fn new() -> A {
|
||||
A {}
|
||||
}
|
||||
|
||||
pub fn foo(&self, _: &A) {
|
||||
}
|
||||
|
||||
pub fn bar(&mut self, _: &mut A) {
|
||||
}
|
||||
}
|
||||
}
|
||||
"#)
|
||||
@ -136,6 +142,14 @@ fn exceptions() {
|
||||
a.free();
|
||||
// TODO: figure out a better error message?
|
||||
assert.throws(() => a.free(), /RuntimeError: unreachable/);
|
||||
|
||||
let b = wasm.A.new();
|
||||
try {
|
||||
b.foo(b);
|
||||
assert.throws(() => b.bar(b), /RuntimeError: unreachable/);
|
||||
} finally {
|
||||
b.free();
|
||||
}
|
||||
}
|
||||
"#)
|
||||
.test();
|
||||
|
Loading…
x
Reference in New Issue
Block a user