-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove variances_of
on RPITIT GATs, remove its one use-case
#113427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ use rustc_arena::DroplessArena; | |
use rustc_hir::def::DefKind; | ||
use rustc_hir::def_id::{DefId, LocalDefId}; | ||
use rustc_middle::query::Providers; | ||
use rustc_middle::ty::{self, CrateVariancesMap, ImplTraitInTraitData, SubstsRef, Ty, TyCtxt}; | ||
use rustc_middle::ty::{self, CrateVariancesMap, SubstsRef, Ty, TyCtxt}; | ||
use rustc_middle::ty::{TypeSuperVisitable, TypeVisitable}; | ||
use std::ops::ControlFlow; | ||
|
||
|
@@ -59,13 +59,6 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Variance] { | |
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder => { | ||
return variance_of_opaque(tcx, item_def_id); | ||
} | ||
DefKind::AssocTy => { | ||
if let Some(ImplTraitInTraitData::Trait { .. }) = | ||
tcx.opt_rpitit_info(item_def_id.to_def_id()) | ||
{ | ||
return variance_of_opaque(tcx, item_def_id); | ||
} | ||
} | ||
_ => {} | ||
} | ||
|
||
|
@@ -125,7 +118,8 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc | |
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) check whether this is necessary | ||
// at all for RPITITs. | ||
ty::Alias(_, ty::AliasTy { def_id, substs, .. }) | ||
if self.tcx.is_impl_trait_in_trait(*def_id) => | ||
if self.tcx.is_impl_trait_in_trait(*def_id) | ||
&& !self.tcx.lower_impl_trait_in_trait_to_assoc_ty() => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the new lowering scheme, we should never need to consider the variances on a RPITIT GAT. |
||
{ | ||
self.visit_opaque(*def_id, substs) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -473,17 +473,6 @@ where | |
} | ||
} | ||
|
||
ty::Alias(ty::Projection, proj) if self.tcx.is_impl_trait_in_trait(proj.def_id) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the new lowering scheme, we should never need to consider the variances of a RPITIT GAT. |
||
// Skip lifetime parameters that are not captures. | ||
let variances = self.tcx.variances_of(proj.def_id); | ||
|
||
for (v, s) in std::iter::zip(variances, proj.substs.iter()) { | ||
if *v != ty::Variance::Bivariant { | ||
s.visit_with(self); | ||
} | ||
} | ||
} | ||
|
||
_ => { | ||
ty.super_visit_with(self); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unreachable given the deleted code below.