Skip to content

Instantly share code, notes, and snippets.

use core::num::Zero;
macro_rules! foo {
() => {
let a = Zero::zero();
}
}
fn main() {
foo!();
}
@huonw
huonw / foo.rs
Last active December 15, 2015 10:29
// compile with --test
use core::num::Zero;
pub struct X<T> {
a: T
}
// reordering these bounds stops the ICE
impl<T: Zero + Eq + Zero>
@huonw
huonw / rustc-out
Last active December 15, 2015 11:39
separated-static-init.rs:8:0: 11:1 error: duplicate definition of type A
separated-static-init.rs:8 impl<T: Copy> A<T> {
separated-static-init.rs:9 fn new_copyable(t: T) -> A<T> { A(copy t) }
separated-static-init.rs:10 fn do_foo_copyable(&self) {}
separated-static-init.rs:11 }
separated-static-init.rs:3:0: 6:1 note: first definition of type A here:
separated-static-init.rs:3 impl<T> A<T> {
separated-static-init.rs:4 fn new(t: T) -> A<T> { A(t) }
separated-static-init.rs:5 fn do_foo(&self) {}
separated-static-init.rs:6 }
> make
cfg: build triple x86_64-unknown-linux-gnu
cfg: host triples x86_64-unknown-linux-gnu
cfg: target triples x86_64-unknown-linux-gnu
cfg: host for x86_64-unknown-linux-gnu is x86_64
cfg: os for x86_64-unknown-linux-gnu is unknown-linux-gnu
cfg: using gcc
cfg: no node found, omitting doc/tutorial.html
cfg: no node found, omitting doc/tutorial.html
cfg: no llnextgen found, omitting grammar-verification
macro_rules! mk_bar(
() => {
#[inline(always)] // removing this works fine
pub fn bar() {}
}
)
mk_bar!()
$ x86_64-unknown-linux-gnu/stage2/bin/rustc --opt-level=3 intrinsics-bench.rs && ./intrinsics-bench
intrinsics-bench: /home/huon/rust/src/rt/rust_stack.cpp:53: void check_stack_canary(stk_seg*): Assertion `stk->canary == canary_value && "Somebody killed the canary"' failed.
Aborted
GDB says that the crash is in the call on line 60 of the llvm (_ZN3str3raw12from_buf_len17_817c74a5753274923_06E@plt)
.file "intrinsics-bench.rc"
.section .rodata.cst16,"aM",@progbits,16
.align 16
.LCPI0_0:
.long 1127219200
.long 1160773632
.long 0
.long 0
.LCPI0_1:
.quad 4841369599423283200
struct A {
x: int
}
impl core::ops::Index<int,int> for A {
fn index(&self, _i: &int) -> int {
self.x
}
}
use core::libc::funcs::c95::stdlib::{malloc, free};
fn main() {
unsafe {
let ptr : *mut int = cast::transmute(malloc(sys::size_of::<int>() as u64));
*ptr = 1;
io::println(fmt!("%i", *ptr));
rust: ~"blocked = 0 this = 2299a80"
rust: ~"blocked = 2299a80 this = 2299a80 old_task = 0"
rust: ~"no data available on 36285608, going to sleep."
rust: ~"insert fresh (~\"ctypes\"->{lint: ctypes, desc: \"proper use of core::libc types in foreign modules\", default: warn}) at idx 14, hash 6389104007889902798"
rust: ~"insert fresh (~\"unused_imports\"->{lint: unused_imports, desc: \"imports that are never used\", default: warn}) at idx 1, hash 14499218362314452417"
rust: ~"insert fresh (~\"while_true\"->{lint: while_true, desc: \"suggest using loop { } instead of while(true) { }\", default: warn}) at idx 2, hash 18145003195570133442"
rust: ~"insert fresh (~\"path_statement\"->{lint: path_statement, desc: \"path statements with no effect\", default: warn}) at idx 7, hash 11007244031844998823"
rust: ~"insert fresh (~\"unrecognized_lint\"->{lint: unrecognized_lint, desc: \"unrecognized lint attribute\", default: warn}) at idx 3, hash 15437248672470908867"
rust: ~"next_bucket(2, 32) = 3"
rust: ~"next_bucket(3, 32)