| @@ -0,0 +1,15 @@ | ||
| // error-pattern:invalidate alias x | ||
|
|
||
| fn whoknows(@mutable int x) { | ||
| *x = 10; | ||
| } | ||
|
|
||
| fn main() { | ||
| auto box = @mutable 1; | ||
| alt (*box) { | ||
| case (?x) { | ||
| whoknows(box); | ||
| log_err x; | ||
| } | ||
| } | ||
| } |
| @@ -1,10 +1,14 @@ | ||
| // error-pattern:can not create alias | ||
| // error-pattern:may alias with argument | ||
|
|
||
| fn foo(&int x) { | ||
| fn foo(&int x, fn() f) { | ||
| log x; | ||
| } | ||
|
|
||
| fn whoknows(@mutable int x) { | ||
| *x = 10; | ||
| } | ||
|
|
||
| fn main() { | ||
| auto box = @mutable 1; | ||
| foo(*box); | ||
| foo(*box, bind whoknows(box)); | ||
| } |