From 7c6e6fc5d49127e868a8323e0619c9c7597b5b18 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 13 Apr 2011 15:34:10 -0700 Subject: 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.) --- src/lib/_vec.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib') 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; -- cgit v1.2.3