Skip to content

Instantly share code, notes, and snippets.

@eholk
eholk / issue-506.patch
Created June 16, 2011 18:49
Rust Issue 506
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index a83469e..9376f61 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -6796,6 +6796,7 @@ fn arg_tys_of_fn(&@crate_ctxt ccx, ast::ann ann) -> vec[ty
fn ret_ty_of_fn_ty(&@crate_ctxt ccx, ty::t t) -> ty::t {
alt (ty::struct(ccx.tcx, t)) {
case (ty::ty_fn(_, _, ?ret_ty, _, _)) { ret ret_ty; }
+ case (ty::ty_native_fn(_, _, ?ret_ty)) { ret ret_ty; }
case (_) {
@eholk
eholk / issue-507.rs
Created June 16, 2011 19:03
Issue 507 test case
use std;
import std::task::join;
fn grandchild(chan[int] c) {
c <| 42;
}
fn child(chan[int] c) {
auto _grandchild = spawn grandchild(c);
@eholk
eholk / rpath.patch
Created June 17, 2011 18:15
An initial look at rpath for rust in linux.
iff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs
index e0a6d28..aa2a226 100644
--- a/src/comp/driver/rustc.rs
+++ b/src/comp/driver/rustc.rs
@@ -418,6 +418,13 @@ fn main(vec[str] args) {
case (session::os_linux) {
shared_cmd = "-shared";
gcc_args = common_args + ["-march=i686", "-O2", "-m32"];
+
+ auto opts = sess.get_opts();
;; CLANG VERSION
Dump of assembler code for function _ZN7context4swapERS_:
0x00015650 <_ZN7context4swapERS_+0>: push %ebp
0x00015651 <_ZN7context4swapERS_+1>: mov %esp,%ebp
0x00015653 <_ZN7context4swapERS_+3>: sub $0x8,%esp
0x00015656 <_ZN7context4swapERS_+6>: mov 0xc(%ebp),%eax
0x00015659 <_ZN7context4swapERS_+9>: mov %eax,(%esp)
0x0001565c <_ZN7context4swapERS_+12>: call 0x156a1 <get_registers>
0x00015661 <_ZN7context3setEv+0>: add $0x8,%esp
@eholk
eholk / pfib.linux.dat
Created June 29, 2011 19:34
pfib benchmark data from linux
1 1 70238
1 1 58784
1 1 42210
1 1 38773
1 1 38649
1 1 37570
1 1 38584
1 1 37522
1 1 38234
1 1 37938
@eholk
eholk / pfib.win32.dat
Created June 29, 2011 21:11
Windows pfib benchmark data.
1 1 61595
1 1 110752
1 1 49749
1 1 41458
1 1 28428
1 1 26059
1 1 26059
1 1 24874
1 1 23691
1 1 24875
mod shared_cache {
tag response[K, V] {
not_found(K);
found(K, V);
}
tag command[K, V] {
put_item(K, V);
get_item(K, chan[response[K,V]]);
quit;
fn main() {
fn echo[T](chan[T] c, chan[chan[T]] oc) {
let port[T] p = port();
oc <| chan(p);
auto x;
p |> x;
c <| x;
}
fn start(chan[@int] c) {
c <| @42;
}
fn main() {
auto p = port();
auto child = spawn start(chan(p));
auto c; p |> c;
log_err *c;
use std;
import std::task;
fn start(chan[chan[str]] c) {
let port[str] p;
p = port();
c <| chan(p);
}