From e8a29fbe3cc662898dd9d7a25f9f6708e31fe6b8 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 11 Oct 2011 18:01:54 -0700 Subject: [PATCH] add some new tests --- src/test/compile-fail/native-unsafe-fn-called.rs | 11 +++++++++++ src/test/compile-fail/native-unsafe-fn.rs | 12 ++++++++++++ src/test/compile-fail/unsafe-fn-called-from-safe.rs | 1 - 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/native-unsafe-fn-called.rs create mode 100644 src/test/compile-fail/native-unsafe-fn.rs diff --git a/src/test/compile-fail/native-unsafe-fn-called.rs b/src/test/compile-fail/native-unsafe-fn-called.rs new file mode 100644 index 000000000000..3104884130b1 --- /dev/null +++ b/src/test/compile-fail/native-unsafe-fn-called.rs @@ -0,0 +1,11 @@ +// -*- rust -*- +// error-pattern: safe function calls function marked unsafe + +native "cdecl" mod test { + unsafe fn free(); +} + +fn main() { + test::free(); +} + diff --git a/src/test/compile-fail/native-unsafe-fn.rs b/src/test/compile-fail/native-unsafe-fn.rs new file mode 100644 index 000000000000..2a2ce4b3246e --- /dev/null +++ b/src/test/compile-fail/native-unsafe-fn.rs @@ -0,0 +1,12 @@ +// -*- rust -*- +// error-pattern: unsafe functions can only be called + +native "cdecl" mod test { + unsafe fn free(); +} + +fn main() { + let x = test::free; +} + + diff --git a/src/test/compile-fail/unsafe-fn-called-from-safe.rs b/src/test/compile-fail/unsafe-fn-called-from-safe.rs index b294ad16344f..62fcfa689d97 100644 --- a/src/test/compile-fail/unsafe-fn-called-from-safe.rs +++ b/src/test/compile-fail/unsafe-fn-called-from-safe.rs @@ -1,6 +1,5 @@ // -*- rust -*- // error-pattern: safe function calls function marked unsafe -// xfail-test unsafe fn f() { ret; }