diff options
| author | Tim Chevalier <[email protected]> | 2011-04-13 15:34:10 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-04-13 15:50:34 -0700 |
| commit | 7c6e6fc5d49127e868a8323e0619c9c7597b5b18 (patch) | |
| tree | 7f6e32ed9887e057d768027c4f1f03b4eec631cd /src/lib/_vec.rs | |
| parent | Remove gc() call from end of lib-map.rs, works on stage0 otherwise (stage0 pr... (diff) | |
| download | rust-7c6e6fc5d49127e868a8323e0619c9c7597b5b18.tar.xz rust-7c6e6fc5d49127e868a8323e0619c9c7597b5b18.zip | |
Make expr_while work in typestate_check
Also did some refactoring in typestate_check. All test cases in
compile-fail that involve uninitialized vars now fail correctly!
(All eight of them, that is.)
Diffstat (limited to 'src/lib/_vec.rs')
| -rw-r--r-- | src/lib/_vec.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs index 916a8205..87a97359 100644 --- a/src/lib/_vec.rs +++ b/src/lib/_vec.rs @@ -251,6 +251,17 @@ fn or(&vec[bool] v) -> bool { be _vec.foldl[bool, bool](f, false, v); } +fn clone[T](&vec[T] v) -> vec[T] { + ret slice[T](v, 0u, len[T](v)); +} + +fn plus_option[T](&vec[T] v, &option.t[T] o) -> () { + alt (o) { + case (none[T]) {} + case (some[T](?x)) { v += vec(x); } + } +} + // Local Variables: // mode: rust; // fill-column: 78; |