Skip to content

Commit a566985

Browse files
nikomatsakisbrson
authored andcommitted
fix error msg
1 parent e8a29fb commit a566985

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/comp/middle/typeck.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,18 +1553,12 @@ fn require_pure_call(ccx: @crate_ctxt, caller_purity: ast::purity,
15531553
ast::impure_fn. {
15541554
let sess = ccx.tcx.sess;
15551555
alt ccx.tcx.def_map.find(callee.id) {
1556-
some(ast::def_fn(_, ast::unsafe_fn.)) {
1557-
if sess.get_opts().check_unsafe {
1558-
ccx.tcx.sess.span_fatal(
1559-
sp,
1560-
"safe function calls function marked unsafe");
1561-
}
1562-
}
1556+
some(ast::def_fn(_, ast::unsafe_fn.)) |
15631557
some(ast::def_native_fn(_, ast::unsafe_fn.)) {
15641558
if sess.get_opts().check_unsafe {
15651559
ccx.tcx.sess.span_fatal(
15661560
sp,
1567-
"native functions can only be invoked from unsafe code");
1561+
"safe function calls function marked unsafe");
15681562
}
15691563
}
15701564
_ {

src/test/compile-fail/native-unsafe-fn-called.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// -*- rust -*-
22
// error-pattern: safe function calls function marked unsafe
3-
43
native "cdecl" mod test {
54
unsafe fn free();
65
}

0 commit comments

Comments
 (0)