Skip to content

Commit 4709dcd

Browse files
author
hyd-dev
committed
Change the .unwrap to .expect with a helpful message
1 parent 176bb6b commit 4709dcd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/rustc_interface/src/interface.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R
181181
);
182182

183183
if let Some(parse_sess_created) = config.parse_sess_created {
184-
parse_sess_created(&mut Lrc::get_mut(&mut sess).unwrap().parse_sess);
184+
parse_sess_created(
185+
&mut Lrc::get_mut(&mut sess)
186+
.expect("create_session() should never share the returned session")
187+
.parse_sess,
188+
);
185189
}
186190

187191
let compiler = Compiler {

0 commit comments

Comments
 (0)