1
Fork 0

Rollup merge of #126340 - fee1-dead-contrib:fix-predicates_of-comments, r=compiler-errors

Fix outdated predacates_of.rs comments

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
This commit is contained in:
Michael Goulet 2024-06-12 14:26:29 -04:00 committed by GitHub
commit 0d1d6ba58c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -169,12 +169,11 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
predicates.insert((trait_ref.upcast(tcx), tcx.def_span(def_id))); predicates.insert((trait_ref.upcast(tcx), tcx.def_span(def_id)));
} }
// Collect the predicates that were written inline by the user on each // Add implicit predicates that should be treated as if the user has written them,
// type parameter (e.g., `<T: Foo>`). Also add `ConstArgHasType` predicates // including the implicit `T: Sized` for all generic parameters, and `ConstArgHasType`
// for each const parameter. // for const params.
for param in hir_generics.params { for param in hir_generics.params {
match param.kind { match param.kind {
// We already dealt with early bound lifetimes above.
GenericParamKind::Lifetime { .. } => (), GenericParamKind::Lifetime { .. } => (),
GenericParamKind::Type { .. } => { GenericParamKind::Type { .. } => {
let param_ty = icx.lowerer().lower_ty_param(param.hir_id); let param_ty = icx.lowerer().lower_ty_param(param.hir_id);
@ -204,7 +203,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
} }
trace!(?predicates); trace!(?predicates);
// Add in the bounds that appear in the where-clause. // Add inline `<T: Foo>` bounds and bounds in the where clause.
for predicate in hir_generics.predicates { for predicate in hir_generics.predicates {
match predicate { match predicate {
hir::WherePredicate::BoundPredicate(bound_pred) => { hir::WherePredicate::BoundPredicate(bound_pred) => {