Skip to content

Instantly share code, notes, and snippets.


Alex Burka durka

View GitHub Profile
insaneinside / draft.markdown
Created Sep 13, 2017
Whole-Crate Test-Case Reduction with C-Reduce
View draft.markdown

Whole-Crate Test-Case Reduction with C-Reduce

Sometimes, when working on a complex piece of software — or even a simple program or library with a non-trivial number of moving parts — you run into an issue and have absolutely no idea how to reduce your code to the minimum necessary in order to reproduce the error.

For the past several months I've been blocked by some trait-resolution errors in Symtern, my general-purpose interner crate. I knew the errors were somehow related to

View Rust Thread

Justification of Send and Sync rules

T: Sync ⟺ &T: Send


Consider a value a: T. Assume T: Sync. Then, to access a on multiple threads, it must be possible to send a reference to another thread, thus &T: Send. Therefore, T: Sync ⟹ &T: Send. Assume &T: Send. Sending &a: &T to another thread means a can be accessed concurrently, thus T: Sync is required. Therefore, &T: Send ⟹ T: Sync.


//! ```cargo
//! [dependencies]
//! custom_derive = "*"
//! ```
#[macro_use] extern crate custom_derive;
macro_rules! DiscriminantEnum {
// public entry points
durka /
Created Jul 22, 2015 — forked from anonymous/
Simple TT muncher
// switch to nightly and uncomment these for debugging
/// Trick the macro parser into outputting an item without checking its syntax
macro_rules! as_item( ($i:item) => ($i) );
macro_rules! foo(
// first rule: define the invocation syntax and call myself again with some
// easily parseable parameters (notice everything is bracketed)
14427 /
Last active Aug 19, 2021
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
# assign env var, if set
find -L "${HB}/opt" -name 'INSTALL_RECEIPT.json' -maxdepth 2 -print > /tmp/homebrew-installed.txt
printf '' > /tmp/homebrew-installed-w-options.txt
killercup / pandoc.css
Created Jul 3, 2013
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
View pandoc.css
* I add this to html files generated with pandoc.
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;