-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66d9efb
commit 17937e7
Showing
82 changed files
with
1,050 additions
and
38 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/assign_resource.exp
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
Diagnostics: | ||
error: local `t` of type `M::T` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-borrow-tests/assign_resource.move:5:22 | ||
│ | ||
5 │ let t = T{}; &t; | ||
│ ^^ implicitly dropped here since it is no longer used | ||
|
||
error: local `t` of type `M::T` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-borrow-tests/assign_resource.move:6:19 | ||
│ | ||
6 │ t = T {}; &t; | ||
│ ^^ implicitly dropped here since it is no longer used |
11 changes: 11 additions & 0 deletions
11
third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/assign_resource.move
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module 0x8675309::M { | ||
struct T {} | ||
|
||
fun no() { | ||
let t = T{}; &t; | ||
t = T {}; &t; | ||
} | ||
|
||
} | ||
|
||
// check: STLOC_UNSAFE_TO_DESTROY_ERROR |
17 changes: 17 additions & 0 deletions
17
...piler-v2/tests/ability-check/v1-borrow-tests/return_type_mismatch_and_unused_resource.exp
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
Diagnostics: | ||
error: cannot return a reference derived from value since it is not a parameter | ||
┌─ tests/ability-check/v1-borrow-tests/return_type_mismatch_and_unused_resource.move:13:9 | ||
│ | ||
12 │ let r = &u; | ||
│ -- previous local borrow | ||
13 │ r | ||
│ ^ returned here | ||
|
||
|
||
Diagnostics: | ||
error: local `x` of type `M::X` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-borrow-tests/return_type_mismatch_and_unused_resource.move:6:9 | ||
│ | ||
6 │ &x; | ||
│ ^^ implicitly dropped here since it is no longer used |
18 changes: 18 additions & 0 deletions
18
...iler-v2/tests/ability-check/v1-borrow-tests/return_type_mismatch_and_unused_resource.move
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module 0x8675309::M { | ||
struct X {} | ||
|
||
fun t1(): bool { | ||
let x = X {}; | ||
&x; | ||
false | ||
} | ||
|
||
fun t2(): &u64 { | ||
let u = 0; | ||
let r = &u; | ||
r | ||
} | ||
} | ||
|
||
// check: RET_UNSAFE_TO_DESTROY_ERROR | ||
// check: RET_UNSAFE_TO_DESTROY_ERROR |
13 changes: 13 additions & 0 deletions
13
third_party/move/move-compiler-v2/tests/ability-check/v1-locals/drop_conditional.exp
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
Diagnostics: | ||
error: local `x` of type `M::Cup<M::R>` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-locals/drop_conditional.move:12:9 | ||
│ | ||
12 │ &x; | ||
│ ^^ implicitly dropped here since it is no longer used | ||
|
||
error: local `x` of type `M::Pair<M::S, M::R>` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-locals/drop_conditional.move:14:9 | ||
│ | ||
14 │ &x; | ||
│ ^^ implicitly dropped here since it is no longer used |
17 changes: 17 additions & 0 deletions
17
third_party/move/move-compiler-v2/tests/ability-check/v1-locals/drop_conditional.move
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
address 0x42 { | ||
module M { | ||
|
||
struct Cup<T> has drop { f: T } | ||
struct Pair<T1, T2> has drop { f1: T1, f2: T2 } | ||
struct R {} | ||
struct S has drop {} | ||
|
||
// Error on a type that can have the drop ability, but the instantiation does not | ||
fun t() { | ||
let x = Cup<R> { f: R{} }; | ||
&x; | ||
let x = Pair<S, R> { f1: S{}, f2: R{} }; | ||
&x; | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
third_party/move/move-compiler-v2/tests/ability-check/v1-locals/reassign_parameter.exp
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
Diagnostics: | ||
error: local `r` of type `M::R` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-locals/reassign_parameter.move:7:9 | ||
│ | ||
7 │ ╭ if (true) { | ||
8 │ │ let R { } = r; | ||
9 │ │ } | ||
│ ╰─────────^ implicitly dropped here since it is no longer used |
12 changes: 12 additions & 0 deletions
12
third_party/move/move-compiler-v2/tests/ability-check/v1-locals/reassign_parameter.move
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module 0x8675309::M { | ||
struct R {} | ||
|
||
public fun reassign_parameter(r: R) { | ||
let R { } = r; | ||
r = R {}; | ||
if (true) { | ||
let R { } = r; | ||
} | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
third_party/move/move-compiler-v2/tests/ability-check/v1-typing/bind_pop_resource.exp
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
Diagnostics: | ||
error: value of type `M::R` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-typing/bind_pop_resource.move:5:13 | ||
│ | ||
5 │ let _: R = R{}; | ||
│ ^ implicitly dropped here since it is no longer used | ||
|
||
error: local `_r` of type `M::R` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-typing/bind_pop_resource.move:8:21 | ||
│ | ||
8 │ let _r: R = R{}; | ||
│ ^^^ implicitly dropped here since it is no longer used | ||
|
||
error: value of type `M::R` does not have the `drop` ability | ||
┌─ tests/ability-check/v1-typing/bind_pop_resource.move:9:13 | ||
│ | ||
9 │ let (_, _):(R, R) = (R{}, R{}); | ||
│ ^^^^^^ implicitly dropped here since it is no longer used |
11 changes: 11 additions & 0 deletions
11
third_party/move/move-compiler-v2/tests/ability-check/v1-typing/bind_pop_resource.move
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module 0x8675309::M { | ||
struct R {} | ||
|
||
fun t0() { | ||
let _: R = R{}; | ||
// the following is an invalid binding too but its error message will | ||
// not show because the compilation fails early at the typing phase | ||
let _r: R = R{}; | ||
let (_, _):(R, R) = (R{}, R{}); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...move/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_1.exp
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
============ bytecode verification succeeded ======== |
14 changes: 14 additions & 0 deletions
14
...ove/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_1.move
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module 0x8675309::A { | ||
use std::signer; | ||
struct T1 has key {v: u64} | ||
|
||
public fun test(account: &signer) acquires T1 { | ||
borrow_global_mut<T1>(signer::address_of(account)); | ||
acquires_t1(account); | ||
} | ||
|
||
fun acquires_t1(account: &signer) acquires T1 { | ||
T1 { v: _ } = move_from<T1>(signer::address_of(account)); | ||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
...move/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_2.exp
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
============ bytecode verification succeeded ======== |
33 changes: 33 additions & 0 deletions
33
...ove/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_2.move
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module 0x8675309::A { | ||
use std::signer; | ||
struct T1 has key {v: u64} | ||
struct T2 has key {v: u64} | ||
|
||
public fun test1(account: &signer) acquires T1, T2 { | ||
let x = borrow_global_mut<T1>(signer::address_of(account)); | ||
acquires_t2(account); | ||
move x; | ||
acquires_t1(account); | ||
} | ||
|
||
public fun test2(account: &signer) acquires T1, T2 { | ||
borrow_global_mut<T1>(signer::address_of(account)); | ||
acquires_t1(account); | ||
acquires_t2(account); | ||
} | ||
|
||
public fun test3(account: &signer) acquires T1, T2 { | ||
borrow_global_mut<T1>(signer::address_of(account)); | ||
acquires_t2(account); | ||
acquires_t1(account); | ||
} | ||
|
||
fun acquires_t1(account: &signer) acquires T1 { | ||
T1 { v: _ } = move_from<T1>(signer::address_of(account)) | ||
} | ||
|
||
fun acquires_t2(account: &signer) acquires T2 { | ||
T2 { v: _ } = move_from<T2>(signer::address_of(account)) | ||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
...move/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_3.exp
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
============ bytecode verification succeeded ======== |
42 changes: 42 additions & 0 deletions
42
...ove/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_3.move
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module 0x8675309::A { | ||
use std::signer; | ||
struct T1 has key {v: u64} | ||
struct T2 has key {v: u64} | ||
|
||
public fun test1(account: &signer) acquires T1, T2 { | ||
let x = borrow_global_mut<T1>(signer::address_of(account)); | ||
let y = get_v(x); | ||
acquires_t2(account); | ||
move y; | ||
acquires_t1(account); | ||
} | ||
|
||
public fun test2(account: &signer) acquires T1, T2 { | ||
let x = borrow_global_mut<T1>(signer::address_of(account)); | ||
let y = get_v(x); | ||
move y; | ||
acquires_t1(account); | ||
acquires_t2(account); | ||
} | ||
|
||
public fun test3(account: &signer) acquires T1, T2 { | ||
let x = borrow_global_mut<T1>(signer::address_of(account)); | ||
let y = get_v(x); | ||
move y; | ||
acquires_t2(account); | ||
acquires_t1(account); | ||
} | ||
|
||
fun get_v(x: &mut T1): &mut u64 { | ||
&mut x.v | ||
} | ||
|
||
fun acquires_t1(account: &signer) acquires T1 { | ||
T1 { v: _ } = move_from<T1>(signer::address_of(account)) | ||
} | ||
|
||
fun acquires_t2(account: &signer) acquires T2 { | ||
T2 { v: _ } = move_from<T2>(signer::address_of(account)) | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_extraneous_annotation.exp
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
Diagnostics: | ||
error: unnecessary acquires annotation | ||
┌─ tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_extraneous_annotation.move:4:32 | ||
│ | ||
4 │ public fun test() acquires T1 { | ||
│ ^^^ |
9 changes: 9 additions & 0 deletions
9
.../tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_extraneous_annotation.move
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module 0x8675309::A { | ||
struct T1 has key {v: u64} | ||
|
||
public fun test() acquires T1 { | ||
} | ||
|
||
} | ||
|
||
// check: EXTRANEOUS_ACQUIRES_RESOURCE_ANNOTATION_ERROR |
7 changes: 7 additions & 0 deletions
7
...r-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_invalid_annotation.exp
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
Diagnostics: | ||
error: unnecessary acquires annotation | ||
┌─ tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_invalid_annotation.move:4:32 | ||
│ | ||
4 │ public fun test() acquires T1 { | ||
│ ^^^ |
10 changes: 10 additions & 0 deletions
10
...-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_invalid_annotation.move
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module 0x8675309::A { | ||
struct T1 has key {v: u64} | ||
|
||
public fun test() acquires T1 { | ||
test() | ||
} | ||
|
||
} | ||
|
||
// check: INVALID_ACQUIRES_RESOURCE_ANNOTATION_ERROR |
9 changes: 9 additions & 0 deletions
9
...r-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_missing_annotation.exp
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
Diagnostics: | ||
error: missing acquires annotation for `T1` | ||
┌─ tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_missing_annotation.move:5:16 | ||
│ | ||
5 │ public fun test(account: &signer) { | ||
│ ^^^^ | ||
6 │ borrow_global_mut<T1>(signer::address_of(account)); | ||
│ -------------------------------------------------- acquired here |
11 changes: 11 additions & 0 deletions
11
...-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_missing_annotation.move
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module 0x8675309::A { | ||
use std::signer; | ||
struct T1 has key {v: u64} | ||
|
||
public fun test(account: &signer) { | ||
borrow_global_mut<T1>(signer::address_of(account)); | ||
} | ||
|
||
} | ||
|
||
// check: MISSING_ACQUIRES_RESOURCE_ANNOTATION_ERROR |
2 changes: 2 additions & 0 deletions
2
...r-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_return_reference_1.exp
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
============ bytecode verification succeeded ======== |
21 changes: 21 additions & 0 deletions
21
...-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_return_reference_1.move
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module 0x8675309::A { | ||
use std::signer; | ||
struct T1 has key {v: u64} | ||
|
||
public fun test1(account: &signer, x: &mut T1) acquires T1 { | ||
// the acquire of t1 does not pollute y | ||
let y = borrow_acquires_t1(account, x); | ||
acquires_t1(account); | ||
move y; | ||
} | ||
|
||
fun borrow_acquires_t1(account: &signer, x: &mut T1): &mut u64 acquires T1 { | ||
borrow_global_mut<T1>(signer::address_of(account)); | ||
&mut x.v | ||
} | ||
|
||
fun acquires_t1(account: &signer) acquires T1 { | ||
T1 { v:_ } = move_from<T1>(signer::address_of(account)) | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
...ts/acquires-checker/v1-borrow-tests/borrow_global_acquires_return_reference_invalid_1.exp
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
Diagnostics: | ||
error: cannot return a reference derived from global `A::T1` | ||
┌─ tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_return_reference_invalid_1.move:10:9 | ||
│ | ||
10 │ borrow_global_mut<T1>(signer::address_of(account)) | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
│ │ | ||
│ returned here | ||
│ previous mutable global borrow |
14 changes: 14 additions & 0 deletions
14
...s/acquires-checker/v1-borrow-tests/borrow_global_acquires_return_reference_invalid_1.move
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module 0x8675309::A { | ||
use std::signer; | ||
struct T1 has key {v: u64} | ||
|
||
public fun test1(account: &signer) acquires T1 { | ||
borrow_acquires_t1(account); | ||
} | ||
|
||
fun borrow_acquires_t1(account: &signer): &mut T1 acquires T1 { | ||
borrow_global_mut<T1>(signer::address_of(account)) | ||
} | ||
} | ||
|
||
// check: RET_UNSAFE_TO_DESTROY_ERROR |
2 changes: 2 additions & 0 deletions
2
third_party/move/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/factor_valid_1.exp
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
============ bytecode verification succeeded ======== |
18 changes: 18 additions & 0 deletions
18
third_party/move/move-compiler-v2/tests/acquires-checker/v1-borrow-tests/factor_valid_1.move
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module 0x8675309::M { | ||
struct X has copy, drop { f: Y } | ||
struct Y has copy, drop { g: u64, h: u64 } | ||
|
||
fun t1() { | ||
let x = X { f: Y { g: 0, h: 0 } }; | ||
let g = &mut x.f.g; | ||
let h = &mut x.f.h; | ||
|
||
*g = *h; | ||
*h = *g; | ||
|
||
foo(g, h); | ||
} | ||
|
||
fun foo(_a: &mut u64, _b: &mut u64) { | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...compiler-v2/tests/acquires-checker/v1-borrow-tests/imm_borrow_global_requires_acquire.exp
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
Diagnostics: | ||
error: missing acquires annotation for `T1` | ||
┌─ tests/acquires-checker/v1-borrow-tests/imm_borrow_global_requires_acquire.move:4:16 | ||
│ | ||
4 │ public fun test(addr: address) { | ||
│ ^^^^ | ||
5 │ borrow_global<T1>(addr); | ||
│ ----------------------- acquired here |
Oops, something went wrong.