Skip to content

Commit 0042c1a

Browse files
committed
Add librustc_driver::driver::reset_thread_local_state and
remove the thread local state reset at the beginning of `phase_1_parse_input`.
1 parent 6cc49e5 commit 0042c1a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/librustc_driver/driver.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,6 @@ pub fn phase_1_parse_input<'a>(sess: &'a Session,
478478
cfg: ast::CrateConfig,
479479
input: &Input)
480480
-> PResult<'a, ast::Crate> {
481-
// These may be left in an incoherent state after a previous compile.
482-
syntax::ext::hygiene::reset_hygiene_data();
483-
// `clear_ident_interner` can be used to free memory, but it does not restore the initial state.
484-
token::reset_ident_interner();
485481
let continue_after_error = sess.opts.continue_parse_after_error;
486482
sess.diagnostic().set_continue_after_error(continue_after_error);
487483

@@ -1298,3 +1294,11 @@ pub fn build_output_filenames(input: &Input,
12981294
}
12991295
}
13001296
}
1297+
1298+
// For use by the `rusti` project (https://github.com/murarth/rusti).
1299+
pub fn reset_thread_local_state() {
1300+
// These may be left in an incoherent state after a previous compile.
1301+
syntax::ext::hygiene::reset_hygiene_data();
1302+
// `clear_ident_interner` can be used to free memory, but it does not restore the initial state.
1303+
token::reset_ident_interner();
1304+
}

0 commit comments

Comments
 (0)