@@ -17,17 +17,18 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
1717 ///
1818 /// This is true for html, and false for json. See #80664
1919 const RUN_ON_MODULE : bool ;
20+
2021 /// This associated type is the type where the current module information is stored.
2122 ///
2223 /// For each module, we go through their items by calling for each item:
2324 ///
24- /// 1. save_module_data
25- /// 2. item
26- /// 3. set_back_info
25+ /// 1. ` save_module_data`
26+ /// 2. ` item`
27+ /// 3. `restore_module_data`
2728 ///
28- /// However, the `item` method might update information in `self` (for example if the child is
29- /// a module). To prevent it to impact the other children of the current module, we need to
30- /// reset the information between each call to `item` by using `set_back_info `.
29+ /// This is because the `item` method might update information in `self` (for example if the child
30+ /// is a module). To prevent it from impacting the other children of the current module, we need to
31+ /// reset the information between each call to `item` by using `restore_module_data `.
3132 type ModuleData ;
3233
3334 /// Sets up any state required for the renderer. When this is called the cache has already been
@@ -41,18 +42,18 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
4142
4243 /// This method is called right before call [`Self::item`]. This method returns a type
4344 /// containing information that needs to be reset after the [`Self::item`] method has been
44- /// called with the [`Self::set_back_info `] method.
45+ /// called with the [`Self::restore_module_data `] method.
4546 ///
4647 /// In short it goes like this:
4748 ///
4849 /// ```ignore (not valid code)
49- /// let reset_data = type .save_module_data();
50- /// type .item(item)?;
51- /// type.set_back_info (reset_data);
50+ /// let reset_data = renderer .save_module_data();
51+ /// renderer .item(item)?;
52+ /// renderer.restore_module_data (reset_data);
5253 /// ```
5354 fn save_module_data ( & mut self ) -> Self :: ModuleData ;
5455 /// Used to reset current module's information.
55- fn set_back_info ( & mut self , info : Self :: ModuleData ) ;
56+ fn restore_module_data ( & mut self , info : Self :: ModuleData ) ;
5657
5758 /// Renders a single non-module item. This means no recursive sub-item rendering is required.
5859 fn item ( & mut self , item : clean:: Item ) -> Result < ( ) , Error > ;
@@ -91,7 +92,7 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
9192 for it in module. items {
9293 let info = cx. save_module_data ( ) ;
9394 run_format_inner ( cx, it, prof) ?;
94- cx. set_back_info ( info) ;
95+ cx. restore_module_data ( info) ;
9596 }
9697
9798 cx. mod_item_out ( ) ?;
0 commit comments