about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/interface.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-10-07 16:20:20 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2022-10-19 08:09:40 +1100
commitec409f95bf52c5891084e309fed91fa9b6ce10b4 (patch)
tree894c71ba5a5c5d0b185990e08036efe0d1ea9929 /compiler/rustc_interface/src/interface.rs
parentb6ae1453cbe677deea362628c69efa501b4faa4b (diff)
downloadrust-ec409f95bf52c5891084e309fed91fa9b6ce10b4.tar.gz
rust-ec409f95bf52c5891084e309fed91fa9b6ce10b4.zip
Apply `Lrc` later to `sess` and `codegen_backend`.
This avoids the need for a degenerate `Lrc::get_mut` call.
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
-rw-r--r--compiler/rustc_interface/src/interface.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs
index 59b89ce01a6..a3bf7cde9ff 100644
--- a/compiler/rustc_interface/src/interface.rs
+++ b/compiler/rustc_interface/src/interface.rs
@@ -298,18 +298,14 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
             );
 
             if let Some(parse_sess_created) = config.parse_sess_created {
-                parse_sess_created(
-                    &mut Lrc::get_mut(&mut sess)
-                        .expect("create_session() should never share the returned session")
-                        .parse_sess,
-                );
+                parse_sess_created(&mut sess.parse_sess);
             }
 
             let temps_dir = sess.opts.unstable_opts.temps_dir.as_ref().map(|o| PathBuf::from(&o));
 
             let compiler = Compiler {
-                sess,
-                codegen_backend,
+                sess: Lrc::new(sess),
+                codegen_backend: Lrc::new(codegen_backend),
                 input: config.input,
                 input_path: config.input_path,
                 output_dir: config.output_dir,