From 004533ea755ecfc5d65e282366aaffc523e9632c Mon Sep 17 00:00:00 2001 From: Murarth Date: Fri, 28 Nov 2014 21:56:09 -0700 Subject: Fix rustc panic on second compile_input --- src/libsyntax/ext/mtwt.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs index e6d886e28ba..6ba90bbebed 100644 --- a/src/libsyntax/ext/mtwt.rs +++ b/src/libsyntax/ext/mtwt.rs @@ -136,6 +136,16 @@ pub fn clear_tables() { with_resolve_table_mut(|table| *table = HashMap::new()); } +/// Reset the tables to their initial state +pub fn reset_tables() { + with_sctable(|table| { + *table.table.borrow_mut() = vec!(EmptyCtxt, IllegalCtxt); + *table.mark_memo.borrow_mut() = HashMap::new(); + *table.rename_memo.borrow_mut() = HashMap::new(); + }); + with_resolve_table_mut(|table| *table = HashMap::new()); +} + /// Add a value to the end of a vec, return its index fn idx_push(vec: &mut Vec, val: T) -> u32 { vec.push(val); -- cgit 1.4.1-3-g733a5