Skip to content

Instantly share code, notes, and snippets.

@carl-eastlund
Created August 23, 2013 20:27
Show Gist options
  • Select an option

  • Save carl-eastlund/6323637 to your computer and use it in GitHub Desktop.

Select an option

Save carl-eastlund/6323637 to your computer and use it in GitHub Desktop.
bus error
trait Trait {
fn method( &self );
}
struct Simple;
impl Trait for Simple {
fn method( &self ) {}
}
impl<'self,D> Trait for &'self D {
fn method( &self ) {
self.method()
}
}
struct Nested<D>{ elem: D }
impl<D:Trait> Trait for Nested<D> {
fn method( &self ) {
self.elem.method();
}
}
fn main () {
println("start");
Nested{ elem: &Simple }.method();
println("finish");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment