Auto merge of #89016 - lcnr:non_blanket_impls, r=nikomatsakis,michaelwoerister

fix non_blanket_impls iteration order

We sometimes iterate over all `non_blanket_impls`, not sure if this is observable outside
of error messages (i.e. as incremental bugs). This should fix the underlying issue of #86986.

second attempt of #88718

r? `@nikomatsakis`
This commit is contained in:
bors
2021-09-23 15:44:53 +00:00
8 changed files with 43 additions and 118 deletions

View File

@@ -277,7 +277,7 @@ fn attempt_static(tcx: TyCtxt<'_>) -> Option<DependencyList> {
let all_crates_available_as_rlib = tcx
.crates(())
.iter()
.cloned()
.copied()
.filter_map(|cnum| {
if tcx.dep_kind(cnum).macros_only() {
return None;
@@ -291,10 +291,11 @@ fn attempt_static(tcx: TyCtxt<'_>) -> Option<DependencyList> {
// All crates are available in an rlib format, so we're just going to link
// everything in explicitly so long as it's actually required.
let last_crate = tcx.crates(()).len();
let mut ret = (1..last_crate + 1)
.map(|cnum| {
if tcx.dep_kind(CrateNum::new(cnum)) == CrateDepKind::Explicit {
let mut ret = tcx
.crates(())
.iter()
.map(|&cnum| {
if tcx.dep_kind(cnum) == CrateDepKind::Explicit {
Linkage::Static
} else {
Linkage::NotLinked