about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-07-20 11:29:39 +0530
committerGitHub <noreply@github.com>2022-07-20 11:29:39 +0530
commitf02bbbcba6faf0fddce6ded97dea6f934d0f642b (patch)
treea2a2fa2a27cf79a57ea7987dae2bba2cfae1775a /compiler
parent80395679cb123099ef53f94b9d514729720e136c (diff)
parent0065929599d276ce756a55948e8316615be1e7ec (diff)
downloadrust-f02bbbcba6faf0fddce6ded97dea6f934d0f642b.tar.gz
rust-f02bbbcba6faf0fddce6ded97dea6f934d0f642b.zip
Rollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errors
Erase regions before comparing signatures of foreign fns.

Fixes https://github.com/rust-lang/rust/issues/99276

The version with explicit lifetimes is probably tracked in another bug, but I could not find it.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/builtin.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index a0472f98d72..9e4dc702f07 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -2858,9 +2858,10 @@ impl ClashingExternDeclarations {
                             let a_poly_sig = a.fn_sig(tcx);
                             let b_poly_sig = b.fn_sig(tcx);
 
-                            // As we don't compare regions, skip_binder is fine.
-                            let a_sig = a_poly_sig.skip_binder();
-                            let b_sig = b_poly_sig.skip_binder();
+                            // We don't compare regions, but leaving bound regions around ICEs, so
+                            // we erase them.
+                            let a_sig = tcx.erase_late_bound_regions(a_poly_sig);
+                            let b_sig = tcx.erase_late_bound_regions(b_poly_sig);
 
                             (a_sig.abi, a_sig.unsafety, a_sig.c_variadic)
                                 == (b_sig.abi, b_sig.unsafety, b_sig.c_variadic)