use std::ops::Add;

struct Foo;
struct Bar;

#[derive(Show)]
struct FooBar;

#[derive(Show)]
struct BarFoo;

// The `Add<T, U>` trait needs two generic parameters:
// * T is the type of the RHS summand, and
// * U is the type of the sum
// This block implements the operation: Foo + Bar = FooBar
impl Add<Bar> for Foo {
    type Output = FooBar;
    
    fn add(self, _rhs: Bar) -> FooBar {
        println!("> Foo.add(&Bar) was called");

        FooBar
    }
}

// Addition can be implemented in a non-commutative way
// This block implements the operation: Bar + Foo = BarFoo
impl Add<Foo> for Bar {
    type Output = BarFoo;
    
    fn add(self, _rhs: Foo) -> BarFoo {
        println!("> Bar.add(&Foo) was called");

        BarFoo
    }
}

fn main() {
    println!("Foo + Bar = {}", Foo + Bar);
    println!("Bar + Foo = {}", Bar + Foo);
}

struct Foo;
struct Bar;

#[deriving(Show)]
struct FooBar;

#[deriving(Show)]
struct BarFoo;

// The `Add<T, U>` trait needs two generic parameters:
// * T is the type of the RHS summand, and
// * U is the type of the sum
// This block implements the operation: Foo + Bar = FooBar
impl Add<Bar, FooBar> for Foo {
    fn add(self, _rhs: Bar) -> FooBar {
        println!("> Foo.add(&Bar) was called");

        FooBar
    }
}

// Addition can be implemented in a non-commutative way
// This block implements the operation: Bar + Foo = BarFoo
impl Add<Foo, BarFoo> for Bar {
    fn add(self, _rhs: Foo) -> BarFoo {
        println!("> Bar.add(&Foo) was called");

        BarFoo
    }
}

fn main() {
    println!("Foo + Bar = {}", Foo + Bar);
    println!("Bar + Foo = {}", Bar + Foo);
}

--- 
+++ 
@@ -1,21 +1,17 @@
-use std::ops::Add;
-
 struct Foo;
 struct Bar;
 
-#[derive(Show)]
+#[deriving(Show)]
 struct FooBar;
 
-#[derive(Show)]
+#[deriving(Show)]
 struct BarFoo;
 
 // The `Add<T, U>` trait needs two generic parameters:
 // * T is the type of the RHS summand, and
 // * U is the type of the sum
 // This block implements the operation: Foo + Bar = FooBar
-impl Add<Bar> for Foo {
-    type Output = FooBar;
-    
+impl Add<Bar, FooBar> for Foo {
     fn add(self, _rhs: Bar) -> FooBar {
         println!("> Foo.add(&Bar) was called");
 
@@ -25,9 +21,7 @@
 
 // Addition can be implemented in a non-commutative way
 // This block implements the operation: Bar + Foo = BarFoo
-impl Add<Foo> for Bar {
-    type Output = BarFoo;
-    
+impl Add<Foo, BarFoo> for Bar {
     fn add(self, _rhs: Foo) -> BarFoo {
         println!("> Bar.add(&Foo) was called");
 
Fix ops example according to latest nightly