Skip to content

Commit

Permalink
Add librustc_driver::driver::reset_thread_local_state and
Browse files Browse the repository at this point in the history
remove the thread local state reset at the beginning of `phase_1_parse_input`.
  • Loading branch information
jseyfried committed Jul 18, 2016
1 parent 6cc49e5 commit 0042c1a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/librustc_driver/driver.rs
Expand Up @@ -478,10 +478,6 @@ pub fn phase_1_parse_input<'a>(sess: &'a Session,
cfg: ast::CrateConfig,
input: &Input)
-> PResult<'a, ast::Crate> {
// These may be left in an incoherent state after a previous compile.
syntax::ext::hygiene::reset_hygiene_data();
// `clear_ident_interner` can be used to free memory, but it does not restore the initial state.
token::reset_ident_interner();
let continue_after_error = sess.opts.continue_parse_after_error;
sess.diagnostic().set_continue_after_error(continue_after_error);

Expand Down Expand Up @@ -1298,3 +1294,11 @@ pub fn build_output_filenames(input: &Input,
}
}
}

// For use by the `rusti` project (https://github.com/murarth/rusti).
pub fn reset_thread_local_state() {
// These may be left in an incoherent state after a previous compile.
syntax::ext::hygiene::reset_hygiene_data();
// `clear_ident_interner` can be used to free memory, but it does not restore the initial state.
token::reset_ident_interner();
}

0 comments on commit 0042c1a

Please sign in to comment.