diff options
| author | yukang <moorekang@gmail.com> | 2023-02-09 09:11:25 +0000 |
|---|---|---|
| committer | yukang <moorekang@gmail.com> | 2023-02-09 09:11:25 +0000 |
| commit | b940f5088e725026820a9f9a47bdd40c01786233 (patch) | |
| tree | 829efcd562b68da1dd10d55a8a5919020a417393 | |
| parent | a00e24d76a9ac03b146d3bf89e2161b2466c6551 (diff) | |
| download | rust-b940f5088e725026820a9f9a47bdd40c01786233.tar.gz rust-b940f5088e725026820a9f9a47bdd40c01786233.zip | |
fix #107822, handle properly when there is no crate attrs
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index a392d70f100..5e403d846e1 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -628,7 +628,7 @@ fn print_crate_info( println!("{}", serde_json::to_string_pretty(&sess.target.to_json()).unwrap()); } FileNames | CrateName => { - let attrs = attrs.as_ref().unwrap(); + let Some(attrs) = attrs.as_ref() else { return Compilation::Continue; }; let t_outputs = rustc_interface::util::build_output_filenames(attrs, sess); let id = rustc_session::output::find_crate_name(sess, attrs); if *req == PrintRequest::CrateName { |
