diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-03-24 13:36:01 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-03-30 08:18:02 -0400 |
| commit | 1b5768df4e70e4a05e15271ee58c32cb00d7fefd (patch) | |
| tree | 0465c18fa49d2eb199af243947e868cb5d17f205 /src | |
| parent | 8450add8bede7bc5119457e37bbbcc95a5e8b121 (diff) | |
| download | rust-1b5768df4e70e4a05e15271ee58c32cb00d7fefd.tar.gz rust-1b5768df4e70e4a05e15271ee58c32cb00d7fefd.zip | |
document `diverges` more correctly
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index da15c8f766e..aaa3cf0f29e 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -454,11 +454,19 @@ pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { ps: RefCell<UnsafetyState>, /// Whether the last checked node generates a divergence (e.g., - /// `return` will set this to Always). In general, this is - /// typically set to *Maybe* on the way **down** the tree, and - /// then values are propagated **up** the tree. In a block, we - /// combine the results from statements and propagate the - /// end-result up. + /// `return` will set this to Always). In general, when entering + /// an expression or other node in the tree, the initial value + /// indicates whether prior parts of the containing expression may + /// have diverged. It is then typically set to `Maybe` (and the + /// old value remembered) for processing the subparts of the + /// current expression. As each subpart is processed, they may set + /// the flag to `Always` etc. Finally, at the end, we take the + /// result and "union" it with the original value, so that when we + /// return the flag indicates if any subpart of the the parent + /// expression (up to and including this part) has diverged. So, + /// if you read it after evaluating a subexpression `X`, the value + /// you get indicates whether any subexpression that was + /// evaluating up to and including `X` diverged. /// /// We use this flag for two purposes: /// |
