Skip to content

Commit 29abe5e

Browse files
authored
Auto merge of #34856 - jseyfried:refactor_reset_tls, r=nrc
Avoid reseting the thread local interner at the beginning of `phase_1_parse_input` The thread local interner is used before `phase_1_parse_input` to create `InternedString`s, which currently wrap `Rc<String>`s. Once `InternedString` is refactored to be an interned string id (like `Name`), resetting will invalidate everything that was interned before `phase_1_parse_input`. The resets were only useful for the `rusti` project, which can now use `driver::reset_thread_local_state`. r? @nrc
2 parents a373b84 + a279f2f commit 29abe5e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
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+
}

src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ struct Baz<'x> {
4949

5050
impl<'a> Baz<'a> {
5151
fn baz2<'b>(&self, x: &isize) -> (&'b isize, &'b isize) {
52-
//~^ HELP consider using an explicit lifetime parameter as shown: fn baz2<'b>(&self, x: &'a isize) -> (&'a isize, &'a isize)
52+
//~^ HELP consider using an explicit lifetime parameter as shown: fn baz2<'b>(&self, x: &'
53+
// FIXME #35038: The above suggestion is different on Linux and Mac.
5354
(self.bar, x) //~ ERROR E0312
5455
//~^ ERROR E0312
5556
}

0 commit comments

Comments
 (0)