Skip to content

Commit ca75834

Browse files
committed
Merge match and if
1 parent 5c0c8bd commit ca75834

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

compiler/rustc_hir_typeck/src/opaque_types.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,34 +128,25 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
128128
}
129129
}
130130

131-
if let UsageKind::HasDefiningUse(first_use) = usage_kind {
131+
if let UsageKind::HasDefiningUse(ty) = usage_kind {
132132
for &(opaque_type_key, hidden_type) in opaque_types {
133133
if opaque_type_key.def_id != def_id {
134134
continue;
135135
}
136136

137-
let expected =
138-
EarlyBinder::bind(first_use.ty).instantiate(tcx, opaque_type_key.args);
137+
let expected = EarlyBinder::bind(ty.ty).instantiate(tcx, opaque_type_key.args);
139138
self.demand_eqtype(hidden_type.span, expected, hidden_type.ty);
140139
}
141-
}
142140

143-
match usage_kind {
144-
UsageKind::HasDefiningUse(hidden_type) => {
145-
let prev = self
146-
.typeck_results
147-
.borrow_mut()
148-
.concrete_opaque_types
149-
.insert(def_id, hidden_type);
141+
let prev =
142+
self.typeck_results.borrow_mut().concrete_opaque_types.insert(def_id, ty);
150143

151-
// We do want to insert opaque types the first pass, because
152-
// we want to equate them. So, the second pass (where we
153-
// report errors) may have a hidden type inserted.
154-
if first_pass {
155-
assert!(prev.is_none());
156-
}
144+
// We do want to insert opaque types the first pass, because
145+
// we want to equate them. So, the second pass (where we
146+
// report errors) may have a hidden type inserted.
147+
if first_pass {
148+
assert!(prev.is_none());
157149
}
158-
_ => {}
159150
}
160151

161152
// If this the first pass (`try_handle_opaque_type_uses_next`),

0 commit comments

Comments
 (0)