Avoid double hashset lookup.

Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
This commit is contained in:
jumbatm 2020-08-16 17:14:09 +10:00 committed by jumbatm
parent 6c57de1166
commit 7708abbbef

View file

@ -2161,12 +2161,11 @@ impl ClashingExternDeclarations {
ckind: CItemKind,
) -> bool {
debug!("structurally_same_type_impl(cx, a = {:?}, b = {:?})", a, b);
if seen_types.contains(&(a, b)) {
if !seen_types.insert((a, b)) {
// We've encountered a cycle. There's no point going any further -- the types are
// structurally the same.
return true;
}
seen_types.insert((a, b));
let tcx = cx.tcx;
if a == b || rustc_middle::ty::TyS::same_type(a, b) {
// All nominally-same types are structurally same, too.