diff --git a/src/test/compile-fail/regions-fns.rs b/src/test/compile-fail/regions-fns.rs new file mode 100644 index 00000000000..0f636d27dc4 --- /dev/null +++ b/src/test/compile-fail/regions-fns.rs @@ -0,0 +1,21 @@ +// Should fail region checking, because g can only accept a pointer +// with lifetime r, and a is a pointer with unspecified lifetime. +fn not_ok_1(a: &uint) { + let mut g: fn@(x: &uint) = fn@(x: &r.uint) {}; + //!^ ERROR mismatched types + g(a); +} + +// Should fail region checking, because g can only accept a pointer +// with lifetime r, and a is a pointer with lifetime s. +fn not_ok_2(s: &s.uint) +{ + let mut g: fn@(x: &uint) = fn@(x: &r.uint) {}; + //!^ ERROR mismatched types + g(s); +} + +fn main() { +} + +