Skip to content

Commit 8727742

Browse files
committed
---
yaml --- r: 42748 b: refs/heads/try c: 8ec36d7 h: refs/heads/master v: v3
1 parent 2b77f50 commit 8727742

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 2dda6d6f5d66aeacf0493f9c37663cd11ea0e382
5+
refs/heads/try: 8ec36d779b760eed8625ec69a983461e2ffe3914
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/doc/tutorial-borrowed-ptr.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ rejected by the compiler):
302302
fn example3() -> int {
303303
let mut x = ~X {f: 3};
304304
let y = &x.f;
305-
x = ~X {f: 4}; // Error reported here.
305+
x = ~{f: 4}; // Error reported here.
306306
*y
307307
}
308308
~~~
@@ -369,11 +369,9 @@ box's owner. Consider a program like this:
369369
~~~
370370
struct R { g: int }
371371
struct S { mut f: ~R }
372-
fn example5a(x: @S, callback: @fn()) -> int {
372+
fn example5a(x: @S ...) -> int {
373373
let y = &x.f.g; // Error reported here.
374374
...
375-
callback();
376-
...
377375
# return 0;
378376
}
379377
~~~

branches/try/doc/tutorial.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ the method name with the trait name.
20152015
The compiler will use type inference to decide which implementation to call.
20162016

20172017
~~~~
2018-
trait Shape { static fn new(area: float) -> self; }
2018+
# trait Shape { static fn new(area: float) -> self; }
20192019
# use float::consts::pi;
20202020
# use float::sqrt;
20212021
struct Circle { radius: float }
@@ -2211,15 +2211,11 @@ Likewise, supertrait methods may also be called on trait objects.
22112211
~~~ {.xfail-test}
22122212
# trait Shape { fn area(&self) -> float; }
22132213
# trait Circle : Shape { fn radius(&self) -> float; }
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) } }
2214+
# impl int: Shape { fn area(&self) -> float { 0.0 } }
2215+
# impl int: Circle { fn radius(&self) -> float { 0.0 } }
2216+
# let mycircle = 0;
22202217
2221-
let concrete = @CircleStruct{center:Point{x:3f,y:4f},radius:5f};
2222-
let mycircle: Circle = concrete as @Circle;
2218+
let mycircle: Circle = @mycircle as @Circle;
22232219
let nonsense = mycircle.radius() * mycircle.area();
22242220
~~~
22252221

branches/try/src/rt/rust_crate_map.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#include "rust_crate_map.h"
12+
#include <set>
1213

1314
void iter_module_map(const mod_entry* map,
1415
void (*fn)(const mod_entry* entry, void *cookie),
@@ -20,18 +21,27 @@ void iter_module_map(const mod_entry* map,
2021

2122
void iter_crate_map(const cratemap* map,
2223
void (*fn)(const mod_entry* map, void *cookie),
23-
void *cookie) {
24-
// First iterate this crate
25-
iter_module_map(map->entries(), fn, cookie);
26-
// Then recurse on linked crates
27-
// FIXME (#2673) this does double work in diamond-shaped deps. could
28-
// keep a set of visited addresses, if it turns out to be actually
29-
// slow
30-
for (cratemap::iterator i = map->begin(), e = map->end(); i != e; ++i) {
31-
iter_crate_map(*i, fn, cookie);
24+
void *cookie,
25+
std::set<const cratemap*>& visited) {
26+
if (visited.find(map) == visited.end()) {
27+
// Mark this crate visited
28+
visited.insert(map);
29+
// First iterate this crate
30+
iter_module_map(map->entries(), fn, cookie);
31+
// Then recurse on linked crates
32+
for (cratemap::iterator i = map->begin(),
33+
e = map->end(); i != e; ++i) {
34+
iter_crate_map(*i, fn, cookie, visited);
35+
}
3236
}
3337
}
3438

39+
void iter_crate_map(const cratemap* map,
40+
void (*fn)(const mod_entry* map, void *cookie),
41+
void *cookie) {
42+
std::set<const cratemap*> visited;
43+
iter_crate_map(map, fn, cookie, visited);
44+
}
3545
//
3646
// Local Variables:
3747
// mode: C++

0 commit comments

Comments
 (0)