File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5
- refs/heads/try: bb51a8442fb16d71faccac1abfa953d8b1e37cb7
5
+ refs/heads/try: 88bec09e6345d64d334c6dc1ef4947b35c467373
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
Original file line number Diff line number Diff line change 516
516
| cut -d ' ' -f 2)
517
517
518
518
case $CFG_CLANG_VERSION in
519
- (3.0svn | 3.0 | 3.1* | 3.2* | 4.0* | 4.1* )
519
+ (3.0svn | 3.0 | 3.1 | 3.2 | 4.0 | 4.1)
520
520
step_msg " found ok version of CLANG: $CFG_CLANG_VERSION "
521
521
CFG_C_COMPILER=" clang"
522
522
;;
Original file line number Diff line number Diff line change @@ -2015,7 +2015,7 @@ the method name with the trait name.
2015
2015
The compiler will use type inference to decide which implementation to call.
2016
2016
2017
2017
~~~~
2018
- # trait Shape { static fn new(area: float) -> self; }
2018
+ trait Shape { static fn new(area: float) -> self; }
2019
2019
# use float::consts::pi;
2020
2020
# use float::sqrt;
2021
2021
struct Circle { radius: float }
@@ -2211,11 +2211,16 @@ Likewise, supertrait methods may also be called on trait objects.
2211
2211
~~~ {.xfail-test}
2212
2212
# trait Shape { fn area(&self) -> float; }
2213
2213
# trait Circle : Shape { fn radius(&self) -> float; }
2214
- # impl int: Shape { fn area(&self) -> float { 0.0 } }
2215
- # impl int: Circle { fn radius(&self) -> float { 0.0 } }
2216
- # let mycircle = 0;
2214
+ # use float::consts::pi;
2215
+ # use float::sqrt;
2216
+ # struct Point { x: float, y: float }
2217
+ # struct CircleStruct { center: Point, radius: float }
2218
+ # impl CircleStruct: Circle { fn radius(&self) -> float { sqrt(self.area() / pi) } }
2219
+ # impl CircleStruct: Shape { fn area(&self) -> float { pi * square(self.radius) } }
2220
+
2221
+ let concrete = @CircleStruct{center:Point{x:3f,y:4f},radius:5f};
2217
2222
2218
- let mycircle: Circle = @mycircle as @Circle;
2223
+ let mycircle: Circle = concrete as @Circle;
2219
2224
let nonsense = mycircle.radius() * mycircle.area();
2220
2225
~~~
2221
2226
You can’t perform that action at this time.
0 commit comments