diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-03-20 23:45:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-20 23:45:00 -0400 |
| commit | 2532ad7d0b2edac1909ef0ef346230331200790b (patch) | |
| tree | b6b8b8705f6c59f0cafa5e4f83e7ccd801cca962 | |
| parent | 17656ab328b641605f671a8a1ae1cc2de0638bfb (diff) | |
| parent | e9c07cfc0e92e9370d8cbcb78ac84efe0a6c1644 (diff) | |
| download | rust-2532ad7d0b2edac1909ef0ef346230331200790b.tar.gz rust-2532ad7d0b2edac1909ef0ef346230331200790b.zip | |
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](https://github.com/rust-lang/rust/blob/0aeb9c12979e6da753701a798d04105b6b1a8c28/src/librustc/mir/mod.rs#L549-L550) is a concrete instance of `SwitchInt` being constructed with `targets.len() == 2` and `values.len() == 1`.
| -rw-r--r-- | src/librustc/mir/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 33df648f172..9fdb8665776 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -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: |
