Skip to content

Commit 9788f59

Browse files
committed
Update comment about where Ty:
We no longer move trait predicates where the self ty is a ty param to "the bounds of a ty param".
1 parent 10d7e5f commit 9788f59

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,16 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
267267
match predicate.kind {
268268
hir::WherePredicateKind::BoundPredicate(bound_pred) => {
269269
let ty = icx.lowerer().lower_ty_maybe_return_type_notation(bound_pred.bounded_ty);
270-
271270
let bound_vars = tcx.late_bound_vars(predicate.hir_id);
272-
// Keep the type around in a dummy predicate, in case of no bounds.
273-
// That way, `where Ty:` is not a complete noop (see #53696) and `Ty`
274-
// is still checked for WF.
271+
272+
// This is a `where Ty:` (sic!).
275273
if bound_pred.bounds.is_empty() {
276274
if let ty::Param(_) = ty.kind() {
277-
// This is a `where T:`, which can be in the HIR from the
278-
// transformation that moves `?Sized` to `T`'s declaration.
279-
// We can skip the predicate because type parameters are
280-
// trivially WF, but also we *should*, to avoid exposing
281-
// users who never wrote `where Type:,` themselves, to
282-
// compiler/tooling bugs from not handling WF predicates.
275+
// We can skip the predicate because type parameters are trivially WF.
283276
} else {
277+
// Keep the type around in a dummy predicate. That way, it's not a complete
278+
// noop (see #53696) and `Ty` is still checked for WF.
279+
284280
let span = bound_pred.bounded_ty.span;
285281
let predicate = ty::Binder::bind_with_vars(
286282
ty::ClauseKind::WellFormed(ty.into()),

0 commit comments

Comments
 (0)