@@ -185,8 +185,8 @@ let declared_first = PrintOnDrop("Dropped last in outer scope");
185185let  declared_last  =  PrintOnDrop (" Dropped first in outer scope" 
186186``` 
187187
188- r[ destructors.scope.bindings.pattern-drop-order ] 
189- If a pattern binds multiple variables, they  are dropped in reverse order of declaration.
188+ r[ destructors.scope.bindings.patterns ] 
189+ Variables in patterns  are dropped in reverse order of declaration within the pattern .
190190
191191``` rust 
192192# struct  PrintOnDrop (& 'static  str );
@@ -201,8 +201,8 @@ let (declared_first, declared_last) = (
201201);
202202``` 
203203
204- r[ destructors.scope.bindings.or-pattern-declaration-order ] 
205- For the purpose of drop order, [ or-patterns]  declare their  bindings in the order given by their  first sub-pattern .
204+ r[ destructors.scope.bindings.or-patterns ] 
205+ For the purpose of drop order, [ or-patterns]  declare bindings in the order given by the  first subpattern .
206206
207207``` rust 
208208# struct  PrintOnDrop (& 'static  str );
@@ -211,20 +211,31 @@ For the purpose of drop order, [or-patterns] declare their bindings in the order
211211#         println! (" drop({})" self . 0 );
212212#     }
213213# }
214- //  Drops `declared_last`, then `declared_first`.
215- fn  fixed_variable_drop_order <T >(
216-     (Ok ([declared_first , declared_last ])
217-     |  Err ([declared_last , declared_first ])):  Result <[T ; 2 ], [T ; 2 ]>
214+ //  Drops `x` before `y`.
215+ fn  or_pattern_drop_order <T >(
216+     (Ok ([x , y ]) |  Err ([y , x ])):  Result <[T ; 2 ], [T ; 2 ]>
217+ //    ^^^^^^^^^^   ^^^^^^^^^^^ This is the second subpattern.
218+ //    |
219+ //    This is the first subpattern.
220+ // 
221+ //    In the first subpattern, `x` is declared before `y`. Since it is
222+ //    the first subpattern, that is the order that is used even if the
223+ //    second subpattern (where the bindings are declared in the
224+ //    opposite order) is matched.
218225) {}
219226
220- fixed_variable_drop_order (Ok ([
221-     PrintOnDrop (" Dropped last" 
222-     PrintOnDrop (" Dropped first" 
227+ //  Here we match the first subpattern, and the drops happen according
228+ //  to the declaration order in the first subpattern.
229+ or_pattern_drop_order (Ok ([
230+     PrintOnDrop (" Declared first, dropped last" 
231+     PrintOnDrop (" Declared last, dropped first" 
223232]));
224233
225- fixed_variable_drop_order (Err ([
226-     PrintOnDrop (" Dropped first" 
227-     PrintOnDrop (" Dropped last" 
234+ //  Here we match the second subpattern, and the drops still happen
235+ //  according to the declaration order in the first subpattern.
236+ or_pattern_drop_order (Err ([
237+     PrintOnDrop (" Declared last, dropped first" 
238+     PrintOnDrop (" Declared first, dropped last" 
228239]));
229240``` 
230241
0 commit comments