rust/src/test/compile-fail/not-pred-args.rs
Tim Chevalier 7fb35ecf84 Serialize constraints in types (literal arguments still not supported)
This involved, in part, changing the ast::def type so that a def_fn
has a "purity" field. This lets the typechecker determine whether
functions defined in other crates are pure.

It also required updating some error messages in tests. As a test
for cross-crate constrained functions, I added a safe_slice function
to std::str (slice(), with one of the asserts replaced with a
function precondition) and some test cases (various versions of
fn-constraint.rs) that call it. Also, I changed "fn" to "pred" for
some of the boolean functions in std::uint.
2011-06-21 14:37:33 -07:00

11 lines
209 B
Rust

// -*- rust -*-
// error-pattern: Constraint args must be
pred f(int q) -> bool { ret true; }
fn main() {
// should fail to typecheck, as pred args must be slot variables or literals
check f(42 * 17);
}