@@ -193,9 +193,9 @@ pub(crate) fn type_check<'mir, 'tcx>(
193
193
let opaque_type_values =
194
194
infcx. inner . borrow_mut ( ) . opaque_type_storage . take_opaque_types ( ) ;
195
195
196
- let opaque_type_values = opaque_type_values
196
+ opaque_type_values
197
197
. into_iter ( )
198
- . filter_map ( |( opaque_type_key, decl) | {
198
+ . map ( |( opaque_type_key, decl) | {
199
199
cx. fully_perform_op (
200
200
Locations :: All ( body. span ) ,
201
201
ConstraintCategory :: OpaqueType ,
@@ -226,43 +226,10 @@ pub(crate) fn type_check<'mir, 'tcx>(
226
226
) ;
227
227
hidden_type = infcx. tcx . ty_error ( ) ;
228
228
}
229
- let concrete_is_opaque = if let ty:: Opaque ( def_id, _) = hidden_type. kind ( ) {
230
- * def_id == opaque_type_key. def_id
231
- } else {
232
- false
233
- } ;
234
229
235
- if concrete_is_opaque {
236
- // We're using an opaque `impl Trait` type without
237
- // 'revealing' it. For example, code like this:
238
- //
239
- // type Foo = impl Debug;
240
- // fn foo1() -> Foo { ... }
241
- // fn foo2() -> Foo { foo1() }
242
- //
243
- // In `foo2`, we're not revealing the type of `Foo` - we're
244
- // just treating it as the opaque type.
245
- //
246
- // When this occurs, we do *not* want to try to equate
247
- // the concrete type with the underlying defining type
248
- // of the opaque type - this will always fail, since
249
- // the defining type of an opaque type is always
250
- // some other type (e.g. not itself)
251
- // Essentially, none of the normal obligations apply here -
252
- // we're just passing around some unknown opaque type,
253
- // without actually looking at the underlying type it
254
- // gets 'revealed' into
255
- debug ! (
256
- "eq_opaque_type_and_type: non-defining use of {:?}" ,
257
- opaque_type_key. def_id,
258
- ) ;
259
- None
260
- } else {
261
- Some ( ( opaque_type_key, ( hidden_type, decl. hidden_type . span , decl. origin ) ) )
262
- }
230
+ ( opaque_type_key, ( hidden_type, decl. hidden_type . span , decl. origin ) )
263
231
} )
264
- . collect ( ) ;
265
- opaque_type_values
232
+ . collect ( )
266
233
} ,
267
234
) ;
268
235
0 commit comments