Skip to content

Commit ecf290d

Browse files
committed
rustc: Be explicit about which peer modules the metadata mod can access
This is the first step in eliminating dependencies on rustc so we can extract the metadata code into its own crate.
1 parent a6b9fa0 commit ecf290d

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

src/rustc/metadata.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Define the rustc API's that the metadata module has access to
2+
// Over time we will reduce these dependencies and, once metadata has
3+
// no dependencies on rustc it can move into its own crate.
4+
5+
mod middle {
6+
import ast_map = middle_::ast_map;
7+
export ast_map;
8+
import ty = middle_::ty;
9+
export ty;
10+
import trans = middle_::trans;
11+
export trans;
12+
import typeck = middle_::typeck;
13+
export typeck;
14+
import last_use = middle_::last_use;
15+
export last_use;
16+
import freevars = middle_::freevars;
17+
export freevars;
18+
import resolve = middle_::resolve;
19+
export resolve;
20+
}
21+
22+
mod front {
23+
}
24+
25+
mod back {
26+
}
27+
28+
mod driver {
29+
import session = driver_::session;
30+
export session;
31+
import diagnostic = rustsyntax::diagnostic;
32+
export diagnostic;
33+
}
34+
35+
mod util {
36+
import common = util_::common;
37+
export common;
38+
import ppaux = util_::ppaux;
39+
export ppaux;
40+
import filesearch = util_::filesearch;
41+
export filesearch;
42+
}
43+
44+
mod lib {
45+
import llvm = lib_::llvm;
46+
export llvm;
47+
}

src/rustc/rustc.rc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ use rustsyntax(vers = "0.2");
1717

1818
import core::*;
1919

20+
/*
21+
Alternate names for some modules.
22+
23+
I am using this to help extract metadata into its own crate. In metadata.rs
24+
it redefines all these modules in order to gate access from metadata to the
25+
rest of the compiler, then uses these to access the original implementation.
26+
*/
27+
import util_ = util;
28+
import lib_ = lib;
29+
import driver_ = driver;
30+
import middle_ = middle;
31+
2032
mod middle {
2133
mod trans {
2234
mod common;

0 commit comments

Comments
 (0)