Skip to content

Commit a076c28

Browse files
committed
Fix issue-506.rs by adding a void-returning stub in the runtime (close #2957)
1 parent f188d92 commit a076c28

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/rt/rust_builtin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,8 @@ rust_dbg_call(dbg_callback cb, void *data) {
797797
return cb(data);
798798
}
799799

800+
extern "C" CDECL void rust_dbg_do_nothing() { }
801+
800802
extern "C" CDECL void
801803
rust_dbg_breakpoint() {
802804
BREAKPOINT_AWESOME;

src/rt/rustrt.def.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ rust_dbg_lock_unlock
170170
rust_dbg_lock_wait
171171
rust_dbg_lock_signal
172172
rust_dbg_call
173+
rust_dbg_do_nothing
173174
rust_dbg_breakpoint
174175
rust_osmain_sched_id
175176
rust_compare_and_swap_ptr

src/test/run-pass/issue-506.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// xfail-test
21
/*
32
A reduced test case for Issue #506, provided by Rob Arnold.
43
@@ -10,10 +9,9 @@ import task;
109

1110
#[abi = "cdecl"]
1211
extern mod rustrt {
13-
fn get_task_id() -> libc::intptr_t;
12+
fn rust_dbg_do_nothing();
1413
}
1514

1615
fn main() {
17-
let f: fn() -> libc::intptr_t = rustrt::get_task_id;
18-
task::spawn(unsafe { unsafe::reinterpret_cast(f) });
16+
task::spawn(rustrt::rust_dbg_do_nothing);
1917
}

0 commit comments

Comments
 (0)