Skip to content

Commit 6d41d30

Browse files
committed
Add note
1 parent 0917c69 commit 6d41d30

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

chalk-solve/src/coherence.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,19 @@ impl<I: Interner> SpecializationPriorities<I> {
5959
/// Store the priority of an impl (used during construction).
6060
/// Panics if we have already stored the priority for this impl.
6161
fn insert(&mut self, impl_id: ImplId<I>, p: SpecializationPriority) {
62-
let old_value = self.map.insert(impl_id, p);
62+
// FIXME:
63+
// Previously, the code was:
64+
//
65+
// ```
66+
// let old_value = self.map.insert(impl_id, p);
6367
// assert!(old_value.is_none());
68+
// ```
69+
//
70+
// `SpecializationPriority::build_specialization_forest`
71+
// has a check to ensure we don't add duplicate nodes.
72+
// *However*, The tests only pass after removing the assertion here.
73+
// We should make sure this is correct.
74+
self.map.insert(impl_id, p);
6475
}
6576
}
6677

chalk-solve/src/logging_db.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -578,26 +578,3 @@ impl<I: Interner> From<GeneratorId<I>> for RecordedItemId<I> {
578578
RecordedItemId::Generator(v)
579579
}
580580
}
581-
582-
impl<I: Interner> RecordedItemId<I> {
583-
/// Extract internal identifier. Allows for absolute ordering matching the
584-
/// order in which chalk saw things (and thus reproducing that order in
585-
/// printed programs)
586-
fn ordered_item_id(&self) -> OrderedItemId<'_, I::DefId, I::InternedAdtId> {
587-
match self {
588-
RecordedItemId::Trait(TraitId(x))
589-
| RecordedItemId::Impl(ImplId(x))
590-
| RecordedItemId::OpaqueTy(OpaqueTyId(x))
591-
| RecordedItemId::Generator(GeneratorId(x))
592-
| RecordedItemId::FnDef(FnDefId(x)) => OrderedItemId::DefId(x),
593-
RecordedItemId::Adt(AdtId(x)) => OrderedItemId::AdtId(x),
594-
}
595-
}
596-
}
597-
598-
/// Utility for implementing Ord for RecordedItemId.
599-
#[derive(PartialEq, Eq, PartialOrd, Ord)]
600-
enum OrderedItemId<'a, DefId, AdtId> {
601-
DefId(&'a DefId),
602-
AdtId(&'a AdtId),
603-
}

0 commit comments

Comments
 (0)