diff --git a/src/doc/reference.md b/src/doc/reference.md index 00ed5d4562b..0d65c971804 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -576,7 +576,7 @@ the final namespace qualifier is omitted. Two examples of paths with type arguments: ``` -# struct HashMap; +# struct HashMap(K,V); # fn f() { # fn id(t: T) -> T { t } type T = HashMap; // Type arguments used in a type expression @@ -1603,7 +1603,7 @@ pointer values (pointing to a type for which an implementation of the given trait is in scope) to pointers to the trait name, used as a type. ``` -# trait Shape { } +# trait Shape { fn dummy(&self) { } } # impl Shape for i32 { } # let mycircle = 0i32; let myshape: Box = Box::new(mycircle) as Box; @@ -1634,8 +1634,8 @@ let x: f64 = Num::from_i32(42); Traits may inherit from other traits. For example, in ``` -trait Shape { fn area() -> f64; } -trait Circle : Shape { fn radius() -> f64; } +trait Shape { fn area(&self) -> f64; } +trait Circle : Shape { fn radius(&self) -> f64; } ``` the syntax `Circle : Shape` means that types that implement `Circle` must also @@ -1729,7 +1729,7 @@ type parameters taken by the trait it implements. Implementation parameters are written after the `impl` keyword. ``` -# trait Seq { } +# trait Seq { fn dummy(&self, _: T) { } } impl Seq for Vec { /* ... */ }