about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorsurechen <chenshuo17@huawei.com>2024-09-27 16:37:43 +0800
committersurechen <chenshuo17@huawei.com>2024-09-27 16:37:43 +0800
commit0bf928968bf442ba0e4d50e8d716edf2dd43cbbc (patch)
tree4cfb4ff817a825758d9b7239b77043f0cd976c03 /compiler
parent1b5aa96d6016bafe50e071b45d4d2e3c90fd766f (diff)
downloadrust-0bf928968bf442ba0e4d50e8d716edf2dd43cbbc.tar.gz
rust-0bf928968bf442ba0e4d50e8d716edf2dd43cbbc.zip
Make clashing_extern_declarations considering generic args for ADT field
fixes #130851
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/foreign_modules.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_lint/src/foreign_modules.rs b/compiler/rustc_lint/src/foreign_modules.rs
index 1ead377607f..816882962be 100644
--- a/compiler/rustc_lint/src/foreign_modules.rs
+++ b/compiler/rustc_lint/src/foreign_modules.rs
@@ -280,7 +280,7 @@ fn structurally_same_type_impl<'tcx>(
 
         ensure_sufficient_stack(|| {
             match (a.kind(), b.kind()) {
-                (&Adt(a_def, _), &Adt(b_def, _)) => {
+                (&Adt(a_def, a_gen_args), &Adt(b_def, b_gen_args)) => {
                     // Only `repr(C)` types can be compared structurally.
                     if !(a_def.repr().c() && b_def.repr().c()) {
                         return false;
@@ -304,8 +304,8 @@ fn structurally_same_type_impl<'tcx>(
                                 seen_types,
                                 tcx,
                                 param_env,
-                                tcx.type_of(a_did).instantiate_identity(),
-                                tcx.type_of(b_did).instantiate_identity(),
+                                tcx.type_of(a_did).instantiate(tcx, a_gen_args),
+                                tcx.type_of(b_did).instantiate(tcx, b_gen_args),
                                 ckind,
                             )
                         },