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".
This commit is contained in:
parent
10d7e5faf2
commit
9788f59bbf
1 changed files with 6 additions and 10 deletions
|
|
@ -267,20 +267,16 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
|
|||
match predicate.kind {
|
||||
hir::WherePredicateKind::BoundPredicate(bound_pred) => {
|
||||
let ty = icx.lowerer().lower_ty_maybe_return_type_notation(bound_pred.bounded_ty);
|
||||
|
||||
let bound_vars = tcx.late_bound_vars(predicate.hir_id);
|
||||
// Keep the type around in a dummy predicate, in case of no bounds.
|
||||
// That way, `where Ty:` is not a complete noop (see #53696) and `Ty`
|
||||
// is still checked for WF.
|
||||
|
||||
// This is a `where Ty:` (sic!).
|
||||
if bound_pred.bounds.is_empty() {
|
||||
if let ty::Param(_) = ty.kind() {
|
||||
// This is a `where T:`, which can be in the HIR from the
|
||||
// transformation that moves `?Sized` to `T`'s declaration.
|
||||
// We can skip the predicate because type parameters are
|
||||
// trivially WF, but also we *should*, to avoid exposing
|
||||
// users who never wrote `where Type:,` themselves, to
|
||||
// compiler/tooling bugs from not handling WF predicates.
|
||||
// We can skip the predicate because type parameters are trivially WF.
|
||||
} else {
|
||||
// Keep the type around in a dummy predicate. That way, it's not a complete
|
||||
// noop (see #53696) and `Ty` is still checked for WF.
|
||||
|
||||
let span = bound_pred.bounded_ty.span;
|
||||
let predicate = ty::Binder::bind_with_vars(
|
||||
ty::ClauseKind::WellFormed(ty.into()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue