Skip to content

Commit

Permalink
Do not ICE for native_lib without name
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Mar 16, 2023
1 parent 511364e commit c22f154
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_metadata/src/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ fn find_bundled_library(
sess: &Session,
) -> Option<Symbol> {
if let NativeLibKind::Static { bundle: Some(true) | None, whole_archive } = kind
&& let Some(name) = name
&& sess.crate_types().iter().any(|t| matches!(t, &CrateType::Rlib | CrateType::Staticlib))
&& (sess.opts.unstable_opts.packed_bundled_libs || has_cfg || whole_archive == Some(true))
{
let verbatim = verbatim.unwrap_or(false);
let search_paths = &sess.target_filesearch(PathKind::Native).search_path_dirs();
return find_native_static_library(name.unwrap().as_str(), verbatim, search_paths, sess)
return find_native_static_library(name.as_str(), verbatim, search_paths, sess)
.file_name()
.and_then(|s| s.to_str())
.map(Symbol::intern);
Expand Down

0 comments on commit c22f154

Please sign in to comment.