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