From 8bd8413906ab2e22a152bac8cb53f0884b63f111 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 23 Jul 2010 13:52:46 -0700 Subject: Add test for writing-through-uninit bug (reported on IRC by jrmuizel), plus fix in typestate system. --- src/test/compile-fail/writing-through-uninit-vec.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/test/compile-fail/writing-through-uninit-vec.rs (limited to 'src/test') diff --git a/src/test/compile-fail/writing-through-uninit-vec.rs b/src/test/compile-fail/writing-through-uninit-vec.rs new file mode 100644 index 00000000..55edbf87 --- /dev/null +++ b/src/test/compile-fail/writing-through-uninit-vec.rs @@ -0,0 +1,10 @@ +// error-pattern: Unsatisfied precondition constraint + +fn test() { + let vec[int] w; + w.(5) = 0; +} + +fn main() { + test(); +} \ No newline at end of file -- cgit v1.2.3