Skip to content

Commit 5d64b3d

Browse files
committed
document ret_coercion and ret_coercion_span
1 parent a999132 commit 5d64b3d

File tree

1 file changed

+12
-0
lines changed
  • src/librustc_typeck/check

1 file changed

+12
-0
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,19 @@ pub struct FnCtxt<'a, 'tcx> {
562562
// if type checking is run in parallel.
563563
err_count_on_creation: usize,
564564

565+
/// If `Some`, this stores coercion information for returned
566+
/// expressions. If `None`, this is in a context where return is
567+
/// inappropriate, such as a const expression.
568+
///
569+
/// This is a `RefCell<DynamicCoerceMany>`, which means that we
570+
/// can track all the return expressions and then use them to
571+
/// compute a useful coercion from the set, similar to a match
572+
/// expression or other branching context. You can use methods
573+
/// like `expected_ty` to access the declared return type (if
574+
/// any).
565575
ret_coercion: Option<RefCell<DynamicCoerceMany<'tcx>>>,
576+
577+
/// First span of a return site that we find. Used in error messages.
566578
ret_coercion_span: RefCell<Option<Span>>,
567579

568580
yield_ty: Option<Ty<'tcx>>,

0 commit comments

Comments
 (0)