@@ -134,7 +134,6 @@ impl ClashingExternDeclarations {
134
134
ty:: TypingEnv :: non_body_analysis ( tcx, this_fi. owner_id ) ,
135
135
existing_decl_ty,
136
136
this_decl_ty,
137
- types:: CItemKind :: Declaration ,
138
137
) {
139
138
let orig = name_of_extern_decl ( tcx, existing_did) ;
140
139
@@ -208,10 +207,9 @@ fn structurally_same_type<'tcx>(
208
207
typing_env : ty:: TypingEnv < ' tcx > ,
209
208
a : Ty < ' tcx > ,
210
209
b : Ty < ' tcx > ,
211
- ckind : types:: CItemKind ,
212
210
) -> bool {
213
211
let mut seen_types = UnordSet :: default ( ) ;
214
- let result = structurally_same_type_impl ( & mut seen_types, tcx, typing_env, a, b, ckind ) ;
212
+ let result = structurally_same_type_impl ( & mut seen_types, tcx, typing_env, a, b) ;
215
213
if cfg ! ( debug_assertions) && result {
216
214
// Sanity-check: must have same ABI, size and alignment.
217
215
// `extern` blocks cannot be generic, so we'll always get a layout here.
@@ -230,7 +228,6 @@ fn structurally_same_type_impl<'tcx>(
230
228
typing_env : ty:: TypingEnv < ' tcx > ,
231
229
a : Ty < ' tcx > ,
232
230
b : Ty < ' tcx > ,
233
- ckind : types:: CItemKind ,
234
231
) -> bool {
235
232
debug ! ( "structurally_same_type_impl(tcx, a = {:?}, b = {:?})" , a, b) ;
236
233
@@ -306,33 +303,26 @@ fn structurally_same_type_impl<'tcx>(
306
303
typing_env,
307
304
tcx. type_of ( a_did) . instantiate ( tcx, a_gen_args) ,
308
305
tcx. type_of ( b_did) . instantiate ( tcx, b_gen_args) ,
309
- ckind,
310
306
)
311
307
} ,
312
308
)
313
309
}
314
310
( Array ( a_ty, a_len) , Array ( b_ty, b_len) ) => {
315
311
// For arrays, we also check the length.
316
312
a_len == b_len
317
- && structurally_same_type_impl (
318
- seen_types, tcx, typing_env, * a_ty, * b_ty, ckind,
319
- )
313
+ && structurally_same_type_impl ( seen_types, tcx, typing_env, * a_ty, * b_ty)
320
314
}
321
315
( Slice ( a_ty) , Slice ( b_ty) ) => {
322
- structurally_same_type_impl ( seen_types, tcx, typing_env, * a_ty, * b_ty, ckind )
316
+ structurally_same_type_impl ( seen_types, tcx, typing_env, * a_ty, * b_ty)
323
317
}
324
318
( RawPtr ( a_ty, a_mutbl) , RawPtr ( b_ty, b_mutbl) ) => {
325
319
a_mutbl == b_mutbl
326
- && structurally_same_type_impl (
327
- seen_types, tcx, typing_env, * a_ty, * b_ty, ckind,
328
- )
320
+ && structurally_same_type_impl ( seen_types, tcx, typing_env, * a_ty, * b_ty)
329
321
}
330
322
( Ref ( _a_region, a_ty, a_mut) , Ref ( _b_region, b_ty, b_mut) ) => {
331
323
// For structural sameness, we don't need the region to be same.
332
324
a_mut == b_mut
333
- && structurally_same_type_impl (
334
- seen_types, tcx, typing_env, * a_ty, * b_ty, ckind,
335
- )
325
+ && structurally_same_type_impl ( seen_types, tcx, typing_env, * a_ty, * b_ty)
336
326
}
337
327
( FnDef ( ..) , FnDef ( ..) ) => {
338
328
let a_poly_sig = a. fn_sig ( tcx) ;
@@ -346,15 +336,14 @@ fn structurally_same_type_impl<'tcx>(
346
336
( a_sig. abi , a_sig. safety , a_sig. c_variadic )
347
337
== ( b_sig. abi , b_sig. safety , b_sig. c_variadic )
348
338
&& a_sig. inputs ( ) . iter ( ) . eq_by ( b_sig. inputs ( ) . iter ( ) , |a, b| {
349
- structurally_same_type_impl ( seen_types, tcx, typing_env, * a, * b, ckind )
339
+ structurally_same_type_impl ( seen_types, tcx, typing_env, * a, * b)
350
340
} )
351
341
&& structurally_same_type_impl (
352
342
seen_types,
353
343
tcx,
354
344
typing_env,
355
345
a_sig. output ( ) ,
356
346
b_sig. output ( ) ,
357
- ckind,
358
347
)
359
348
}
360
349
( Tuple ( ..) , Tuple ( ..) ) => {
@@ -379,14 +368,14 @@ fn structurally_same_type_impl<'tcx>(
379
368
// An Adt and a primitive or pointer type. This can be FFI-safe if non-null
380
369
// enum layout optimisation is being applied.
381
370
( Adt ( ..) , _) if is_primitive_or_pointer ( b) => {
382
- if let Some ( a_inner) = types:: repr_nullable_ptr ( tcx, typing_env, a, ckind ) {
371
+ if let Some ( a_inner) = types:: repr_nullable_ptr ( tcx, typing_env, a) {
383
372
a_inner == b
384
373
} else {
385
374
false
386
375
}
387
376
}
388
377
( _, Adt ( ..) ) if is_primitive_or_pointer ( a) => {
389
- if let Some ( b_inner) = types:: repr_nullable_ptr ( tcx, typing_env, b, ckind ) {
378
+ if let Some ( b_inner) = types:: repr_nullable_ptr ( tcx, typing_env, b) {
390
379
b_inner == a
391
380
} else {
392
381
false
0 commit comments