Rollup merge of #96882 - jackh726:no-subst, r=oli-obk
Don't subst an AdtDef with its own substs
This commit is contained in:
commit
c5f2c4476e
@ -41,7 +41,7 @@
|
|||||||
use rustc_middle::lint::{in_external_macro, LintDiagnosticBuilder};
|
use rustc_middle::lint::{in_external_macro, LintDiagnosticBuilder};
|
||||||
use rustc_middle::ty::layout::{LayoutError, LayoutOf};
|
use rustc_middle::ty::layout::{LayoutError, LayoutOf};
|
||||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
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::Instance;
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||||
use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
|
use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
|
||||||
@ -2777,7 +2777,7 @@ fn structurally_same_type_impl<'tcx>(
|
|||||||
let mut ty = ty;
|
let mut ty = ty;
|
||||||
loop {
|
loop {
|
||||||
if let ty::Adt(def, substs) = *ty.kind() {
|
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);
|
let is_non_null = crate::types::nonnull_optimization_guaranteed(tcx, def);
|
||||||
debug!(
|
debug!(
|
||||||
"non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}",
|
"non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}",
|
||||||
@ -2837,11 +2837,7 @@ fn structurally_same_type_impl<'tcx>(
|
|||||||
|
|
||||||
ensure_sufficient_stack(|| {
|
ensure_sufficient_stack(|| {
|
||||||
match (a_kind, b_kind) {
|
match (a_kind, b_kind) {
|
||||||
(Adt(a_def, a_substs), Adt(b_def, b_substs)) => {
|
(Adt(a_def, _), Adt(b_def, _)) => {
|
||||||
let a = a.subst(cx.tcx, a_substs);
|
|
||||||
let b = b.subst(cx.tcx, b_substs);
|
|
||||||
debug!("Comparing {:?} and {:?}", a, b);
|
|
||||||
|
|
||||||
// We can immediately rule out these types as structurally same if
|
// We can immediately rule out these types as structurally same if
|
||||||
// their layouts differ.
|
// their layouts differ.
|
||||||
match compare_layouts(a, b) {
|
match compare_layouts(a, b) {
|
||||||
|
Loading…
Reference in New Issue
Block a user