From ecf290d448e1b46e073bd8727c04156a06948bf5 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 13 May 2012 15:56:45 -0700 Subject: [PATCH] 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. --- src/rustc/metadata.rs | 47 +++++++++++++++++++++++++++++++++++++++++++ src/rustc/rustc.rc | 12 +++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/rustc/metadata.rs diff --git a/src/rustc/metadata.rs b/src/rustc/metadata.rs new file mode 100644 index 000000000000..2a789ff4ed27 --- /dev/null +++ b/src/rustc/metadata.rs @@ -0,0 +1,47 @@ +// Define the rustc API's that the metadata module has access to +// Over time we will reduce these dependencies and, once metadata has +// no dependencies on rustc it can move into its own crate. + +mod middle { + import ast_map = middle_::ast_map; + export ast_map; + import ty = middle_::ty; + export ty; + import trans = middle_::trans; + export trans; + import typeck = middle_::typeck; + export typeck; + import last_use = middle_::last_use; + export last_use; + import freevars = middle_::freevars; + export freevars; + import resolve = middle_::resolve; + export resolve; +} + +mod front { +} + +mod back { +} + +mod driver { + import session = driver_::session; + export session; + import diagnostic = rustsyntax::diagnostic; + export diagnostic; +} + +mod util { + import common = util_::common; + export common; + import ppaux = util_::ppaux; + export ppaux; + import filesearch = util_::filesearch; + export filesearch; +} + +mod lib { + import llvm = lib_::llvm; + export llvm; +} diff --git a/src/rustc/rustc.rc b/src/rustc/rustc.rc index cdfecad1b152..961b7c6c6833 100644 --- a/src/rustc/rustc.rc +++ b/src/rustc/rustc.rc @@ -17,6 +17,18 @@ use rustsyntax(vers = "0.2"); import core::*; +/* +Alternate names for some modules. + +I am using this to help extract metadata into its own crate. In metadata.rs +it redefines all these modules in order to gate access from metadata to the +rest of the compiler, then uses these to access the original implementation. +*/ +import util_ = util; +import lib_ = lib; +import driver_ = driver; +import middle_ = middle; + mod middle { mod trans { mod common;