diff --git a/src/test/compile-fail/no-constraint-prop.rs b/src/test/compile-fail/no-constraint-prop.rs new file mode 100644 index 00000000000..510b7ab0491 --- /dev/null +++ b/src/test/compile-fail/no-constraint-prop.rs @@ -0,0 +1,21 @@ +// error-pattern:Unsatisfied precondition constraint (for example, le(b, d +// xfail-stage0 +use std; +import std::str::*; +import std::uint::*; + +fn main() { + let uint a = 1u; + let uint b = 4u; + let uint c = 5u; + // make sure that the constraint le(b, a) exists... + check le(b, a); + // ...invalidate it... + b += 1u; + check le(c, a); + // ...and check that it doesn't get set in the poststate of + // the next statement, since it's not true in the + // prestate. + auto d <- a; + log (safe_slice("kitties", b, d)); +} \ No newline at end of file diff --git a/src/test/run-pass/constraint-prop-expr-move.rs b/src/test/run-pass/constraint-prop-expr-move.rs new file mode 100644 index 00000000000..e7ef7f63bd5 --- /dev/null +++ b/src/test/run-pass/constraint-prop-expr-move.rs @@ -0,0 +1,13 @@ +// xfail-stage0 +use std; +import std::str::*; +import std::uint::*; + +fn main() { + let uint a = 1u; + let uint b = 4u; + let uint c = 17u; + check le(a, b); + c <- a; + log (safe_slice("kitties", c, b)); +} \ No newline at end of file diff --git a/src/test/run-pass/constraint-prop-move.rs b/src/test/run-pass/constraint-prop-move.rs new file mode 100644 index 00000000000..1c426c21fc3 --- /dev/null +++ b/src/test/run-pass/constraint-prop-move.rs @@ -0,0 +1,12 @@ +// xfail-stage0 +use std; +import std::str::*; +import std::uint::*; + +fn main() { + let uint a = 1u; + let uint b = 4u; + check le(a, b); + auto c <- a; + log (safe_slice("kitties", c, b)); +} \ No newline at end of file diff --git a/src/test/run-pass/constraint-prop-swap.rs b/src/test/run-pass/constraint-prop-swap.rs new file mode 100644 index 00000000000..c4ac4801135 --- /dev/null +++ b/src/test/run-pass/constraint-prop-swap.rs @@ -0,0 +1,12 @@ +// xfail-stage0 +use std; +import std::str::*; +import std::uint::*; + +fn main() { + let uint a = 4u; + let uint b = 1u; + check le(b, a); + b <-> a; + log (safe_slice("kitties", a, b)); +} \ No newline at end of file diff --git a/src/test/run-pass/constraint-prop.rs b/src/test/run-pass/constraint-prop.rs new file mode 100644 index 00000000000..9508daecadb --- /dev/null +++ b/src/test/run-pass/constraint-prop.rs @@ -0,0 +1,12 @@ +// xfail-stage0 +use std; +import std::str::*; +import std::uint::*; + +fn main() { + let uint a = 1u; + let uint b = 4u; + check le(a, b); + auto c = b; + log (safe_slice("kitties", a, c)); +} \ No newline at end of file