@@ -128,31 +128,24 @@ 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 =
146- self . typeck_results . borrow_mut ( ) . hidden_types . insert ( def_id, hidden_type) ;
141+ let prev = self . typeck_results . borrow_mut ( ) . hidden_types . insert ( def_id, ty) ;
147142
148- // We do want to insert opaque types the first pass, because
149- // we want to equate them. So, the second pass (where we
150- // report errors) may have a hidden type inserted.
151- if first_pass {
152- assert ! ( prev. is_none( ) ) ;
153- }
143+ // We do want to insert opaque types the first pass, because
144+ // we want to equate them. So, the second pass (where we
145+ // report errors) may have a hidden type inserted.
146+ if first_pass {
147+ assert ! ( prev. is_none( ) ) ;
154148 }
155- _ => { }
156149 }
157150
158151 // If this the first pass (`try_handle_opaque_type_uses_next`),
0 commit comments