]> git.lizzy.rs Git - rust.git/commitdiff
Change typestate to use visit instead of walk
authorTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 12 Jul 2011 18:22:31 +0000 (11:22 -0700)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 12 Jul 2011 18:22:31 +0000 (11:22 -0700)
Typestate was failing to check some code because if it saw an item,
it would quit immediately. This was to avoid checking nested items
in the same context as the lexically enclosing item, but it was
having the wrong effect: not checking the code after the item at all.

Fixed by switching to visit and skipping over items in a proper
nested fashion. Closes #668.

src/test/compile-fail/uninit-after-item.rs [new file with mode: 0644]

diff --git a/src/test/compile-fail/uninit-after-item.rs b/src/test/compile-fail/uninit-after-item.rs
new file mode 100644 (file)
index 0000000..c6402e6
--- /dev/null
@@ -0,0 +1,8 @@
+// error-pattern:Unsatisfied precondition constraint (for example, init(bar
+// xfail-stage0
+fn main() {
+    auto bar;
+    fn baz(int x) { }
+    bind baz(bar);
+}
+