fix error msg

This commit is contained in:
Niko Matsakis 2011-10-11 18:02:51 -07:00 committed by Brian Anderson
parent e8a29fbe3c
commit a56698575c
2 changed files with 2 additions and 9 deletions

View File

@ -1553,18 +1553,12 @@ fn require_pure_call(ccx: @crate_ctxt, caller_purity: ast::purity,
ast::impure_fn. {
let sess = ccx.tcx.sess;
alt ccx.tcx.def_map.find(callee.id) {
some(ast::def_fn(_, ast::unsafe_fn.)) {
if sess.get_opts().check_unsafe {
ccx.tcx.sess.span_fatal(
sp,
"safe function calls function marked unsafe");
}
}
some(ast::def_fn(_, ast::unsafe_fn.)) |
some(ast::def_native_fn(_, ast::unsafe_fn.)) {
if sess.get_opts().check_unsafe {
ccx.tcx.sess.span_fatal(
sp,
"native functions can only be invoked from unsafe code");
"safe function calls function marked unsafe");
}
}
_ {

View File

@ -1,6 +1,5 @@
// -*- rust -*-
// error-pattern: safe function calls function marked unsafe
native "cdecl" mod test {
unsafe fn free();
}