Skip to content

Instantly share code, notes, and snippets.

@MarkJr94
MarkJr94 / ice.txt
Created February 1, 2014 23:18
ICE in my project
jsonutil.rs:85:9: 85:28 error: internal compiler error: Cannot relate bound region: ReLateBound(413, BrNamed(syntax::ast::DefId{crate: 0u32, node: 398u32}, a)) <= ReInfer(0)
This message reflects a bug in the Rust compiler.
We would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
jsonutil.rs:85 FromJson::from_json(self)
^~~~~~~~~~~~~~~~~~~
@MarkJr94
MarkJr94 / module-app-build.gradle
Created April 5, 2014 23:20
Android studio probs
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Types where
@MarkJr94
MarkJr94 / errors.txt
Created December 29, 2014 16:51
problems with using static vars to initialize arrays
test.rs:4:22: 4:25 error: expected constant integer for repeat count, found variable
test.rs:4 let arr = [0i, ..FOO];
^~~
error: aborting due to previous error
#![feature(macro_rules)]
use std::ops::{Deref, DerefMut};
macro_rules! extend {
(struct $name:ident extends $parent:ident {
$($field:ident: $typ_:ty),+
}) => (
struct $name {
__super: $parent,
convert favicon.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -alpha off -colors 256 favicon.ico
@MarkJr94
MarkJr94 / chain1.rs
Created May 31, 2013 18:54
Simple Chain outline
fn add_one(n: int) ⟶  int {
n + 1
}
fn times_two(n: int) ⟶  int {
n * 2
}
fn chain<A,B,C>(f1: ~fn(a: A) ⟶  B,f2: ~fn(b: B) ⟶  C) ⟶  ~fn(A) ⟶  C {
|x: A| {
@MarkJr94
MarkJr94 / chain2.rs
Created May 31, 2013 19:15
Simple chain outline
use core::from_str::*;
fn stringify<T: ToStr>(x: T) ⟶  ~str {
x.to_str()
}
fn unstringify<T: FromStr> (s: ~str) ⟶  Option<T> {
FromStr::from_str(s)
}
@MarkJr94
MarkJr94 / chain3_no_unicode.rs
Created May 31, 2013 19:23
Simple Chain outline
use core::from_str::*;
fn stringify<T: ToStr>(x: T) -> ~str {
x.to_str()
}
fn unstringify<T: FromStr> (s: ~str) -> Option<T> {
FromStr::from_str(s)
}
fn empty_vec<T>() -> ~[T] {
let v: ~[T] = ~[];
v
}
fn main() {
let mut v_int = empty_vec<int>();
let mut v_float = empty_vec<float>();
}