From 9766192545190027b3c087f78cdc7dc5a51f0204 Mon Sep 17 00:00:00 2001 From: lcnr Date: Fri, 27 Sep 2024 13:48:11 +0200 Subject: [PATCH] update outdated comments --- compiler/rustc_type_ir/src/predicate.rs | 4 ++-- compiler/rustc_type_ir/src/predicate_kind.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_type_ir/src/predicate.rs b/compiler/rustc_type_ir/src/predicate.rs index 7e300fe02dca4..76065c10d190e 100644 --- a/compiler/rustc_type_ir/src/predicate.rs +++ b/compiler/rustc_type_ir/src/predicate.rs @@ -668,8 +668,8 @@ impl fmt::Debug for ProjectionPredicate { } } -/// Used by the new solver. Unlike a `ProjectionPredicate` this can only be -/// proven by actually normalizing `alias`. +/// Used by the new solver to normalize an alias. This always expects the `term` to +/// be an unconstrained inference variable which is used as the output. #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] diff --git a/compiler/rustc_type_ir/src/predicate_kind.rs b/compiler/rustc_type_ir/src/predicate_kind.rs index c8a2102858832..55015e6e20232 100644 --- a/compiler/rustc_type_ir/src/predicate_kind.rs +++ b/compiler/rustc_type_ir/src/predicate_kind.rs @@ -74,13 +74,13 @@ pub enum PredicateKind { Ambiguous, /// This should only be used inside of the new solver for `AliasRelate` and expects - /// the `term` to be an unconstrained inference variable. + /// the `term` to be always be an unconstrained inference variable. It is used to + /// normalize `alias` as much as possible. In case the alias is rigid - i.e. it cannot + /// be normalized in the current environment - this constrains `term` to be equal to + /// the alias itself. /// - /// The alias normalizes to `term`. Unlike `Projection`, this always fails if the - /// alias cannot be normalized in the current context. For the rigid alias - /// `T as Trait>::Assoc`, `Projection(::Assoc, ?x)` constrains `?x` - /// to `::Assoc` while `NormalizesTo(::Assoc, ?x)` - /// results in `NoSolution`. + /// It is likely more useful to think of this as a function `normalizes_to(alias)`, + /// whose return value is written into `term`. NormalizesTo(ty::NormalizesTo), /// Separate from `ClauseKind::Projection` which is used for normalization in new solver.