Skip to content

Commit 8826b68

Browse files
committedMar 19, 2023
Auto merge of #109346 - Dylan-DPC:rollup-vszi5bn, r=Dylan-DPC
Rollup of 10 pull requests Successful merges: - #104100 (Allow using `Range` as an `Iterator` in const contexts. ) - #105793 (Add note for mismatched types because of circular dependencies) - #108798 (move default backtrace setting to sys) - #108829 (Use Edition 2021 :pat in matches macro) - #108973 (Beautify pin! docs) - #109003 (Add `useless_anonymous_reexport` lint) - #109022 (read_buf_exact: on error, all read bytes are appended to the buffer) - #109212 (fix: don't suggest similar method when unstable) - #109243 (The name of NativeLib will be presented) - #109324 (Implement FixedSizeEncoding for UnusedGenericParams.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
·
1.88.01.70.0
2 parents ab9bb3e + 881c989 commit 8826b68

File tree

47 files changed

+577
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+577
-150
lines changed
 

‎compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ fn link_rlib<'a>(
358358
let (data, _) = create_wrapper_file(sess, b".bundled_lib".to_vec(), &src);
359359
let wrapper_file = emit_wrapper_file(sess, &data, tmpdir, filename.as_str());
360360
packed_bundled_libs.push(wrapper_file);
361-
} else if let Some(name) = lib.name {
361+
} else {
362362
let path =
363-
find_native_static_library(name.as_str(), lib.verbatim, &lib_search_paths, sess);
363+
find_native_static_library(lib.name.as_str(), lib.verbatim, &lib_search_paths, sess);
364364
ab.add_archive(&path, Box::new(|_| false)).unwrap_or_else(|error| {
365365
sess.emit_fatal(errors::AddNativeLibrary { library_path: path, error })});
366366
}
@@ -436,7 +436,7 @@ fn collate_raw_dylibs<'a, 'b>(
436436
for lib in used_libraries {
437437
if lib.kind == NativeLibKind::RawDylib {
438438
let ext = if lib.verbatim { "" } else { ".dll" };
439-
let name = format!("{}{}", lib.name.expect("unnamed raw-dylib library"), ext);
439+
let name = format!("{}{}", lib.name, ext);
440440
let imports = dylib_table.entry(name.clone()).or_default();
441441
for import in &lib.dll_imports {
442442
if let Some(old_import) = imports.insert(import.name, import) {
@@ -1296,7 +1296,7 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLib]) {
12961296
.iter()
12971297
.filter(|l| relevant_lib(sess, l))
12981298
.filter_map(|lib| {
1299-
let name = lib.name?;
1299+
let name = lib.name;
13001300
match lib.kind {
13011301
NativeLibKind::Static { bundle: Some(false), .. }
13021302
| NativeLibKind::Dylib { .. }
@@ -1317,6 +1317,7 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLib]) {
13171317
// These are included, no need to print them
13181318
NativeLibKind::Static { bundle: None | Some(true), .. }
13191319
| NativeLibKind::LinkArg
1320+
| NativeLibKind::WasmImportModule
13201321
| NativeLibKind::RawDylib => None,
13211322
}
13221323
})
@@ -2275,21 +2276,18 @@ fn add_native_libs_from_crate(
22752276

22762277
let mut last = (None, NativeLibKind::Unspecified, false);
22772278
for lib in native_libs {
2278-
let Some(name) = lib.name else {
2279-
continue;
2280-
};
22812279
if !relevant_lib(sess, lib) {
22822280
continue;
22832281
}
22842282

22852283
// Skip if this library is the same as the last.
2286-
last = if (lib.name, lib.kind, lib.verbatim) == last {
2284+
last = if (Some(lib.name), lib.kind, lib.verbatim) == last {
22872285
continue;
22882286
} else {
2289-
(lib.name, lib.kind, lib.verbatim)
2287+
(Some(lib.name), lib.kind, lib.verbatim)
22902288
};
22912289

2292-
let name = name.as_str();
2290+
let name = lib.name.as_str();
22932291
let verbatim = lib.verbatim;
22942292
match lib.kind {
22952293
NativeLibKind::Static { bundle, whole_archive } => {
@@ -2346,6 +2344,7 @@ fn add_native_libs_from_crate(
23462344
NativeLibKind::RawDylib => {
23472345
// Handled separately in `linker_with_args`.
23482346
}
2347+
NativeLibKind::WasmImportModule => {}
23492348
NativeLibKind::LinkArg => {
23502349
if link_static {
23512350
cmd.arg(name);

‎compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ fn wasm_import_module_map(tcx: TyCtxt<'_>, cnum: CrateNum) -> FxHashMap<DefId, S
595595

596596
let mut ret = FxHashMap::default();
597597
for (def_id, lib) in tcx.foreign_modules(cnum).iter() {
598-
let module = def_id_to_native_lib.get(&def_id).and_then(|s| s.wasm_import_module);
598+
let module = def_id_to_native_lib.get(&def_id).and_then(|s| s.wasm_import_module());
599599
let Some(module) = module else { continue };
600600
ret.extend(lib.foreign_items.iter().map(|id| {
601601
assert_eq!(id.krate, cnum);

0 commit comments

Comments
 (0)
Please sign in to comment.