Skip to content

Commit e8a29fb

Browse files
nikomatsakisbrson
authored andcommitted
add some new tests
1 parent 7016473 commit e8a29fb

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// -*- rust -*-
2+
// error-pattern: safe function calls function marked unsafe
3+
4+
native "cdecl" mod test {
5+
unsafe fn free();
6+
}
7+
8+
fn main() {
9+
test::free();
10+
}
11+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// -*- rust -*-
2+
// error-pattern: unsafe functions can only be called
3+
4+
native "cdecl" mod test {
5+
unsafe fn free();
6+
}
7+
8+
fn main() {
9+
let x = test::free;
10+
}
11+
12+

src/test/compile-fail/unsafe-fn-called-from-safe.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-
// xfail-test
43

54
unsafe fn f() { ret; }
65

0 commit comments

Comments
 (0)