aa25f22f19
This giant commit changes the syntax of Rust to use "assert" for "check" expressions that didn't mean anything to the typestate system, and continue using "check" for checks that are used as part of typestate checking. Most of the changes are just replacing "check" with "assert" in test cases and rustc.
24 lines
305 B
Rust
24 lines
305 B
Rust
// -*- rust -*-
|
|
|
|
obj counter(mutable int x) {
|
|
fn hello() -> int {
|
|
ret 12345;
|
|
}
|
|
fn incr() {
|
|
x = x + 1;
|
|
}
|
|
fn get() -> int {
|
|
ret x;
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
auto y = counter(0);
|
|
assert (y.hello() == 12345);
|
|
log y.get();
|
|
y.incr();
|
|
y.incr();
|
|
log y.get();
|
|
assert (y.get() == 2);
|
|
}
|