Before we begin, a few warnings.
- This talk contains code. It contains a lot of code, and you are encouraged to type it in and run it yourself. If you are allergic to code,
changeset: 328391:7ad374f4981c | |
tag: tip | |
user: Jason Orendorff <[email protected]> | |
date: Tue Mar 08 11:40:40 2016 -0600 | |
summary: Quick follow-up to bug 1254349: Tweak a surviving error message. | |
diff --git a/js/src/js.msg b/js/src/js.msg | |
--- a/js/src/js.msg | |
+++ b/js/src/js.msg | |
@@ -86,17 +86,17 @@ MSG_DEF(JSMSG_MISSING_FUN_ARG, 2 |
— mrrrgn pretty sure she has destructuring with shorthand defaults in the bag https://www.youtube.com/watch?v=cyWWf1Zo28g | |
4:35 PM <mrrrgn> https://irccloud.mozilla.com/pastebin/PzoPzVgu | |
4:35 PM — mrrrgn lolz | |
4:37 PM <sfink> you can't have everything | |
4:38 PM <mrrrgn> haha | |
4:41 PM → ricotz joined ([email protected]) | |
4:42 PM <mrrrgn> It's not hopeless. This patch gives us a way to stash errors and continue parsing, and if any slip past there's a nice segfault waiting ^ courtesy MOZ_ASSERT | |
4:42 PM <shu> you should stash segfaults | |
4:42 PM <shu> and continue parsing | |
4:42 PM <mrrrgn> lmao |
enum UIEvent { | |
MouseMove(i32, i32), | |
MousePress(MouseButton, i32, i32), | |
KeyPress(Key, KeyModifiers), | |
Render(Graphics) | |
} |
enum RelationshipStatus { | |
Single, | |
InARelationship, | |
Engaged, | |
Married, | |
ItsComplicated(Option<String>), | |
ItsExtremelyComplicated { | |
quantities: DifferentialEquation, | |
qualities: ImagistPoem | |
} |
use std::collections::HashMap; | |
#[derive(Debug)] | |
enum JSON { | |
Null, | |
Boolean(bool), | |
Number(f64), | |
String(String), | |
Array(Vec<JSON>), | |
Object(HashMap<String, JSON>) |
use std::marker::PhantomData; | |
use std::collections::HashSet; | |
type GraphId<'a> = PhantomData<::std::cell::Cell<&'a mut ()>>; | |
struct Graph<'a> { | |
id: GraphId<'a>, | |
vertices: usize, | |
edges: HashSet<(usize, usize)> | |
} |
#!/bin/bash | |
# rusteval: evaluate a rust expression | |
set -eu | |
cd ~/dev/rust-ignorance/playground | |
rm -rf rusteval | |
cargo new --bin rusteval --vcs none | |
cd rusteval | |
echo "fn main() { println!(\"{:?}\", $@); }" > src/main.rs |
macro_rules! arith { | |
($v1: ident, $v2: ident, $expr: expr) => ({ | |
let a = read_reg!(); | |
let b = read_reg!(); | |
let dest = read_reg!(); | |
let $v1 = regs[a]; | |
let $v2 = regs[b]; | |
regs[dest] = $expr; | |
}) | |
} |
# hg-resurrection.sh - Demonstrates a bug in hg rebase that resurrects dead changesets | |
rm -rf example-repo | |
mkdir example-repo | |
cd example-repo | |
hg init | |
echo "hello world" > hello.txt | |
hg add hello.txt | |
hg commit -m "init" # changeset 0 |