@@ -109,21 +109,21 @@ impl<'tcx> MaybePlacesSwitchIntData<'tcx> {
109109/// ```rust
110110/// struct S;
111111/// #[rustfmt::skip]
112- /// fn foo(pred : bool) { // maybe-init:
113- /// // {}
114- /// let a = S; let mut b = S; let c; let d; // {a, b}
112+ /// fn foo(p : bool) { // maybe-init:
113+ /// // {p }
114+ /// let a = S; let mut b = S; let c; let d; // {p, a, b}
115115///
116- /// if pred {
117- /// drop(a); // { b}
118- /// b = S; // { b}
116+ /// if p {
117+ /// drop(a); // {p, b}
118+ /// b = S; // {p, b}
119119///
120120/// } else {
121- /// drop(b); // {a}
122- /// d = S; // {a, d}
121+ /// drop(b); // {p, a}
122+ /// d = S; // {p, a, d}
123123///
124- /// } // {a, b, d}
124+ /// } // {p, a, b, d}
125125///
126- /// c = S; // {a, b, c, d}
126+ /// c = S; // {p, a, b, c, d}
127127/// }
128128/// ```
129129///
@@ -199,11 +199,11 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'tcx> {
199199/// ```rust
200200/// struct S;
201201/// #[rustfmt::skip]
202- /// fn foo(pred : bool) { // maybe-uninit:
202+ /// fn foo(p : bool) { // maybe-uninit:
203203/// // {a, b, c, d}
204204/// let a = S; let mut b = S; let c; let d; // { c, d}
205205///
206- /// if pred {
206+ /// if p {
207207/// drop(a); // {a, c, d}
208208/// b = S; // {a, c, d}
209209///
@@ -279,34 +279,36 @@ impl<'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
279279 }
280280}
281281
282- /// `EverInitializedPlaces` tracks all places that might have ever been
283- /// initialized upon reaching a particular point in the control flow
284- /// for a function, without an intervening `StorageDead`.
282+ /// `EverInitializedPlaces` tracks all initializations that may have occurred
283+ /// upon reaching a particular point in the control flow for a function,
284+ /// without an intervening `StorageDead`.
285285///
286286/// This dataflow is used to determine if an immutable local variable may
287287/// be assigned to.
288288///
289289/// For example, in code like the following, we have corresponding
290- /// dataflow information shown in the right-hand comments.
290+ /// dataflow information shown in the right-hand comments. Underscored indices
291+ /// are used to distinguish between multiple initializations of the same local
292+ /// variable, e.g. `b_0` and `b_1`.
291293///
292294/// ```rust
293295/// struct S;
294296/// #[rustfmt::skip]
295- /// fn foo(pred : bool) { // ever-init:
296- /// // { }
297- /// let a = S; let mut b = S; let c; let d; // {a, b }
297+ /// fn foo(p : bool) { // ever-init:
298+ /// // {p, }
299+ /// let a = S; let mut b = S; let c; let d; // {p, a, b_0, }
298300///
299- /// if pred {
300- /// drop(a); // {a, b, }
301- /// b = S; // {a, b , }
301+ /// if p {
302+ /// drop(a); // {p, a, b_0, }
303+ /// b = S; // {p, a, b_0, b_1 , }
302304///
303305/// } else {
304- /// drop(b); // {a, b, }
305- /// d = S; // {a, b, d }
306+ /// drop(b); // {p, a, b_0, b_1, }
307+ /// d = S; // {p, a, b_0, b_1, d }
306308///
307- /// } // {a, b, d }
309+ /// } // {p, a, b_0, b_1, d }
308310///
309- /// c = S; // {a, b, c, d }
311+ /// c = S; // {p, a, b_0, b_1, c, d}
310312/// }
311313/// ```
312314pub struct EverInitializedPlaces < ' a , ' tcx > {
0 commit comments