Rollup merge of #40576 - dwrensha:mir-terminator-kind-doc-typo, r=nikomatsakis

fix innacuracy in mir TerminatorKind::SwitchInt docs

Each index of `values` corresponds to an index of `targets`, and `targets` additionally has a "default case" element at its end, so `targets.len() == values.len() + 1`, not the other way around. For example, [here](0aeb9c1297/src/librustc/mir/mod.rs (L549-L550)) is a concrete instance of `SwitchInt` being constructed with `targets.len() == 2` and `values.len() == 1`.
This commit is contained in:
Corey Farwell 2017-03-20 23:45:00 -04:00 committed by GitHub
commit 2532ad7d0b
1 changed files with 1 additions and 1 deletions

View File

@ -467,7 +467,7 @@ pub enum TerminatorKind<'tcx> {
values: Cow<'tcx, [ConstInt]>,
/// Possible branch sites. The last element of this vector is used
/// for the otherwise branch, so values.len() == targets.len() + 1
/// for the otherwise branch, so targets.len() == values.len() + 1
/// should hold.
// This invariant is quite non-obvious and also could be improved.
// One way to make this invariant is to have something like this instead: