@@ -2522,7 +2522,7 @@ fn sendable_foo(f: Box<Foo + Send>) { /* ... */ }
25222522fn shareable_bar <T : Share >(b : & Bar <T > + Share ) { /* ... */ }
25232523~~~
25242524
2525- When no colon is specified (such as the type ` ~ Foo` ), it is inferred that the
2525+ When no colon is specified (such as the type ` Box< Foo> ` ), it is inferred that the
25262526value ascribes to no bounds. They must be added manually if any bounds are
25272527necessary for usage.
25282528
@@ -2579,17 +2579,18 @@ fn radius_times_area<T: Circle>(c: T) -> f64 {
25792579
25802580Likewise, supertrait methods may also be called on trait objects.
25812581
2582- ~~~ {.ignore}
2582+ ~~~
25832583use std::f64::consts::PI;
25842584# trait Shape { fn area(&self) -> f64; }
25852585# trait Circle : Shape { fn radius(&self) -> f64; }
25862586# struct Point { x: f64, y: f64 }
25872587# struct CircleStruct { center: Point, radius: f64 }
25882588# impl Circle for CircleStruct { fn radius(&self) -> f64 { (self.area() / PI).sqrt() } }
25892589# impl Shape for CircleStruct { fn area(&self) -> f64 { PI * square(self.radius) } }
2590+ # fn square(x: f64) -> f64 { x * x }
25902591
2591- let concrete = ~ CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
2592- let mycircle: ~ Circle = concrete as ~ Circle;
2592+ let concrete = box CircleStruct{center:Point{x:3.0,y:4.0},radius:5.0};
2593+ let mycircle: Box< Circle> = concrete as Box< Circle> ;
25932594let nonsense = mycircle.radius() * mycircle.area();
25942595~~~
25952596
0 commit comments