@@ -576,7 +576,7 @@ the final namespace qualifier is omitted.
576
576
Two examples of paths with type arguments:
577
577
578
578
```
579
- # struct HashMap<K, V>;
579
+ # struct HashMap<K, V>(K,V) ;
580
580
# fn f() {
581
581
# fn id<T>(t: T) -> T { t }
582
582
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
1603
1603
trait is in scope) to pointers to the trait name, used as a type.
1604
1604
1605
1605
```
1606
- # trait Shape { }
1606
+ # trait Shape { fn dummy(&self) { } }
1607
1607
# impl Shape for i32 { }
1608
1608
# let mycircle = 0i32;
1609
1609
let myshape: Box<Shape> = Box::new(mycircle) as Box<Shape>;
@@ -1634,8 +1634,8 @@ let x: f64 = Num::from_i32(42);
1634
1634
Traits may inherit from other traits. For example, in
1635
1635
1636
1636
```
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; }
1639
1639
```
1640
1640
1641
1641
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
1729
1729
are written after the ` impl ` keyword.
1730
1730
1731
1731
```
1732
- # trait Seq<T> { }
1732
+ # trait Seq<T> { fn dummy(&self, _: T) { } }
1733
1733
impl<T> Seq<T> for Vec<T> {
1734
1734
/* ... */
1735
1735
}
0 commit comments