Skip to content

Commit aa4b997

Browse files
committed
---
yaml --- r: 22013 b: refs/heads/snap-stage3 c: 546f3db h: refs/heads/master i: 22011: fef3a52 v: v3
1 parent 9a6d960 commit aa4b997

34 files changed

+99
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9c6ae658658a48c4686a0f09be5cf6a3f45e0fb5
4+
refs/heads/snap-stage3: 546f3dbbf5832e83abcb6ceb6f6b78b61ede587b
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/rustc/middle/resolve.rs

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,6 +2868,64 @@ impl Resolver {
28682868

28692869
fn record_exports_for_module(module_: @Module) {
28702870
let mut exports2 = ~[];
2871+
2872+
if module_.legacy_exports {
2873+
self.add_exports_for_legacy_module(&mut exports2, module_);
2874+
} else {
2875+
self.add_exports_for_module(&mut exports2, module_);
2876+
}
2877+
match copy module_.def_id {
2878+
Some(def_id) => {
2879+
self.export_map2.insert(def_id.node, move exports2);
2880+
debug!("(computing exports) writing exports for %d (some)",
2881+
def_id.node);
2882+
}
2883+
None => {}
2884+
}
2885+
}
2886+
2887+
2888+
fn add_exports_of_namebindings(exports2: &mut ~[Export2],
2889+
atom: Atom,
2890+
namebindings: @NameBindings,
2891+
reexport: bool) {
2892+
for [ModuleNS, TypeNS, ValueNS].each |ns| {
2893+
match namebindings.def_for_namespace(*ns) {
2894+
Some(d) if d.privacy == Public => {
2895+
vec::push(*exports2, Export2 {
2896+
reexport: reexport,
2897+
name: self.session.str_of(atom),
2898+
def_id: def_id_of_def(d.def)
2899+
});
2900+
}
2901+
_ => ()
2902+
}
2903+
}
2904+
}
2905+
2906+
fn add_exports_for_module(exports2: &mut ~[Export2], module_: @Module) {
2907+
2908+
for module_.children.each_ref |atom, namebindings| {
2909+
self.add_exports_of_namebindings(exports2, *atom,
2910+
*namebindings, false)
2911+
}
2912+
2913+
for module_.import_resolutions.each_ref |atom, importresolution| {
2914+
for [ModuleNS, TypeNS, ValueNS].each |ns| {
2915+
match importresolution.target_for_namespace(*ns) {
2916+
Some(target) => {
2917+
self.add_exports_of_namebindings(exports2, *atom,
2918+
target.bindings,
2919+
true)
2920+
}
2921+
_ => ()
2922+
}
2923+
}
2924+
}
2925+
}
2926+
2927+
fn add_exports_for_legacy_module(exports2: &mut ~[Export2],
2928+
module_: @Module) {
28712929
for module_.exported_names.each |name, _exp_node_id| {
28722930
for self.namespaces.each |namespace| {
28732931
match self.resolve_definition_of_name_in_module(module_,
@@ -2882,7 +2940,7 @@ impl Resolver {
28822940
for %?",
28832941
self.session.str_of(name),
28842942
module_.def_id);
2885-
vec::push(exports2, Export2 {
2943+
vec::push(*exports2, Export2 {
28862944
reexport: false,
28872945
name: self.session.str_of(name),
28882946
def_id: def_id_of_def(target_def)
@@ -2893,7 +2951,7 @@ impl Resolver {
28932951
%?",
28942952
self.session.str_of(name),
28952953
module_.def_id);
2896-
vec::push(exports2, Export2 {
2954+
vec::push(*exports2, Export2 {
28972955
reexport: true,
28982956
name: self.session.str_of(name),
28992957
def_id: def_id_of_def(target_def)
@@ -2902,15 +2960,6 @@ impl Resolver {
29022960
}
29032961
}
29042962
}
2905-
2906-
match copy module_.def_id {
2907-
Some(def_id) => {
2908-
self.export_map2.insert(def_id.node, move exports2);
2909-
debug!("(computing exports) writing exports for %d (some)",
2910-
def_id.node);
2911-
}
2912-
None => {}
2913-
}
29142963
}
29152964

29162965
// AST resolution
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_exports];
2+
13
fn foo(x: &uint) -> uint {
24
*x
35
}

branches/snap-stage3/src/test/auxiliary/cci_capture_clause.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[legacy_exports];
2+
13
export foo;
24

35
use comm::*;

branches/snap-stage3/src/test/auxiliary/cci_intrinsic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[legacy_exports];
12
#[abi = "rust-intrinsic"]
23
extern mod rusti {
34
#[legacy_exports];

branches/snap-stage3/src/test/auxiliary/cci_iter_lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#[link(name="cci_iter_lib", vers="0.0")];
22
#[legacy_modes];
3+
#[legacy_exports];
34

45
#[inline]
56
fn iter<T>(v: ~[T], f: fn(T)) {

branches/snap-stage3/src/test/auxiliary/cci_nested_lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[legacy_modes];
2+
#[legacy_exports];
23

34
use dvec::DVec;
45

branches/snap-stage3/src/test/auxiliary/cci_no_inline_lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[link(name="cci_no_inline_lib", vers="0.0")];
2+
#[legacy_exports];
23

34
// same as cci_iter_lib, more-or-less, but not marked inline
45
fn iter(v: ~[uint], f: fn(uint)) {

branches/snap-stage3/src/test/auxiliary/crateresolve1-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.1")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn f() -> int { 10 }

branches/snap-stage3/src/test/auxiliary/crateresolve1-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.2")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn f() -> int { 20 }

branches/snap-stage3/src/test/auxiliary/crateresolve1-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.3")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn f() -> int { 30 }

branches/snap-stage3/src/test/auxiliary/crateresolve2-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.1")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn f() -> int { 10 }

branches/snap-stage3/src/test/auxiliary/crateresolve2-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.2")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn f() -> int { 20 }

branches/snap-stage3/src/test/auxiliary/crateresolve2-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.3")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn f() -> int { 30 }

branches/snap-stage3/src/test/auxiliary/crateresolve3-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.1")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn f() -> int { 10 }

branches/snap-stage3/src/test/auxiliary/crateresolve3-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
vers = "0.2")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn g() -> int { 20 }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[link(name = "crateresolve4a", vers = "0.1")];
22
#[crate_type = "lib"];
3+
#[legacy_exports];
34

45
fn f() -> int { 10 }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[link(name = "crateresolve4a", vers= "0.2")];
22
#[crate_type = "lib"];
3+
#[legacy_exports];
34

45
fn g() -> int { 20 }

branches/snap-stage3/src/test/auxiliary/crateresolve4b-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// aux-build:crateresolve4a-2.rs
33
#[link(name = "crateresolve4b", vers = "0.1")];
44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
extern mod crateresolve4a(vers="0.2");
78

branches/snap-stage3/src/test/auxiliary/crateresolve4b-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// aux-build:crateresolve4a-2.rs
33
#[link(name = "crateresolve4b", vers = "0.2")];
44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
extern mod crateresolve4a(vers="0.1");
78

branches/snap-stage3/src/test/auxiliary/crateresolve5-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
vers = "0.1")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn structural() -> { name: ~str, val: int } {
78
{ name: ~"crateresolve5", val: 10 }

branches/snap-stage3/src/test/auxiliary/crateresolve5-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
vers = "0.2")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
fn structural() -> { name: ~str, val: int } {
78
{ name: ~"crateresolve5", val: 10 }

branches/snap-stage3/src/test/auxiliary/crateresolve_calories-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
calories = "100")];
44

55
#[crate_type = "lib"];
6+
#[legacy_exports];
67

78
fn f() -> int { 100 }

branches/snap-stage3/src/test/auxiliary/crateresolve_calories-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
calories = "200")];
44

55
#[crate_type = "lib"];
6+
#[legacy_exports];
67

78
fn f() -> int { 200 }

branches/snap-stage3/src/test/auxiliary/extern-crosscrate-source.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
vers = "0.1")];
33

44
#[crate_type = "lib"];
5+
#[legacy_exports];
56

67
extern mod rustrt {
78
#[legacy_exports];

branches/snap-stage3/src/test/auxiliary/issue-2380.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#[link(name = "a", vers = "0.0")];
22
#[crate_type = "lib"];
3+
#[legacy_exports];
34

45
trait i<T> { }
56

branches/snap-stage3/src/test/auxiliary/issue-2631-a.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#[link(name = "req")];
22
#[crate_type = "lib"];
3+
#[legacy_exports];
34

45
extern mod std;
56

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[legacy_exports];
12
unsafe fn f(xs: ~[int]) {
23
xs.map(|_x| { unsafe fn q() { fail; } });
34
}

branches/snap-stage3/src/test/auxiliary/test_comm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Could probably be more minimal.
55
*/
6+
#[legacy_exports];
67

78
use libc::size_t;
89

branches/snap-stage3/src/test/run-pass/cci_borrow.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// xfail-fast - check-fast doesn't understand aux-build
22
// aux-build:cci_borrow_lib.rs
33

4+
#[legacy_exports];
5+
46
extern mod cci_borrow_lib;
57
use cci_borrow_lib::foo;
68

branches/snap-stage3/src/test/run-pass/cci_capture_clause.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// This test makes sure we can do cross-crate inlining on functions
55
// that use capture clauses.
66

7+
#[legacy_exports];
8+
79
extern mod cci_capture_clause;
810

911
use comm::recv;

branches/snap-stage3/src/test/run-pass/cci_nested_exe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// aux-build:cci_nested_lib.rs
33

44
#[legacy_modes];
5+
#[legacy_exports];
56

67
extern mod cci_nested_lib;
78
use cci_nested_lib::*;

branches/snap-stage3/src/test/run-pass/cci_no_inline_exe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// xfail-fast - check-fast doesn't understand aux-build
22
// aux-build:cci_no_inline_lib.rs
33

4+
#[legacy_exports];
5+
46
extern mod cci_no_inline_lib;
57
use cci_no_inline_lib::iter;
68

branches/snap-stage3/src/test/run-pass/crateresolve4.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// aux-build:crateresolve4b-1.rs
55
// aux-build:crateresolve4b-2.rs
66

7+
#[legacy_exports];
8+
79
mod a {
810
#[legacy_exports];
911
extern mod crateresolve4b(vers = "0.1");

0 commit comments

Comments
 (0)