@@ -17,17 +17,18 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
17
17
///
18
18
/// This is true for html, and false for json. See #80664
19
19
const RUN_ON_MODULE : bool ;
20
+
20
21
/// This associated type is the type where the current module information is stored.
21
22
///
22
23
/// For each module, we go through their items by calling for each item:
23
24
///
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`
27
28
///
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 `.
31
32
type ModuleData ;
32
33
33
34
/// 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 {
41
42
42
43
/// This method is called right before call [`Self::item`]. This method returns a type
43
44
/// 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.
45
46
///
46
47
/// In short it goes like this:
47
48
///
48
49
/// ```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);
52
53
/// ```
53
54
fn save_module_data ( & mut self ) -> Self :: ModuleData ;
54
55
/// 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 ) ;
56
57
57
58
/// Renders a single non-module item. This means no recursive sub-item rendering is required.
58
59
fn item ( & mut self , item : clean:: Item ) -> Result < ( ) , Error > ;
@@ -91,7 +92,7 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
91
92
for it in module. items {
92
93
let info = cx. save_module_data ( ) ;
93
94
run_format_inner ( cx, it, prof) ?;
94
- cx. set_back_info ( info) ;
95
+ cx. restore_module_data ( info) ;
95
96
}
96
97
97
98
cx. mod_item_out ( ) ?;
0 commit comments