Skip to content

Instantly share code, notes, and snippets.

View larsbergstrom's full-sized avatar

Lars Bergstrom larsbergstrom

View GitHub Profile
@larsbergstrom
larsbergstrom / gist:6933164
Last active December 25, 2015 06:38
Test concurrency with start_on_main_thread
use std::comm;
#[start]
fn start(argc: int, argv: **u8, crate_map: *u8) -> int {
do std::rt::start_on_main_thread(argc, argv, crate_map) {
run()
}
}
fn run() {
@larsbergstrom
larsbergstrom / gist:7015095
Created October 16, 2013 21:20
Next servo crash...
```
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000000010d7fffd8
[Switching to process 53220 thread 0x79c7]
0x00000001001c1246 in vec::OwnedVector$__extensions__::reserve::h81ca6982e7da6e0cPaS::v0.9$x2dpre ()
(gdb) bt
...
#5848 0x0000000100232bcc in condition::Condition::raise::h6015a74dcc9646be1jaH::v0.9$x2dpre ()
@larsbergstrom
larsbergstrom / gist:7049425
Created October 18, 2013 22:53
GLFW shutdown error
#2 0x0000000100b713e0 in extfn::error_callback::_828c31b6dba8a9f8::v0.1 ()
#3 0x0000000100b79f87 in _glfwInputError ()
#4 0x0000000100b7d626 in glfwGetWindowUserPointer ()
#5 0x0000000100b730f9 in drop () at lib.rs:1099
#6 0x000000010003ba0d in platform..common..glfw_windowing..Window::glue_drop_16048::_9fd078dbe3b4f835 () at compositor_layer.rs:88
#7 0x00000001000f0256 in run [inlined] () at /Users/lbergstrom/servo/src/components/main/compositing/mod.rs:218
#8 0x00000001000f0256 in run [inlined] () at /Users/lbergstrom/servo/src/components/main/compositing/mod.rs:218
#9 0x00000001000f0256 in drop_local_window [inlined] () at /Users/lbergstrom/servo/src/components/main/platform/common/glfw_windowing.rs:279
#10 0x00000001000f0256 in drop_local_window () at mod.rs:279
#11 0x0000000100039884 in run () at glfw_windowing.rs:43
fn t() -> int {
4;
}
fn t() -> int {
4;
}
struct Point {x: f64, y: f64}
fn get_x_sh_good<'r>(p: &'r Point) -> &'r f64 {
&p.x
}
fn test2() {
let s = @Point{x:1.0, y:2.0};
let new_x = get_x_sh_good(s);
}
@larsbergstrom
larsbergstrom / gist:7592510
Created November 22, 2013 00:25
Ah, Windows...
lbergstrom@WIN-2AU2FAC46IO ~/rust-png
$ tup init
.tup repository initialized.
lbergstrom@WIN-2AU2FAC46IO ~/rust-png
$ tup upd
[ tup ] [0.016s] Scanning filesystem...
[ tup ] [0.031s] Reading in new environment variables...
[ tup ] [0.031s] Parsing Tupfiles...
tup error: Run scripts are not yet supported on this platform.
RUSTC = rustc
RUSTFLAGS =
: foreach *.c |> gcc -I../libpng -o %o -c %f |> %B.o
: *.o |> ar rcs %o %f |> libshim.a
: lib.rs | libshim.a |> rustc --link-args "-L ../libpng" --test -o %o %f |> rust-png-test
CHECK=@(CHECK)
export CHECK
export RUSTC
@larsbergstrom
larsbergstrom / gist:7621689
Last active December 29, 2015 05:29
new tup
lbergstrom@WIN-2AU2FAC46IO ~/rust-png2
$ tup upd
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.031s] Reading in new environment variables...
[ tup ] [0.031s] Parsing Tupfiles...
1) [0.858s] .
[ ] 100%
[ tup ] [0.905s] No files to delete.
[ tup ] [0.905s] Generating .gitignore files...
[ tup ] [0.905s] Executing Commands...
@larsbergstrom
larsbergstrom / gist:7847317
Created December 7, 2013 19:22
flow tree for about-mozilla.html
layout: constructed Flow tree
+ BlockFlow(root)
| + BlockFlow: (Box)
| | + BlockFlow: (Box)
| | | + InlineFlow: (Box), (Box), (Box), (Box), (Box), (Box), (Box), (Box), (Box), (Box), (Box), (Box), (Box)
| | + InlineFlow:
| | + BlockFlow: (Box)
| | | + InlineFlow: (Box), (Box), (Box), (Box)
()