about summary refs log tree commit diff
path: root/src/rt/rust_task.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-28 17:37:57 -0700
committerbors <bors@rust-lang.org>2013-05-28 17:37:57 -0700
commite3d0c1eb0e86e04c2a6d5abe526516351cfaef3f (patch)
treeb0971e4ba3c1a990cdb9f9ee02b3d414b2fd7729 /src/rt/rust_task.cpp
parent5676056ae6dd3a10d2c7323375ace3ca2fe1c308 (diff)
parentb7f71e1ee661ea0d5d9731fcf4779a452bbee486 (diff)
downloadrust-e3d0c1eb0e86e04c2a6d5abe526516351cfaef3f.tar.gz
rust-e3d0c1eb0e86e04c2a6d5abe526516351cfaef3f.zip
auto merge of #6731 : thomaslee/rust/issue-6575, r=pcwalton
Fix for #6575. In the trans phase, rustc emits code for a function parameter that goes completely unused in the event the return type of the function in question happens to be an immediate.

This patch modifies rustc & parts of rustrt to ensure that the vestigial parameter is no longer present in compiled code.
Diffstat (limited to 'src/rt/rust_task.cpp')
-rw-r--r--src/rt/rust_task.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index 266c0652c6e..b5ecb166175 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -162,9 +162,11 @@ void task_start_wrapper(spawn_args *a)
 
     bool threw_exception = false;
     try {
-        // The first argument is the return pointer; as the task fn
-        // must have void return type, we can safely pass 0.
-        a->f(0, a->envptr, a->argptr);
+#ifdef _RUST_STAGE0
+        a->f(NULL, a->envptr, a->argptr);
+#else
+        a->f(a->envptr, a->argptr);
+#endif
     } catch (rust_task *ex) {
         assert(ex == task && "Expected this task to be thrown for unwinding");
         threw_exception = true;
@@ -185,7 +187,11 @@ void task_start_wrapper(spawn_args *a)
     if(env) {
         // free the environment (which should be a unique closure).
         const type_desc *td = env->td;
+#ifdef _RUST_STAGE0
         td->drop_glue(NULL, NULL, NULL, box_body(env));
+#else
+        td->drop_glue(NULL, NULL, box_body(env));
+#endif
         task->kernel->region()->free(env);
     }