]> git.lizzy.rs Git - rust.git/commitdiff
Perform compiler state reset in phase_1
authorMurarth <murarth@gmail.com>
Tue, 2 Dec 2014 21:55:07 +0000 (14:55 -0700)
committerMurarth <murarth@gmail.com>
Thu, 11 Dec 2014 22:33:27 +0000 (15:33 -0700)
src/librustc_driver/driver.rs

index 749bed15e38e05cc05a4c293d35f667327f1fed3..78486e128aca43bf0c5c093ba34fd0488b219969 100644 (file)
@@ -46,12 +46,6 @@ pub fn compile_input(sess: Session,
                      outdir: &Option<Path>,
                      output: &Option<Path>,
                      addl_plugins: Option<Plugins>) {
-    // These may be left in an incoherent state after a previous compile.
-    // `clear_tables` and `get_ident_interner().clear()` can be used to free
-    // memory, but they do not restore the initial state.
-    syntax::ext::mtwt::reset_tables();
-    token::reset_ident_interner();
-
     // We need nested scopes here, because the intermediate results can keep
     // large chunks of memory alive and we want to free them as soon as
     // possible to keep the peak memory usage low
@@ -115,6 +109,12 @@ pub fn source_name(input: &Input) -> String {
 
 pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
     -> ast::Crate {
+    // These may be left in an incoherent state after a previous compile.
+    // `clear_tables` and `get_ident_interner().clear()` can be used to free
+    // memory, but they do not restore the initial state.
+    syntax::ext::mtwt::reset_tables();
+    token::reset_ident_interner();
+
     let krate = time(sess.time_passes(), "parsing", (), |_| {
         match *input {
             Input::File(ref file) => {