diff options
| author | bors <bors@rust-lang.org> | 2021-07-07 18:28:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-07 18:28:53 +0000 |
| commit | d2b04f075c0ce010758c4c8674152ff89d1d73f3 (patch) | |
| tree | 762f7857d0fcd214231cd197b7f0ea93534be018 /compiler/rustc_middle/src | |
| parent | c5e344f7747dbd7e7d4b209e3c480deb5979a56f (diff) | |
| parent | 2977dff116a3ec93135c349ed39a46eec008c51c (diff) | |
| download | rust-d2b04f075c0ce010758c4c8674152ff89d1d73f3.tar.gz rust-d2b04f075c0ce010758c4c8674152ff89d1d73f3.zip | |
Auto merge of #86105 - bjorn3:link_info_refactor, r=petrochenkov
Refactor the generation of the metadata for linking
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/middle/cstore.rs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/compiler/rustc_middle/src/middle/cstore.rs b/compiler/rustc_middle/src/middle/cstore.rs index fccf1569e61..3c4c4a84d24 100644 --- a/compiler/rustc_middle/src/middle/cstore.rs +++ b/compiler/rustc_middle/src/middle/cstore.rs @@ -197,30 +197,3 @@ pub trait CrateStore { } pub type CrateStoreDyn = dyn CrateStore + sync::Sync; - -// This method is used when generating the command line to pass through to -// system linker. The linker expects undefined symbols on the left of the -// command line to be defined in libraries on the right, not the other way -// around. For more info, see some comments in the add_used_library function -// below. -// -// In order to get this left-to-right dependency ordering, we perform a -// topological sort of all crates putting the leaves at the right-most -// positions. -pub fn used_crates(tcx: TyCtxt<'_>) -> Vec<CrateNum> { - let mut libs = tcx - .crates(()) - .iter() - .cloned() - .filter_map(|cnum| { - if tcx.dep_kind(cnum).macros_only() { - return None; - } - Some(cnum) - }) - .collect::<Vec<_>>(); - let mut ordering = tcx.postorder_cnums(()).to_owned(); - ordering.reverse(); - libs.sort_by_cached_key(|&a| ordering.iter().position(|x| *x == a)); - libs -} |
