Change the `.unwrap` to `.expect` with a helpful message

This commit is contained in:
hyd-dev 2021-03-15 20:44:48 +08:00
parent 176bb6bd38
commit 4709dcd476
No known key found for this signature in database
GPG Key ID: 74FA7FD5B8DA14B8
1 changed files with 5 additions and 1 deletions

View File

@ -181,7 +181,11 @@ pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R
);
if let Some(parse_sess_created) = config.parse_sess_created {
parse_sess_created(&mut Lrc::get_mut(&mut sess).unwrap().parse_sess);
parse_sess_created(
&mut Lrc::get_mut(&mut sess)
.expect("create_session() should never share the returned session")
.parse_sess,
);
}
let compiler = Compiler {