Skip to content

Instantly share code, notes, and snippets.

View Kimundi's full-sized avatar

Marvin Löbel Kimundi

  • Dortmund, Germany
View GitHub Profile
lazy_init! {
static ref map: T = new_T();
}
=>
static map: lazy1::Lazy = lazy1::Lazy;
mod lazy1 {
static mut map: *T = 0 as *T;
struct Lazy;
pub struct Property<T> {
priv val: T
}
impl<T> Property<T> {
fn new(new_val: T) -> Property<T> {
Property {
val: new_val
}
}
pub struct MutRefProperty<'a, T> {
priv val: &'a mut T
}
impl<'a, T> MutRefProperty<'a, T> {
fn new(new_val: &'a mut T) -> MutRefProperty<'a, T> {
MutRefProperty {
val: new_val
}
}
pub struct MutRefProperty<'a, T> {
priv val: &'a mut T
}
impl<'a, T> MutRefProperty<'a, T> {
fn new(new_val: &'a mut T) -> MutRefProperty<'a, T> {
MutRefProperty {
val: new_val
}
}
#[feature(macro_rules)];
macro_rules! meth_chain(
($inp:expr $(.. $call:ident($($e:expr),*))*) => (
{
let mut tmp = $inp;
$(
tmp.$call($($e),*);
)*
tmp
failures:
---- [debug-info] debug-info/limited-debuginfo.rs stdout ----
error: line not found in debugger output: static void limited-debuginfo::main();
command: gdb -quiet -batch -nx -command=x86_64-unknown-linux-gnu/test/debug-info/limited-debuginfo.debugger.script x86_64-unknown-linux-gnu/test/debug-info/limited-debuginfo.stage2-x86_64-unknown-linux-gnu
stdout:
------------------------------------------
All defined functions:
mod config {
pub enum Node<T> {
Directory(~str, ~[Node<T>]),
Entry(~str, ~T)
}
pub fn add_entry<T>(node: &Node<T>, entry: &Node<T>) -> ::std::option::Option<&Node<T>> {
match node {
Directory(name, list) => { ::std::vec::append_one(list, entry); Some(node) }
_ => { None }
@Kimundi
Kimundi / test.rs
Last active August 29, 2015 13:57
mod config {
pub enum Node<T> {
Directory(~str, ~[Node<T>]),
Entry(~str, ~T)
}
pub fn add_entry<'a, T>(node: &'a mut Node<T>, entry: Node<T>) -> Option<&'a mut Node<T>> {
if match node {
&Directory(_, ref mut list) => { list.push(entry); true }
_ => false
#![crate_type = "dylib"]
#![feature(macro_registrar, managed_boxes)]
extern crate syntax;
use syntax::ast;
use syntax::ast::Name;
use syntax::codemap::{Span};
use syntax::ext::base::{SyntaxExtension, ItemDecorator, ExtCtxt};
use syntax::ext::build::AstBuilder;
@Kimundi
Kimundi / foo.rs
Last active August 29, 2015 13:57
struct Crate(~());
impl Crate {
fn symbol<'a, H, T: Sdo<'a, H>>(&'a self, t: T) -> H {
t.wrap(::std::kinds::marker::ContravariantLifetime::<'a>)
}
}
type Zref<'a> = ::std::kinds::marker::ContravariantLifetime<'a>;