diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-03-31 14:54:25 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-03-31 15:57:25 +1100 |
| commit | 4e63ab6fc11ab942052c485ed121a606f0a7d319 (patch) | |
| tree | 658326a708adcad8e7d9675aad98398905221dda /compiler/rustc_interface/src | |
| parent | f049d5df10fc169d12ae825b5a5e78e47a0195bd (diff) | |
| download | rust-4e63ab6fc11ab942052c485ed121a606f0a7d319.tar.gz rust-4e63ab6fc11ab942052c485ed121a606f0a7d319.zip | |
Improve `with_source_map`.
Rename `with_source_map` as `set_source_map`. Because `with` functions (e.g. `with_session_globals`, `scoped_tls::ScopedKey::with`) are for *getting* a value for the duration of a closure, and `set` functions (e.g. `set_session_globals_then` `scoped_tls::ScopedKey::with`) are for *setting* a value for the duration of a closure. Also fix up the comment, which is wrong: - The bit about `TyCtxt` is wrong. - `span_debug1` doesn't exist any more. - There's only one level of fallback, not two. (This is effectively a follow-up to the changes in #93936.) Also add a comment explaining that `SessionGlobals::source_map` should only be used when absolutely necessary.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 5e38ca034ac..be7fa9378ca 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -292,7 +292,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se override_queries: config.override_queries, }; - rustc_span::with_source_map(compiler.sess.parse_sess.clone_source_map(), move || { + rustc_span::set_source_map(compiler.sess.parse_sess.clone_source_map(), move || { let r = { let _sess_abort_error = OnDrop(|| { compiler.sess.finish_diagnostics(registry); |
