Rework SESSION_GLOBALS API to prevent overwriting it

This commit is contained in:
Guillaume Gomez 2021-05-05 21:31:25 +02:00 committed by Guillaume Gomez
parent 33acc960f7
commit abf449ffa6

View file

@ -34,7 +34,7 @@ impl<'b, T: Write + 'b> Session<'b, T> {
return Err(ErrorKind::VersionMismatch);
}
rustc_span::with_session_globals(self.config.edition().into(), || {
rustc_span::create_session_if_not_set_then(self.config.edition().into(), |_| {
if self.config.disable_all_formatting() {
// When the input is from stdin, echo back the input.
if let Input::Text(ref buf) = input {