Skip to content

Instantly share code, notes, and snippets.

use std;
import std::task;
tag request {
quit;
close(int, chan[bool]);
}
type ctx = chan[request];
@brson
brson / gist:1167061
Created August 24, 2011 01:04
typestate in std::str::replace
fn replace(s: &istr, from: &istr, to: &istr) : is_not_empty(from) -> istr {
if byte_len(s) == 0u {
ret ~"";
} else if starts_with(s, from) {
check (is_not_empty(from));
ret to + replace(slice(s, byte_len(from), byte_len(s)), from, to);
} else {
check (is_not_empty(from));
ret unsafe_from_byte(s[0]) +
replace(slice(s, 1u, byte_len(s)), from, to);
['-f', 'make', '.\\uv.gyp', '-I', '.\\common.gypi', '--depth=.', '-Dtarget_arch=
ia32', '-Dcomponent=static_library', '-Dlibrary=static_library']
Traceback (most recent call last):
File "./gyp_uv", line 60, in <module>
run_gyp(gyp_args)
File "./gyp_uv", line 18, in run_gyp
rc = gyp.main(args)
File ".\build\gyp\pylib\gyp\__init__.py", line 463, in main
options.circular_check)
File ".\build\gyp\pylib\gyp\__init__.py", line 101, in Load
fn movearg(i: ~mutable int) {
let j <- i;
*j = 200;
}
fn movemode(-i: ~int) {
let j <- i;
}
fn main() {
Installation notes on how the windows 2008 servers were set up
==============================================================
install mingw.org's mingw-get installer
use mingw-get to get msys-vim and msys-wget
get mozilla, mercurial, python 2.7, s3cmd (if it's to be an upload-to-s3
tinderbox) and msysgit
@brson
brson / gist:1355896
Created November 10, 2011 19:31
unsafe4leak
define void @_ZN6unsafe4leak17_60978fdbd088de28E(i1*, { i32, { %tydesc*, i1, {} } }*, %tydesc*, i8*) uwtable {
static_allocas:
br label %load_env
load_env: ; preds = %static_allocas
br label %derived_tydescs
derived_tydescs: ; preds = %load_env
br label %dynamic_allocas
TlsReg = X86::GS;
BuildMI(checkMBB, DL, TII.get(X86::LEA32r), ScratchReg).addReg(X86::ESP)
.addImm(1).addReg(0).addImm(-StackSize).addReg(0);
if (ST->isTargetLinux()) {
TlsOffset = 0x30;
BuildMI(checkMBB, DL, TII.get(X86::CMP32rm)).addReg(ScratchReg)
.addReg(0).addImm(0).addReg(0).addImm(TlsOffset).addReg(TlsReg);
# We return below with a ret $8. We will return to a single
# return instruction, which will return to the caller of our
# caller. We let the unwinder skip that single return
# instruction, and just return to the real caller.
# Here CFA points just past the return address on the stack,
# e.g., on function entry it is %esp + 4. Later we will
# change it to %ebp + 8, as set by .cfi_def_cfa_register and
# .cfi_def_cfa_offset above. The stack looks like this:
# CFA + 12: stack pointer after two returns
rust: "source: elly"
Loading source: elly
Loaded package: elly/rust-hello
Loaded package: elly/crypto
Loaded package: elly/zlib
Installing with git from git://github.com/elly/rustcrypto...
Initialized empty Git repository in /home/brian/.cargo/work/I9HxmbA5zLZj4Iuw/.git/
remote: Counting objects: 25, done.
remote: Compressing objects: 100% (18/18), done.
gcc oldrust newrust oldrust% newrust%
ackermann 6.118s 9.350s 10.355s 153% 169%
binarytrees 3.112s 15.505s 67.165s 498% 2158%
fannkuchredux 5.201s 9.523s 8.303s 183% 159%
fibo 3.314s 15.235s 21.300s 460% 643%
nbody 3.300s 4.734s 9.949s 144% 302%