@@ -108,21 +108,21 @@ impl<'tcx> MaybePlacesSwitchIntData<'tcx> {
108108/// ```rust
109109/// struct S;
110110/// #[rustfmt::skip]
111- /// fn foo(pred : bool) { // maybe-init:
112- /// // {}
113- /// let a = S; let mut b = S; let c; let d; // {a, b}
111+ /// fn foo(p : bool) { // maybe-init:
112+ /// // {p }
113+ /// let a = S; let mut b = S; let c; let d; // {p, a, b}
114114///
115- /// if pred {
116- /// drop(a); // { b}
117- /// b = S; // { b}
115+ /// if p {
116+ /// drop(a); // {p, b}
117+ /// b = S; // {p, b}
118118///
119119/// } else {
120- /// drop(b); // {a}
121- /// d = S; // {a, d}
120+ /// drop(b); // {p, a}
121+ /// d = S; // {p, a, d}
122122///
123- /// } // {a, b, d}
123+ /// } // {p, a, b, d}
124124///
125- /// c = S; // {a, b, c, d}
125+ /// c = S; // {p, a, b, c, d}
126126/// }
127127/// ```
128128///
@@ -198,11 +198,11 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'tcx> {
198198/// ```rust
199199/// struct S;
200200/// #[rustfmt::skip]
201- /// fn foo(pred : bool) { // maybe-uninit:
201+ /// fn foo(p : bool) { // maybe-uninit:
202202/// // {a, b, c, d}
203203/// let a = S; let mut b = S; let c; let d; // { c, d}
204204///
205- /// if pred {
205+ /// if p {
206206/// drop(a); // {a, c, d}
207207/// b = S; // {a, c, d}
208208///
@@ -278,34 +278,36 @@ impl<'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
278278 }
279279}
280280
281- /// `EverInitializedPlaces` tracks all places that might have ever been
282- /// initialized upon reaching a particular point in the control flow
283- /// for a function, without an intervening `StorageDead`.
281+ /// `EverInitializedPlaces` tracks all initializations that may have occurred
282+ /// upon reaching a particular point in the control flow for a function,
283+ /// without an intervening `StorageDead`.
284284///
285285/// This dataflow is used to determine if an immutable local variable may
286286/// be assigned to.
287287///
288288/// For example, in code like the following, we have corresponding
289- /// dataflow information shown in the right-hand comments.
289+ /// dataflow information shown in the right-hand comments. Underscored indices
290+ /// are used to distinguish between multiple initializations of the same local
291+ /// variable, e.g. `b_0` and `b_1`.
290292///
291293/// ```rust
292294/// struct S;
293295/// #[rustfmt::skip]
294- /// fn foo(pred : bool) { // ever-init:
295- /// // { }
296- /// let a = S; let mut b = S; let c; let d; // {a, b }
296+ /// fn foo(p : bool) { // ever-init:
297+ /// // {p, }
298+ /// let a = S; let mut b = S; let c; let d; // {p, a, b_0, }
297299///
298- /// if pred {
299- /// drop(a); // {a, b, }
300- /// b = S; // {a, b , }
300+ /// if p {
301+ /// drop(a); // {p, a, b_0, }
302+ /// b = S; // {p, a, b_0, b_1 , }
301303///
302304/// } else {
303- /// drop(b); // {a, b, }
304- /// d = S; // {a, b, d }
305+ /// drop(b); // {p, a, b_0, b_1, }
306+ /// d = S; // {p, a, b_0, b_1, d }
305307///
306- /// } // {a, b, d }
308+ /// } // {p, a, b_0, b_1, d }
307309///
308- /// c = S; // {a, b, c, d }
310+ /// c = S; // {p, a, b_0, b_1, c, d}
309311/// }
310312/// ```
311313pub struct EverInitializedPlaces < ' a , ' tcx > {
0 commit comments