Skip to content

Commit 04b4b50

Browse files
committed
Perform compiler state reset in phase_1
1 parent 2c02845 commit 04b4b50

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustc_driver/driver.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ pub fn compile_input(sess: Session,
4646
outdir: &Option<Path>,
4747
output: &Option<Path>,
4848
addl_plugins: Option<Plugins>) {
49-
// These may be left in an incoherent state after a previous compile.
50-
// `clear_tables` and `get_ident_interner().clear()` can be used to free
51-
// memory, but they do not restore the initial state.
52-
syntax::ext::mtwt::reset_tables();
53-
token::reset_ident_interner();
54-
5549
// We need nested scopes here, because the intermediate results can keep
5650
// large chunks of memory alive and we want to free them as soon as
5751
// possible to keep the peak memory usage low
@@ -115,6 +109,12 @@ pub fn source_name(input: &Input) -> String {
115109

116110
pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
117111
-> ast::Crate {
112+
// These may be left in an incoherent state after a previous compile.
113+
// `clear_tables` and `get_ident_interner().clear()` can be used to free
114+
// memory, but they do not restore the initial state.
115+
syntax::ext::mtwt::reset_tables();
116+
token::reset_ident_interner();
117+
118118
let krate = time(sess.time_passes(), "parsing", (), |_| {
119119
match *input {
120120
Input::File(ref file) => {

0 commit comments

Comments
 (0)