diff options
| author | Donough Liu <ldm2993593805@163.com> | 2020-05-01 21:56:10 +0800 |
|---|---|---|
| committer | Donough Liu <ldm2993593805@163.com> | 2020-05-02 12:04:03 +0800 |
| commit | 80d04cc1ba610d796c84427622ce17eb2ca9c771 (patch) | |
| tree | 4f871041a1ba3ca1a6890c83d4ca55bf5ed394df | |
| parent | 60d62bee36074d24f4995287ba3b12adf1df0888 (diff) | |
| download | rust-80d04cc1ba610d796c84427622ce17eb2ca9c771.tar.gz rust-80d04cc1ba610d796c84427622ce17eb2ca9c771.zip | |
Add comments for deref_steps()
| -rw-r--r-- | src/librustc_typeck/check/coercion.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index c336ec13479..7437c87a257 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -831,6 +831,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.probe(|_| coerce.coerce(source, target)).is_ok() } + /// Given a type and a target type, this function will calculate and return + /// how many dereference steps needed to achieve `expr_ty <: target`. If + /// it's not possible, return `None`. pub fn deref_steps(&self, expr_ty: Ty<'tcx>, target: Ty<'tcx>) -> Option<usize> { let cause = self.cause(rustc_span::DUMMY_SP, ObligationCauseCode::ExprAssignable); // We don't ever need two-phase here since we throw out the result of the coercion |
