Skip to content

Commit cb1c0c6

Browse files
committed
Don't subst an adt def
1 parent f9b2e3c commit cb1c0c6

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::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};
@@ -2776,7 +2776,7 @@ impl ClashingExternDeclarations {
27762776
let mut ty = ty;
27772777
loop {
27782778
if let ty::Adt(def, substs) = *ty.kind() {
2779-
let is_transparent = def.subst(tcx, substs).repr().transparent();
2779+
let is_transparent = def.repr().transparent();
27802780
let is_non_null = crate::types::nonnull_optimization_guaranteed(tcx, def);
27812781
debug!(
27822782
"non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}",
@@ -2836,11 +2836,7 @@ impl ClashingExternDeclarations {
28362836

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

0 commit comments

Comments
 (0)