about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-05-11 00:09:36 +0900
committerGitHub <noreply@github.com>2022-05-11 00:09:36 +0900
commitc5f2c4476e1c72315e7bf405a2e15b5c9489c001 (patch)
treebd5ff433042939d64d96f830eec6cc09976d0753
parentd34915f691ca78596f57fcb73bbc9de08675d65a (diff)
parentcb1c0c65165f3f881380131ec24c08e32390a7ea (diff)
downloadrust-c5f2c4476e1c72315e7bf405a2e15b5c9489c001.tar.gz
rust-c5f2c4476e1c72315e7bf405a2e15b5c9489c001.zip
Rollup merge of #96882 - jackh726:no-subst, r=oli-obk
Don't subst an AdtDef with its own substs
-rw-r--r--compiler/rustc_lint/src/builtin.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 5a985be08a1..4141d952683 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -41,7 +41,7 @@ use rustc_index::vec::Idx;
 use rustc_middle::lint::{in_external_macro, LintDiagnosticBuilder};
 use rustc_middle::ty::layout::{LayoutError, LayoutOf};
 use rustc_middle::ty::print::with_no_trimmed_paths;
-use rustc_middle::ty::subst::{GenericArgKind, Subst};
+use rustc_middle::ty::subst::GenericArgKind;
 use rustc_middle::ty::Instance;
 use rustc_middle::ty::{self, Ty, TyCtxt};
 use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
@@ -2777,7 +2777,7 @@ impl ClashingExternDeclarations {
                 let mut ty = ty;
                 loop {
                     if let ty::Adt(def, substs) = *ty.kind() {
-                        let is_transparent = def.subst(tcx, substs).repr().transparent();
+                        let is_transparent = def.repr().transparent();
                         let is_non_null = crate::types::nonnull_optimization_guaranteed(tcx, def);
                         debug!(
                             "non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}",
@@ -2837,11 +2837,7 @@ impl ClashingExternDeclarations {
 
                 ensure_sufficient_stack(|| {
                     match (a_kind, b_kind) {
-                        (Adt(a_def, a_substs), Adt(b_def, b_substs)) => {
-                            let a = a.subst(cx.tcx, a_substs);
-                            let b = b.subst(cx.tcx, b_substs);
-                            debug!("Comparing {:?} and {:?}", a, b);
-
+                        (Adt(a_def, _), Adt(b_def, _)) => {
                             // We can immediately rule out these types as structurally same if
                             // their layouts differ.
                             match compare_layouts(a, b) {