Skip to content

Commit c5f2c44

Browse files
authored
Rollup merge of rust-lang#96882 - jackh726:no-subst, r=oli-obk
Don't subst an AdtDef with its own substs
2 parents d34915f + cb1c0c6 commit c5f2c44

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

compiler/rustc_lint/src/builtin.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use rustc_index::vec::Idx;
4141
use rustc_middle::lint::{in_external_macro, LintDiagnosticBuilder};
4242
use rustc_middle::ty::layout::{LayoutError, LayoutOf};
4343
use rustc_middle::ty::print::with_no_trimmed_paths;
44-
use rustc_middle::ty::subst::{GenericArgKind, Subst};
44+
use rustc_middle::ty::subst::GenericArgKind;
4545
use rustc_middle::ty::Instance;
4646
use rustc_middle::ty::{self, Ty, TyCtxt};
4747
use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
@@ -2777,7 +2777,7 @@ impl ClashingExternDeclarations {
27772777
let mut ty = ty;
27782778
loop {
27792779
if let ty::Adt(def, substs) = *ty.kind() {
2780-
let is_transparent = def.subst(tcx, substs).repr().transparent();
2780+
let is_transparent = def.repr().transparent();
27812781
let is_non_null = crate::types::nonnull_optimization_guaranteed(tcx, def);
27822782
debug!(
27832783
"non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}",
@@ -2837,11 +2837,7 @@ impl ClashingExternDeclarations {
28372837

28382838
ensure_sufficient_stack(|| {
28392839
match (a_kind, b_kind) {
2840-
(Adt(a_def, a_substs), Adt(b_def, b_substs)) => {
2841-
let a = a.subst(cx.tcx, a_substs);
2842-
let b = b.subst(cx.tcx, b_substs);
2843-
debug!("Comparing {:?} and {:?}", a, b);
2844-
2840+
(Adt(a_def, _), Adt(b_def, _)) => {
28452841
// We can immediately rule out these types as structurally same if
28462842
// their layouts differ.
28472843
match compare_layouts(a, b) {

0 commit comments

Comments
 (0)