Skip to content

Commit 80d04cc

Browse files
committed
Add comments for deref_steps()
1 parent 60d62be commit 80d04cc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_typeck/check/coercion.rs

+3
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
831831
self.probe(|_| coerce.coerce(source, target)).is_ok()
832832
}
833833

834+
/// Given a type and a target type, this function will calculate and return
835+
/// how many dereference steps needed to achieve `expr_ty <: target`. If
836+
/// it's not possible, return `None`.
834837
pub fn deref_steps(&self, expr_ty: Ty<'tcx>, target: Ty<'tcx>) -> Option<usize> {
835838
let cause = self.cause(rustc_span::DUMMY_SP, ObligationCauseCode::ExprAssignable);
836839
// We don't ever need two-phase here since we throw out the result of the coercion

0 commit comments

Comments
 (0)