Skip to content

Commit a2572fe

Browse files
committed
rustc: Eliminate metadata's dependency on trans
1 parent ecf290d commit a2572fe

File tree

10 files changed

+123
-68
lines changed

10 files changed

+123
-68
lines changed

src/rustc/metadata.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
export maps;
2+
3+
// Auxiliary maps of things to be encoded
4+
type maps = {
5+
mutbl_map: middle::borrowck::mutbl_map,
6+
copy_map: middle::alias::copy_map,
7+
last_uses: middle::last_use::last_uses,
8+
impl_map: middle::resolve::impl_map,
9+
method_map: middle::typeck::method_map,
10+
vtable_map: middle::typeck::vtable_map,
11+
spill_map: middle::last_use::spill_map
12+
};
13+
114
// Define the rustc API's that the metadata module has access to
215
// Over time we will reduce these dependencies and, once metadata has
316
// no dependencies on rustc it can move into its own crate.
@@ -7,8 +20,6 @@ mod middle {
720
export ast_map;
821
import ty = middle_::ty;
922
export ty;
10-
import trans = middle_::trans;
11-
export trans;
1223
import typeck = middle_::typeck;
1324
export typeck;
1425
import last_use = middle_::last_use;
@@ -17,12 +28,18 @@ mod middle {
1728
export freevars;
1829
import resolve = middle_::resolve;
1930
export resolve;
31+
import borrowck = middle_::borrowck;
32+
export borrowck;
33+
import alias = middle_::alias;
34+
export alias;
2035
}
2136

2237
mod front {
2338
}
2439

2540
mod back {
41+
import link = back_::link;
42+
export link;
2643
}
2744

2845
mod driver {

src/rustc/metadata/astencode.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import std::serialization::serializer_helpers;
1717
import std::serialization::deserializer_helpers;
1818
import std::prettyprint::serializer;
1919
import std::smallintmap::map;
20-
import middle::trans::common::maps;
2120
import middle::{ty, typeck, last_use, ast_map};
2221
import middle::typeck::{method_origin,
2322
serialize_method_origin,
@@ -657,7 +656,7 @@ impl helpers for ebml::ebml_deserializer {
657656
impl helpers for @e::encode_ctxt {
658657
fn ty_str_ctxt() -> @tyencode::ctxt {
659658
@{ds: e::def_to_str,
660-
tcx: self.ccx.tcx,
659+
tcx: self.tcx,
661660
reachable: encoder::reachable(self, _),
662661
abbrevs: tyencode::ac_use_abbrevs(self.type_abbrevs)}
663662
}
@@ -721,8 +720,7 @@ fn encode_side_tables_for_ii(ecx: @e::encode_ctxt,
721720
fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
722721
ebml_w: ebml::writer,
723722
id: ast::node_id) {
724-
let ccx = ecx.ccx;
725-
let tcx = ccx.tcx;
723+
let tcx = ecx.tcx;
726724

727725
#debug["Encoding side tables for id %d", id];
728726

@@ -796,25 +794,25 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
796794
// }
797795
//}
798796

799-
option::iter(ccx.maps.mutbl_map.find(id)) {|_m|
797+
option::iter(ecx.maps.mutbl_map.find(id)) {|_m|
800798
ebml_w.tag(c::tag_table_mutbl) {||
801799
ebml_w.id(id);
802800
}
803801
}
804802

805-
option::iter(ccx.maps.copy_map.find(id)) {|_m|
803+
option::iter(ecx.maps.copy_map.find(id)) {|_m|
806804
ebml_w.tag(c::tag_table_copy) {||
807805
ebml_w.id(id);
808806
}
809807
}
810808

811-
option::iter(ccx.maps.spill_map.find(id)) {|_m|
809+
option::iter(ecx.maps.spill_map.find(id)) {|_m|
812810
ebml_w.tag(c::tag_table_spill) {||
813811
ebml_w.id(id);
814812
}
815813
}
816814

817-
option::iter(ccx.maps.last_uses.find(id)) {|m|
815+
option::iter(ecx.maps.last_uses.find(id)) {|m|
818816
ebml_w.tag(c::tag_table_last_use) {||
819817
ebml_w.id(id);
820818
ebml_w.tag(c::tag_table_val) {||
@@ -826,7 +824,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
826824
// impl_map is not used except when emitting metadata,
827825
// don't need to keep it.
828826

829-
option::iter(ccx.maps.method_map.find(id)) {|mo|
827+
option::iter(ecx.maps.method_map.find(id)) {|mo|
830828
ebml_w.tag(c::tag_table_method_map) {||
831829
ebml_w.id(id);
832830
ebml_w.tag(c::tag_table_val) {||
@@ -835,7 +833,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
835833
}
836834
}
837835

838-
option::iter(ccx.maps.vtable_map.find(id)) {|dr|
836+
option::iter(ecx.maps.vtable_map.find(id)) {|dr|
839837
ebml_w.tag(c::tag_table_vtable_map) {||
840838
ebml_w.id(id);
841839
ebml_w.tag(c::tag_table_val) {||

src/rustc/metadata/common.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,3 @@ fn hash_path(&&s: str) -> uint {
131131
for str::each(s) {|ch| h = (h << 5u) + h ^ (ch as uint); }
132132
ret h;
133133
}
134-

src/rustc/metadata/csearch.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import middle::{ty, ast_map};
77
import option::{some, none};
88
import driver::session;
99
import driver::session::expect;
10-
import middle::trans::common::maps;
1110
import common::*;
1211
import std::map::hashmap;
1312

src/rustc/metadata/decoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import tydecode::{parse_ty_data, parse_def_id, parse_bounds_data,
1313
parse_ident};
1414
import syntax::print::pprust;
1515
import cmd=cstore::crate_metadata;
16-
import middle::trans::common::maps;
1716
import util::ppaux::ty_to_str;
1817
import ebml::deserializer;
1918

0 commit comments

Comments
 (0)