Skip to content

Commit b941485

Browse files
committed
remove obligation dedup
1 parent 46171fa commit b941485

File tree

1 file changed

+0
-22
lines changed
  • compiler/rustc_trait_selection/src/traits/select

1 file changed

+0
-22
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

-22
Original file line numberDiff line numberDiff line change
@@ -2328,28 +2328,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
23282328
});
23292329
}
23302330

2331-
// We are performing deduplication here to avoid exponential blowups
2332-
// (#38528) from happening, but the real cause of the duplication is
2333-
// unknown. What we know is that the deduplication avoids exponential
2334-
// amount of predicates being propagated when processing deeply nested
2335-
// types.
2336-
//
2337-
// This code is hot enough that it's worth avoiding the allocation
2338-
// required for the FxHashSet when possible. Special-casing lengths 0,
2339-
// 1 and 2 covers roughly 75-80% of the cases.
2340-
if obligations.len() <= 1 {
2341-
// No possibility of duplicates.
2342-
} else if obligations.len() == 2 {
2343-
// Only two elements. Drop the second if they are equal.
2344-
if obligations[0] == obligations[1] {
2345-
obligations.truncate(1);
2346-
}
2347-
} else {
2348-
// Three or more elements. Use a general deduplication process.
2349-
let mut seen = FxHashSet::default();
2350-
obligations.retain(|i| seen.insert(i.clone()));
2351-
}
2352-
23532331
obligations
23542332
}
23552333
}

0 commit comments

Comments
 (0)