Skip to content

Instantly share code, notes, and snippets.

View swgillespie's full-sized avatar

Sean Gillespie swgillespie

View GitHub Profile
#![feature(asm)]
fn condition(f: i32) -> bool {
match f {
1 | 2 => opaque(true),
_ => opaque(false)
}
}
#[inline(never)]
$ cargo build
Compiling libc v0.1.10
Compiling boehm_gc v0.1.0 (file:///Users/sean/Documents/workspace/rust/gc_test)
Compiling gc_test v0.1.0 (file:///Users/sean/Documents/workspace/rust/gc_test)
error: the allocator crate `boehm_gc` cannot depend on a crate that needs an allocator, but it depends on `alloc`
error: the allocator crate `boehm_gc` cannot depend on a crate that needs an allocator, but it depends on `alloc`
error: the allocator crate `boehm_gc` cannot depend on a crate that needs an allocator, but it depends on `alloc`
error: the allocator crate `boehm_gc` cannot depend on a crate that needs an allocator, but it depends on `alloc`
error: the allocator crate `boehm_gc` cannot depend on a crate that needs an allocator, but it depends on `alloc`
error: the allocator crate `boehm_gc` cannot depend on a crate that needs an allocator, but it depends on `alloc`
brainfuck: file format mach-o-x86-64
Disassembly of section .text:
0000000100000a70 <_branch_stack_new>:
stack->capacity = stack->capacity * BRANCH_STACK_SCALING_FACTOR;
stack->stack = realloc(stack->stack, sizeof(struct branch_stack_entry) * stack->capacity);
}
#include <stdio.h>
#define eM(x) *p*x;
#define eL(x) *(p+x)+=
#define eK(x) *p*x;
#define eJ(x) *(p-x)+=
#define eI(x) *p=x;
#define eH(x) }
#define eG(x) while(*p){
#define eF(x) p+=x;
#define eE(x) p-=x;
==13350== HEAP SUMMARY:
==13350== in use at exit: 38,917 bytes in 418 blocks
==13350== total heap usage: 523 allocs, 105 frees, 59,181 bytes allocated
==13350==
==13350== 4,096 bytes in 1 blocks are still reachable in loss record 80 of 80
==13350== at 0x10000950B: malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==13350== by 0x1001D1696: __smakebuf (in /usr/lib/system/libsystem_c.dylib)
==13350== by 0x1001E61E7: __swsetup (in /usr/lib/system/libsystem_c.dylib)
==13350== by 0x1002005BD: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==13350== by 0x100200AE0: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
[sean ~/Documents/workspace/rust/playground]
$ rustc -O test.rs -o test
test.rs:2:1: 4:2 warning: function cannot return without recurring, #[warn(unconditional_recursion)] on by default
test.rs:2 fn infinite_box() -> Box<i32> {
test.rs:3 infinite_box()
test.rs:4 }
test.rs:3:5: 3:19 note: recursive call site
test.rs:3 infinite_box()
^~~~~~~~~~~~~~
test.rs:2:1: 4:2 help: a `loop` may express intention better if this is on purpose
$ RUST_BACKTRACE=1 cargo build
Compiling gccjit v0.0.1 (file:///home/sean/Documents/workspace/rust/gccjit-rs/examples/factorial)
/home/sean/Documents/workspace/rust/gccjit-rs/src/rvalue.rs:76:25: 66:79 error: mismatched types:
expected `gccjit_sys::gcc_jit_binary_op`,
found `i32`
(expected enum `gccjit_sys::gcc_jit_binary_op`,
found i32) [E0308]
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
0 in __bsd_signal of ../sysdeps/posix/signal.c:37
1 in sys::stack_overflow::imp::signal_handler::h978e7f5b7278ffbcBRG
2 in <signal handler called>
3 in pp_format of ../../gcc/gcc/pretty-print.c:282
4 in diagnostic_report_diagnostic of ../../gcc/gcc/diagnostic.c:865
5 in internal_error of ../../gcc/gcc/diagnostic.c:1223
6 in fancy_abort of ../../gcc/gcc/diagnostic.c:1291
7 in gcc::jit::recording::type::as_a_function_type of ../../gcc/gcc/jit/jit-recording.h:454
8 in gcc::jit::recording::binary_op::write_reproducer of ../../gcc/gcc/jit/jit-recording.c:4295
9 in gcc::jit::recording::context::dump_reproducer_to_file of ../../gcc/gcc/jit/jit-recording.c:1621
%{
#include <stdio.h>
#include <string>
#include <vector>
#include "ast/ast.h"
}%
Compiling lisp v0.0.1 (file:///home/sean/Documents/workspace/rust/lisp)
/home/sean/Documents/workspace/rust/lisp/src/vm/vm.rs:97:22: 97:43 error: cannot borrow `self.code_object.code` as immutable because `*self` is also borrowed as mutable
/home/sean/Documents/workspace/rust/lisp/src/vm/vm.rs:97 let op = self.code_object.code[self.instruction_pointer];
^~~~~~~~~~~~~~~~~~~~~
/home/sean/Documents/workspace/rust/lisp/src/vm/vm.rs:98:19: 98:23 note: previous borrow of `*self` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `*self` until the borrow ends
/home/sean/Documents/workspace/rust/lisp/src/vm/vm.rs:98 match self.dispatch(op) {
^~~~
/home/sean/Documents/workspace/rust/lisp/src/vm/vm.rs:104:6: 104:6 note: previous borrow ends here
/home/sean/Documents/workspace/rust/lisp/src/vm/vm.rs:95 p