@@ -145,15 +145,28 @@ impl<'tcx> ProjectionCandidateSet<'tcx> {
145145 }
146146}
147147
148- /// Takes the place of a
148+ /// States returned from `poly_project_and_unify_type`. Takes the place
149+ /// of the old return type, which was:
150+ /// ```ignore (not-rust)
149151/// Result<
150152/// Result<Option<Vec<PredicateObligation<'tcx>>>, InProgress>,
151153/// MismatchedProjectionTypes<'tcx>,
152154/// >
155+ /// ```
153156pub ( super ) enum ProjectAndUnifyResult < ' tcx > {
157+ /// The projection bound holds subject to the given obligations. If the
158+ /// projection cannot be normalized because the required trait bound does
159+ /// not hold, this is returned, with `obligations` being a predicate that
160+ /// cannot be proven.
154161 Holds ( Vec < PredicateObligation < ' tcx > > ) ,
162+ /// The projection cannot be normalized due to ambiguity. Resolving some
163+ /// inference variables in the projection may fix this.
155164 FailedNormalization ,
165+ /// The project cannot be normalized because `poly_project_and_unify_type`
166+ /// is called recursively while normalizing the same projection.
156167 Recursive ,
168+ // the projection can be normalized, but is not equal to the expected type.
169+ // Returns the type error that arose from the mismatch.
157170 MismatchedProjectionTypes ( MismatchedProjectionTypes < ' tcx > ) ,
158171}
159172
@@ -163,19 +176,6 @@ pub(super) enum ProjectAndUnifyResult<'tcx> {
163176/// ```
164177/// If successful, this may result in additional obligations. Also returns
165178/// the projection cache key used to track these additional obligations.
166- ///
167- /// ## Returns
168- ///
169- /// - `Err(_)`: the projection can be normalized, but is not equal to the
170- /// expected type.
171- /// - `Ok(Err(InProgress))`: this is called recursively while normalizing
172- /// the same projection.
173- /// - `Ok(Ok(None))`: The projection cannot be normalized due to ambiguity
174- /// (resolving some inference variables in the projection may fix this).
175- /// - `Ok(Ok(Some(obligations)))`: The projection bound holds subject to
176- /// the given obligations. If the projection cannot be normalized because
177- /// the required trait bound doesn't hold this returned with `obligations`
178- /// being a predicate that cannot be proven.
179179#[ instrument( level = "debug" , skip( selcx) ) ]
180180pub ( super ) fn poly_project_and_unify_type < ' cx , ' tcx > (
181181 selcx : & mut SelectionContext < ' cx , ' tcx > ,
0 commit comments