Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

auto fres = trans_lval(bcx, f);
bcx = fres.res.bcx;
// FIXME: Evaluate arguments
auto nameval = make_task_name(bcx, name);
auto newtask = trans_upcall(bcx, "upcall_new_task",
vec(vp2i(bcx, nameval)));
bcx = newtask.bcx;
auto task_ty = node_ann_type(bcx.fcx.ccx, ann);
fn find_outer_scope_cx(@block_ctxt cx) -> @block_ctxt {
auto scope_cx = find_scope_cx(cx);
alt (cx.parent) {
case (parent_some(?b)) {
be find_scope_cx(b);
}
case (parent_none) {
fail;
}
}
auto r_ty = ty.expr_ty(e);
auto r2 = incr_all_refcnts(bcx, r.val, r_ty);
bcx = r2.bcx;
auto r_val = load_scalar_or_boxed(bcx, r.val, r_ty);
find_outer_scope_cx(cx).cleanups +=
vec(clean(bind drop_ty(_, r_val, r_ty)));
fn id[T](&T t) -> T {
ret t;
}
fn main() {
auto expected = @100;
auto actual = id[@int](expected);
log *actual;
check (*expected == *actual);
}
define internal fastcc void @_rust_fn1_id(i8*, %task*, %1*, %tydesc*, i8*) {
allocas:
br label %"function top level3"
"function top level3": ; preds = %allocas
%5 = getelementptr %tydesc* %3, i32 0, i32 0
%6 = load %tydesc*** %5
%7 = getelementptr %tydesc* %3, i32 0, i32 3
%8 = load void (i1*, %task*, i1*, %tydesc**, i8*)** %7
%9 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %8 to i32
define internal fastcc void @_rust_fn1_id(i8*, %task*, %1*, %tydesc*, i8*) {
allocas:
%5 = getelementptr %tydesc* %3, i32 0, i32 0
%6 = load %tydesc*** %5
%7 = getelementptr %tydesc* %3, i32 0, i32 3
%8 = load void (i1*, %task*, i1*, %tydesc**, i8*)** %7
%9 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %8 to i32
%10 = ptrtoint %tydesc* %3 to i32
%11 = add i32 %9, %10
%12 = inttoptr i32 %11 to void (i1*, %task*, i1*, %tydesc**, i8*)*
mod foo {
export bar;
fn bar() {
foo.baz();
}
fn baz() {
}
@brson
brson / gist:950996
Created May 1, 2011 23:47
exports with unexported deps
mod foo {
export f;
export g;
tag t {
t1;
}
fn f() -> t {
ret t1;
fn main() {
auto a = {
auto b = tup(3u16);
b
};
}
use std;
import std::task;
tag request {
quit;
close(int, chan[bool]);
}
type ctx = chan[request];