Skip to content

Instantly share code, notes, and snippets.

View japaric's full-sized avatar
🌴
back on 28.05.

Jorge Aparicio japaric

🌴
back on 28.05.
View GitHub Profile
@japaric
japaric / Makefile
Last active August 29, 2015 14:11
codegen_units ICE
test:
rm -f liberoc.rlib
rustc eroc.rs
rustc -L . -C codegen_units=2 unicode.rs
@japaric
japaric / fn.rs
Created December 17, 2014 06:38
`Fn*` traits with associated types
#![crate_type = "lib"]
#![feature(associated_types)]
#![no_implicit_prelude]
use std::boxed::Box;
trait Fn {
type Args;
type Result;
@japaric
japaric / try1.rs
Last active August 29, 2015 14:10
reached the recursion limit during monomorphization
#![feature(unboxed_closures)]
struct Struct;
#[cfg(error)]
impl Struct {
fn search<F>(&self, f: F) -> bool where F: FnMut(()) -> bool {
self.search(|t| f(t))
}
}
@japaric
japaric / erickt.md
Created December 5, 2014 20:40
#19574

make -j8 2240.88s user 25.49s system 131% cpu 28:39.00 total

  • stage0
    • syntax
      • typeck: 6.075
      • translation: 5.796
      • LLVM passes: 59.256
    • rustc
      • typeck: 6.727
  • translation: 20.537
@japaric
japaric / how-to-reproduce.md
Last active August 29, 2015 14:10
unboxed inference bug

Context:

https://github.com/rust-lang/rust/blob/6d965cc2c99787a949d38abf225412fe502d3ed8/src/libcollections/btree/set.rs#L454-487

(That's an unit test)

As part of the "unboxing closures" PR, I need to unbox the nested closure in the check function, which I have done in this commit. However, when I ran make check-stage1-collections I got a compiler error about the compiler not being able to infer the type of the closure in the check_intersection function. The weird part is that, upon isolating the unit test (which I did to understand/fix the compiler error), I found out that the code actually compiles!


@japaric
japaric / after0.md
Last active August 29, 2015 14:10
Time #19362 (Everything in seconds)

make -j8 2074.12s user 23.50s system 131% cpu 26:34.38 total

  • stage0
    • syntax
      • typeck: 5.627
      • translation: 5.644
      • LLVM passes: 56.761
    • rustc
      • typeck: 6.207
  • translation: 19.704
@japaric
japaric / collections.rs
Last active August 29, 2015 14:10
LLVM assertion
#![feature(lang_items)]
#![crate_type = "rlib"]
#![no_std]
// This core crate has an `Option` that uses unboxed closures (see #19467)
extern crate core;
use core::prelude::{Iterator, IteratorExt, Option, None};
use core::slice::SlicePrelude;
@japaric
japaric / infe.rs
Created November 24, 2014 22:29
default_type_params inference failure
#![feature(default_type_params)]
enum Enum<L = (), R = ()> {
Both(L, R),
Left(L),
Right(R),
}
fn main() {
// I'm expecting the compiler to choose the type `Enum<u8, ()>` here
@japaric
japaric / main.rs
Created November 24, 2014 16:03
BufWriter
#![feature(slicing_syntax)]
extern crate criterion;
use criterion::Criterion;
use std::cmp::min;
use std::io::{IoError, IoResult};
use std::raw::Repr;
use std::{io, mem, ptr, raw, slice};
@japaric
japaric / main.rs
Created November 24, 2014 14:35
inline(always) BufWriters
#![feature(slicing_syntax)]
extern crate criterion;
use criterion::Criterion;
use std::cmp::min;
use std::io::{IoError, IoResult};
use std::raw::Repr;
use std::{io, mem, ptr, raw, slice};