diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-06-01 23:36:50 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-01 23:36:50 +0900 |
| commit | 2f99f1b3a48eb03221c56681c0ed8252f04c9df4 (patch) | |
| tree | 556eec1b85d3f8af5b2d6b83a1b6f4183dacb60c | |
| parent | e1d2e65463e9bc5b75f92209a9e22a6ba7b7aa24 (diff) | |
| parent | c00d9bf3249142915eabc49fc1d96dda1ee3fc1c (diff) | |
| download | rust-2f99f1b3a48eb03221c56681c0ed8252f04c9df4.tar.gz rust-2f99f1b3a48eb03221c56681c0ed8252f04c9df4.zip | |
Rollup merge of #97562 - compiler-errors:comment-poly_project_and_unify_type, r=lcnr
Fix comment in `poly_project_and_unify_type` Renamed some variants to match `ProjectAndUnifyResult`
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/project.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index a71621a4d52..641b915f373 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -145,15 +145,28 @@ impl<'tcx> ProjectionCandidateSet<'tcx> { } } -/// Takes the place of a +/// States returned from `poly_project_and_unify_type`. Takes the place +/// of the old return type, which was: +/// ```ignore (not-rust) /// Result< /// Result<Option<Vec<PredicateObligation<'tcx>>>, InProgress>, /// MismatchedProjectionTypes<'tcx>, /// > +/// ``` pub(super) enum ProjectAndUnifyResult<'tcx> { + /// The projection bound holds subject to the given obligations. If the + /// projection cannot be normalized because the required trait bound does + /// not hold, this is returned, with `obligations` being a predicate that + /// cannot be proven. Holds(Vec<PredicateObligation<'tcx>>), + /// The projection cannot be normalized due to ambiguity. Resolving some + /// inference variables in the projection may fix this. FailedNormalization, + /// The project cannot be normalized because `poly_project_and_unify_type` + /// is called recursively while normalizing the same projection. Recursive, + // the projection can be normalized, but is not equal to the expected type. + // Returns the type error that arose from the mismatch. MismatchedProjectionTypes(MismatchedProjectionTypes<'tcx>), } @@ -163,19 +176,6 @@ pub(super) enum ProjectAndUnifyResult<'tcx> { /// ``` /// If successful, this may result in additional obligations. Also returns /// the projection cache key used to track these additional obligations. -/// -/// ## Returns -/// -/// - `Err(_)`: the projection can be normalized, but is not equal to the -/// expected type. -/// - `Ok(Err(InProgress))`: this is called recursively while normalizing -/// the same projection. -/// - `Ok(Ok(None))`: The projection cannot be normalized due to ambiguity -/// (resolving some inference variables in the projection may fix this). -/// - `Ok(Ok(Some(obligations)))`: The projection bound holds subject to -/// the given obligations. If the projection cannot be normalized because -/// the required trait bound doesn't hold this returned with `obligations` -/// being a predicate that cannot be proven. #[instrument(level = "debug", skip(selcx))] pub(super) fn poly_project_and_unify_type<'cx, 'tcx>( selcx: &mut SelectionContext<'cx, 'tcx>, |
