Skip to content

Instantly share code, notes, and snippets.

trait Eq {
fn eq(++a: self) -> bool;
fn neq(++a: self) -> bool {
!self.eq(a)
}
}
// impl int: Eq {
impl of Eq for int {
trait Cat {
fn meow() -> bool;
fn scratch() -> bool;
fn purr() -> bool { true }
}
impl kitty of Cat for int {
fn meow() -> bool {
self.scratch()
}
trait Cat {
fn meow() -> bool;
fn scratch() -> bool;
fn purr() -> bool { true }
}
impl int : Cat {
fn meow() -> bool {
self.scratch()
}
trait Cat {
fn meow() -> bool;
fn scratch() -> bool;
fn purr() -> bool { true }
}
impl int : Cat {
fn meow() -> bool {
self.scratch()
}
class Cat a where
meow :: a -> Bool
scratch :: a -> Bool
purr :: a -> Bool
purr x = True
instance Cat Integer where
meow = scratch
scratch = purr
@lkuper
lkuper / fizzbuzz.rs
Last active December 10, 2015 10:48
October 14, 2013: Updated to work with Rust 0.8.
// FizzBuzz revisited
// This is a follow-up to the "FizzBuzz" chapter of "Rust for
// Rubyists" (http://www.rustforrubyists.com/book/chapter-06.html).
// We're going to take the code from there and refactor it to use
// pattern matching.
// Here's the original code from the book. The only change I've made
// is to comment out the original main() function so that we can write
// a few versions of our own.
lkuper@lenny:~/repos/rust/build$ x86_64-unknown-linux-gnu/stage2/bin/rustc /home/lkuper/repos/rust/src/test/run-pass/traits-default-method-self.rs -o x86_64-unknown-linux-gnu/test/run-pass/traits-default-method-self.stage2-x86_64-unknown-linux-gnu -L x86_64-unknown-linux-gnu/test/run-pass -L x86_64-unknown-linux-gnu/test/run-pass/traits-default-method-self.libaux --target=x86_64-unknown-linux-gnu
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,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
lkuper@lenny:~/repos/rust/build$ RUST_LOG=rustc=1::rt::backtrace x86_64-unknown-linux-gnu/stage2/bin/rustc /home/lkuper/repos/rust/src/test/run-pass/traits-default-method-self.rs -o x86_64-unknown-linux-gnu/test/run-pass/traits-default-method-self.stage2-x86_64-unknown-linux-gnu -L x86_64-unknown-linux-gnu/test/run-pass -L x86_64-unknown-linux-gnu/test/run-pass/traits-d
Machine (1877MB)
Socket L#0 + L2 L#0 (4096KB) + L1d L#0 (32KB) + L1i L#0 (32KB) + Core L#0 + PU L#0 (P#0)
Socket L#1 + L2 L#1 (4096KB) + L1d L#1 (32KB) + L1i L#1 (32KB) + Core L#1 + PU L#1 (P#1)
Socket L#2 + L2 L#2 (4096KB) + L1d L#2 (32KB) + L1i L#2 (32KB) + Core L#2 + PU L#2 (P#2)
Socket L#3 + L2 L#3 (4096KB) + L1d L#3 (32KB) + L1i L#3 (32KB) + Core L#3 + PU L#3 (P#3)
HostBridge L#0
PCI 8086:7010
Block L#0 "sr0"
PCI 1b36:0100
PCI 1af4:1000
-\newcommand{\etal}{\textit{et al.}}
-\newcommand{\ie}{\textit{i.e.}}
-\newcommand{\eg}{\textit{e.g.}}
+\newcommand{\etal}{\textit{et al}.}
+\newcommand{\ie}{\textit{i}.\textit{e}.}
+\newcommand{\eg}{\textit{e}.\textit{g}.}
# TestName Variant NumThreads MinTime MedianTime MaxTime Productivity1 Productivity2 Productivity3
#
# Thu Mar 28 21:07:04 EDT 2013
# Linux lenny 3.5.0-24-generic #37-Ubuntu SMP Thu Feb 7 01:50:30 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
# Ran by: lkuper
# Determined machine to have 4 hardware threads.
# The Glorious Glasgow Haskell Compilation System, version 7.4.2
#
# Running each test for 1 trial(s).
# ... with compiler options: -O2 -rtsopts