-
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
Remove variances_of
on RPITIT GATs, remove its one use-case
#113427
Conversation
@@ -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 => { |
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.
@@ -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 comment
The 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.
@@ -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 comment
The 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.
r=me with CI green @bors rollup |
variances_of
on RPITIT gats, remove its one use-casevariances_of
on RPITIT GATs, remove its one use-case
@bors r=spastorino |
…itit-gat, r=spastorino Remove `variances_of` on RPITIT GATs, remove its one use-case It doesn't make sense to implement variances on a GAT anyways, since we don't relate GATs with variance: https://github.com/rust-lang/rust/blob/85bf07972a1041b9e25393b803d0e006bec3eaaf/compiler/rustc_middle/src/ty/relate.rs#L569-L579 r? `@spastorino`
@bors rollup |
…itit-gat, r=spastorino Remove `variances_of` on RPITIT GATs, remove its one use-case It doesn't make sense to implement variances on a GAT anyways, since we don't relate GATs with variance: https://github.com/rust-lang/rust/blob/85bf07972a1041b9e25393b803d0e006bec3eaaf/compiler/rustc_middle/src/ty/relate.rs#L569-L579 r? `@spastorino`
…mpiler-errors Rollup of 8 pull requests Successful merges: - rust-lang#113413 (Add needs-triage to all new issues) - rust-lang#113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions) - rust-lang#113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case) - rust-lang#113441 (miri: check that assignments do not self-overlap) - rust-lang#113453 (Remove unused from_method from rustc_on_unimplemented) - rust-lang#113456 (Avoid calling report_forbidden_specialization for RPITITs) - rust-lang#113466 (Update cargo) - rust-lang#113467 (Fix comment of `fn_can_unwind`) r? `@ghost` `@rustbot` modify labels: rollup
It doesn't make sense to implement variances on a GAT anyways, since we don't relate GATs with variance:
rust/compiler/rustc_middle/src/ty/relate.rs
Lines 569 to 579 in 85bf079
r? @spastorino