|
1 | 1 | use rustc_arena::TypedArena;
|
2 | 2 | use rustc_ast::CRATE_NODE_ID;
|
3 |
| -use rustc_data_structures::fx::FxHashSet; |
4 |
| -use rustc_data_structures::fx::FxIndexMap; |
| 3 | +use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; |
5 | 4 | use rustc_data_structures::memmap::Mmap;
|
6 | 5 | use rustc_data_structures::temp_dir::MaybeTempDir;
|
7 | 6 | use rustc_errors::{DiagCtxt, ErrorGuaranteed};
|
@@ -534,9 +533,9 @@ fn link_staticlib<'a>(
|
534 | 533 |
|
535 | 534 | let native_libs = codegen_results.crate_info.native_libraries[&cnum].iter();
|
536 | 535 | let relevant = native_libs.clone().filter(|lib| relevant_lib(sess, lib));
|
537 |
| - let relevant_libs: FxHashSet<_> = relevant.filter_map(|lib| lib.filename).collect(); |
| 536 | + let relevant_libs: FxIndexSet<_> = relevant.filter_map(|lib| lib.filename).collect(); |
538 | 537 |
|
539 |
| - let bundled_libs: FxHashSet<_> = native_libs.filter_map(|lib| lib.filename).collect(); |
| 538 | + let bundled_libs: FxIndexSet<_> = native_libs.filter_map(|lib| lib.filename).collect(); |
540 | 539 | ab.add_archive(
|
541 | 540 | path,
|
542 | 541 | Box::new(move |fname: &str| {
|
@@ -564,11 +563,7 @@ fn link_staticlib<'a>(
|
564 | 563 | .extract_bundled_libs(path, tempdir.as_ref(), &relevant_libs)
|
565 | 564 | .unwrap_or_else(|e| sess.dcx().emit_fatal(e));
|
566 | 565 |
|
567 |
| - // We sort the libraries below |
568 |
| - #[allow(rustc::potential_query_instability)] |
569 |
| - let mut relevant_libs: Vec<Symbol> = relevant_libs.into_iter().collect(); |
570 |
| - relevant_libs.sort_unstable(); |
571 |
| - for filename in relevant_libs { |
| 566 | + for filename in relevant_libs.iter() { |
572 | 567 | let joined = tempdir.as_ref().join(filename.as_str());
|
573 | 568 | let path = joined.as_path();
|
574 | 569 | ab.add_archive(path, Box::new(|_| false)).unwrap();
|
@@ -682,13 +677,14 @@ fn link_dwarf_object<'a>(
|
682 | 677 | }
|
683 | 678 |
|
684 | 679 | // Input rlibs contain .o/.dwo files from dependencies.
|
685 |
| - #[allow(rustc::potential_query_instability)] |
686 | 680 | let input_rlibs = cg_results
|
687 | 681 | .crate_info
|
688 | 682 | .used_crate_source
|
689 |
| - .values() |
690 |
| - .filter_map(|csource| csource.rlib.as_ref()) |
691 |
| - .map(|(path, _)| path); |
| 683 | + .items() |
| 684 | + .filter_map(|(_, csource)| csource.rlib.as_ref()) |
| 685 | + .map(|(path, _)| path) |
| 686 | + .into_sorted_stable_ord(); |
| 687 | + |
692 | 688 | for input_rlib in input_rlibs {
|
693 | 689 | debug!(?input_rlib);
|
694 | 690 | package.add_input_object(input_rlib)?;
|
@@ -2456,7 +2452,7 @@ fn add_native_libs_from_crate(
|
2456 | 2452 | codegen_results: &CodegenResults,
|
2457 | 2453 | tmpdir: &Path,
|
2458 | 2454 | search_paths: &SearchPaths,
|
2459 |
| - bundled_libs: &FxHashSet<Symbol>, |
| 2455 | + bundled_libs: &FxIndexSet<Symbol>, |
2460 | 2456 | cnum: CrateNum,
|
2461 | 2457 | link_static: bool,
|
2462 | 2458 | link_dynamic: bool,
|
@@ -2777,7 +2773,7 @@ fn add_static_crate<'a>(
|
2777 | 2773 | codegen_results: &CodegenResults,
|
2778 | 2774 | tmpdir: &Path,
|
2779 | 2775 | cnum: CrateNum,
|
2780 |
| - bundled_lib_file_names: &FxHashSet<Symbol>, |
| 2776 | + bundled_lib_file_names: &FxIndexSet<Symbol>, |
2781 | 2777 | ) {
|
2782 | 2778 | let src = &codegen_results.crate_info.used_crate_source[&cnum];
|
2783 | 2779 | let cratepath = &src.rlib.as_ref().unwrap().0;
|
|
0 commit comments