Skip to content

Commit ef42c2b

Browse files
committed
Fallout: docs, elided examples often elided too much.
1 parent d801a4d commit ef42c2b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/doc/reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ the final namespace qualifier is omitted.
576576
Two examples of paths with type arguments:
577577

578578
```
579-
# struct HashMap<K, V>;
579+
# struct HashMap<K, V>(K,V);
580580
# fn f() {
581581
# fn id<T>(t: T) -> T { t }
582582
type T = HashMap<i32,String>; // Type arguments used in a type expression
@@ -1603,7 +1603,7 @@ pointer values (pointing to a type for which an implementation of the given
16031603
trait is in scope) to pointers to the trait name, used as a type.
16041604

16051605
```
1606-
# trait Shape { }
1606+
# trait Shape { fn dummy(&self) { } }
16071607
# impl Shape for i32 { }
16081608
# let mycircle = 0i32;
16091609
let myshape: Box<Shape> = Box::new(mycircle) as Box<Shape>;
@@ -1634,8 +1634,8 @@ let x: f64 = Num::from_i32(42);
16341634
Traits may inherit from other traits. For example, in
16351635

16361636
```
1637-
trait Shape { fn area() -> f64; }
1638-
trait Circle : Shape { fn radius() -> f64; }
1637+
trait Shape { fn area(&self) -> f64; }
1638+
trait Circle : Shape { fn radius(&self) -> f64; }
16391639
```
16401640

16411641
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
17291729
are written after the `impl` keyword.
17301730

17311731
```
1732-
# trait Seq<T> { }
1732+
# trait Seq<T> { fn dummy(&self, _: T) { } }
17331733
impl<T> Seq<T> for Vec<T> {
17341734
/* ... */
17351735
}

0 commit comments

Comments
 (0)