1
Fork 0

Don't elaborate effects predicates into bounds list unless we're actually collecting implied bounds, not super bounds

This commit is contained in:
Michael Goulet 2024-09-21 11:36:44 -04:00
parent a846d55d46
commit 4f3d06f5aa
4 changed files with 9 additions and 15 deletions

View file

@ -9,6 +9,8 @@ use rustc_middle::ty::{self, Ty, TyCtxt, Upcast};
use rustc_span::def_id::DefId;
use rustc_span::Span;
use crate::hir_ty_lowering::OnlySelfBounds;
/// Collects together a list of type bounds. These lists of bounds occur in many places
/// in Rust's syntax:
///
@ -50,6 +52,7 @@ impl<'tcx> Bounds<'tcx> {
span: Span,
polarity: ty::PredicatePolarity,
constness: ty::BoundConstness,
only_self_bounds: OnlySelfBounds,
) {
let clause = (
bound_trait_ref
@ -66,7 +69,10 @@ impl<'tcx> Bounds<'tcx> {
self.clauses.push(clause);
}
if !tcx.features().effects {
// FIXME(effects): Lift this out of `push_trait_bound`, and move it somewhere else.
// Perhaps moving this into `lower_poly_trait_ref`, just like we lower associated
// type bounds.
if !tcx.features().effects || only_self_bounds.0 {
return;
}
// For `T: ~const Tr` or `T: const Tr`, we need to add an additional bound on the

View file

@ -719,6 +719,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
span,
polarity,
constness,
only_self_bounds,
);
let mut dup_constraints = FxIndexMap::default();