@@ -145,15 +145,28 @@ impl<'tcx> ProjectionCandidateSet<'tcx> {
145
145
}
146
146
}
147
147
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)
149
151
/// Result<
150
152
/// Result<Option<Vec<PredicateObligation<'tcx>>>, InProgress>,
151
153
/// MismatchedProjectionTypes<'tcx>,
152
154
/// >
155
+ /// ```
153
156
pub ( 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.
154
161
Holds ( Vec < PredicateObligation < ' tcx > > ) ,
162
+ /// The projection cannot be normalized due to ambiguity. Resolving some
163
+ /// inference variables in the projection may fix this.
155
164
FailedNormalization ,
165
+ /// The project cannot be normalized because `poly_project_and_unify_type`
166
+ /// is called recursively while normalizing the same projection.
156
167
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.
157
170
MismatchedProjectionTypes ( MismatchedProjectionTypes < ' tcx > ) ,
158
171
}
159
172
@@ -163,19 +176,6 @@ pub(super) enum ProjectAndUnifyResult<'tcx> {
163
176
/// ```
164
177
/// If successful, this may result in additional obligations. Also returns
165
178
/// 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.
179
179
#[ instrument( level = "debug" , skip( selcx) ) ]
180
180
pub ( super ) fn poly_project_and_unify_type < ' cx , ' tcx > (
181
181
selcx : & mut SelectionContext < ' cx , ' tcx > ,
0 commit comments