Skip to content

Instantly share code, notes, and snippets.

@spott
spott / compiler errors
Last active December 24, 2015 20:19
Small example:
task <unnamed> failed at 'assertion failed: rp.is_none()', /private/tmp/rust-h4RT/rust-0.8/src/librustc/middle/typeck/collect.rs:1108
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
task <unnamed> failed at 'explicit failure', /private/tmp/rust-h4RT/rust-0.8/src/librustc/rustc.rs:391
@spott
spott / compiler errors
Created October 6, 2013 19:38
Rust error message
playground.rs:6:19: 6:28 error: mismatched types: expected `~[(T,&str)]` but found `~[(T,&str)]` (lifetime mismatch)
playground.rs:6 return |s| ~[(p, s)]
^~~~~~~~~
playground.rs:6:19: 6:28 note: the lifetime & as defined on the block at 6:19...
playground.rs:6 return |s| ~[(p, s)]
^~~~~~~~~
playground.rs:6:19: 6:28 note: ...does not necessarily outlive the lifetime & as defined on the block at 6:19
playground.rs:6 return |s| ~[(p, s)]
^~~~~~~~~
playground.rs:6:8: 6:28 error: cannot infer an appropriate lifetime due to conflicting requirements
@spott
spott / errors:
Last active December 28, 2015 13:29
compile time value addition. Won't compile, but I'm not sure why.
d_playground.d(38): Error: pure nested function 'a' cannot access mutable data 'this'
d_playground.d(38): Error: pure nested function 'a' cannot access mutable data 'this'
d_playground.d(14): Error: template instance d_playground.value.opBinary!("+", value).opBinary.intermediateValue!(plus, this, rhs) error instantiating
d_playground.d(47): instantiated from here: opBinary!("+", value)
d_playground.d(47): Error: template instance d_playground.value.opBinary!("+", value) error instantiating
@spott
spott / ParkingLot.cpp
Last active January 3, 2016 07:29 — forked from lshort/Parking Lot
using namespace std;
using boost::optional;
// Implements a parking lot utility: you can ask it for an available space for
// a car of a certain size, ask it to find a car's parking spot given its license
// plate, ask what car is parked in a specific spot, etc.
// This code is organized top down: first the parking_lot class, then
// the distance class ('dist') and some functions to compare IEEE doubles, then
// the structs 'car' and 'parking_space'. I made some assumptions, like that each
@spott
spott / homebrew --config
Created March 15, 2014 16:43
homebrew config info
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 380fc27e27ec685f2fefebcfab999ace1d8b7dfb
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.9.2-x86_64
Xcode: 5.1
CLT: 5.1.0.0.1.1393561416
Clang: 5.1 build 503
@spott
spott / build.sh all
Last active August 29, 2015 14:01
IHaskell Install
a ipython_config.py
a ipython_console_config.py
a ipython_notebook_config.py
a ipython_qtconsole_config.py
a static
a static/base
a static/custom
a static/custom/conceal
a static/custom/custom.css
a static/custom/custom.js
module pc.parser;
import std.stdio;
import std.array;
import std.ctype;
import std.string;
import std.conv;
import std.regex;
import std.variant;
import std.functional;
@spott
spott / gist:7b82e852322dd910f720
Created May 17, 2014 05:25
classy prelude fail
ClassyPrelude.hs:234:9:
Could not deduce (a ~ ())
from the context (Monad m, MonoFoldable c)
bound by the type signature for
mapM_ :: (Monad m, MonoFoldable c) =>
(Element c -> m a) -> c -> m ()
at ClassyPrelude.hs:233:10-69
`a' is a rigid type variable bound by
the type signature for
mapM_ :: (Monad m, MonoFoldable c) =>
@spott
spott / pre-commit
Created February 19, 2015 23:09
Pre=commit hook for clang-format. from: DUNE-Multiscale/hooks/pre-commit-clang-format
#!/bin/bash
# git pre-commit hook that runs an clang-format stylecheck.
# Features:
# - abort commit when commit does not comply with the style guidelines
# - create a patch of the proposed style changes
# modifications for clang-format by [email protected]
# This file is part of a set of unofficial pre-commit hooks available
# at github.
@spott
spott / git-clang-format
Created February 19, 2015 23:10
clang-format git integration.
#!/usr/bin/env python
#
#===- git-clang-format - ClangFormat Git Integration ---------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#