Skip to content

Commit debe238

Browse files
committed
---
yaml --- r: 31130 b: refs/heads/dist-snap c: 46fba10 h: refs/heads/master v: v3
1 parent fdebbb2 commit debe238

File tree

4 files changed

+50
-15
lines changed

4 files changed

+50
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 200a2ded3245eb0a1ca7b265ce83adba16d75b97
10+
refs/heads/dist-snap: 46fba10fe82ef9a584118b8d2298cdfc49320c85
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/rustc/middle/trans/reachable.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn find_reachable(crate_mod: _mod, exp_map: resolve::exp_map,
2727
let rmap = std::map::int_hash();
2828
let cx = {exp_map: exp_map, tcx: tcx, method_map: method_map, rmap: rmap};
2929
traverse_public_mod(cx, crate_mod);
30-
traverse_all_resources(cx, crate_mod);
30+
traverse_all_resources_and_impls(cx, crate_mod);
3131
rmap
3232
}
3333

@@ -81,18 +81,6 @@ fn traverse_public_mod(cx: ctx, m: _mod) {
8181
if !traverse_exports(cx, m.view_items) {
8282
// No exports, so every local item is exported
8383
for vec::each(m.items) |item| { traverse_public_item(cx, item); }
84-
} else {
85-
// Make impls always reachable.
86-
for vec::each(m.items) |item| {
87-
alt item.node {
88-
item_impl(*) {
89-
traverse_public_item(cx, item);
90-
}
91-
_ {
92-
// Nothing to do.
93-
}
94-
}
95-
}
9684
}
9785
}
9886

@@ -212,7 +200,7 @@ fn traverse_inline_body(cx: ctx, body: blk) {
212200
}));
213201
}
214202

215-
fn traverse_all_resources(cx: ctx, crate_mod: _mod) {
203+
fn traverse_all_resources_and_impls(cx: ctx, crate_mod: _mod) {
216204
visit::visit_mod(crate_mod, ast_util::dummy_sp(), 0, cx, visit::mk_vt(@{
217205
visit_expr: |_e, _cx, _v| { },
218206
visit_item: |i, cx, v| {
@@ -221,9 +209,13 @@ fn traverse_all_resources(cx: ctx, crate_mod: _mod) {
221209
item_class(_, _, _, _, some(_)) {
222210
traverse_public_item(cx, i);
223211
}
212+
item_impl(*) {
213+
traverse_public_item(cx, i);
214+
}
224215
_ {}
225216
}
226217
}
227218
with *visit::default_visitor()
228219
}));
229220
}
221+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#[link(name = "crate_method_reexport_grrrrrrr2")];
2+
3+
export rust;
4+
5+
import name_pool::methods;
6+
7+
mod name_pool {
8+
9+
type name_pool = ();
10+
11+
impl methods for name_pool {
12+
fn add(s: str) {
13+
}
14+
}
15+
}
16+
17+
mod rust {
18+
19+
export rt;
20+
export methods;
21+
22+
type rt = @();
23+
24+
impl methods for rt {
25+
fn cx() {
26+
}
27+
}
28+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is a regression test that the metadata for the
2+
// name_pool::methods impl in the other crate is reachable from this
3+
// crate.
4+
5+
// aux-build:crate-method-reexport-grrrrrrr2.rs
6+
7+
use crate_method_reexport_grrrrrrr2;
8+
9+
fn main() {
10+
import crate_method_reexport_grrrrrrr2::rust::methods;
11+
let x = @();
12+
x.cx();
13+
let y = ();
14+
y.add("hi");
15+
}

0 commit comments

Comments
 (0)