Apply nits

This commit is contained in:
Michael Goulet 2024-05-13 14:34:47 -04:00
parent 3bcdf3058e
commit fa84018c2e
17 changed files with 73 additions and 137 deletions

View file

@ -232,7 +232,7 @@ pub(super) fn poly_project_and_unify_term<'cx, 'tcx>(
/// ```
/// If successful, this may result in additional obligations.
///
/// See [poly_project_and_unify_type] for an explanation of the return value.
/// See [poly_project_and_unify_term] for an explanation of the return value.
#[instrument(level = "debug", skip(selcx))]
fn project_and_unify_term<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
@ -395,7 +395,7 @@ pub(super) fn opt_normalize_projection_term<'a, 'b, 'tcx>(
debug!("recur cache");
return Err(InProgress);
}
Err(ProjectionCacheEntry::NormalizedTy { ty, complete: _ }) => {
Err(ProjectionCacheEntry::NormalizedTerm { ty, complete: _ }) => {
// This is the hottest path in this function.
//
// If we find the value in the cache, then return it along
@ -522,7 +522,7 @@ fn normalize_to_error<'a, 'tcx>(
| ty::AliasTermKind::InherentTy
| ty::AliasTermKind::OpaqueTy
| ty::AliasTermKind::WeakTy => selcx.infcx.next_ty_var(cause.span).into(),
ty::AliasTermKind::UnevaluatedConst => selcx
ty::AliasTermKind::UnevaluatedConst | ty::AliasTermKind::ProjectionConst => selcx
.infcx
.next_const_var(
selcx

View file

@ -437,31 +437,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
/// Pushes the obligations required for an alias (except inherent) to be WF
/// into `self.out`.
fn compute_alias_ty(&mut self, data: ty::AliasTy<'tcx>) {
// A projection is well-formed if
//
// (a) its predicates hold (*)
// (b) its args are wf
//
// (*) The predicates of an associated type include the predicates of
// the trait that it's contained in. For example, given
//
// trait A<T>: Clone {
// type X where T: Copy;
// }
//
// The predicates of `<() as A<i32>>::X` are:
// [
// `(): Sized`
// `(): Clone`
// `(): A<i32>`
// `i32: Sized`
// `i32: Clone`
// `i32: Copy`
// ]
let obligations = self.nominal_obligations(data.def_id, data.args);
self.out.extend(obligations);
self.compute_projection_args(data.args);
self.compute_alias_term(data.into());
}
/// Pushes the obligations required for an alias (except inherent) to be WF