about summary refs log tree commit diff
path: root/src/librustdoc/formats/renderer.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-04 07:24:25 +0000
committerbors <bors@rust-lang.org>2024-12-04 07:24:25 +0000
commit733616f7236b4be140ce851a30b3bb06532b9364 (patch)
tree75e3ac8b83b1ed66a9c400ed389652925f6d7e8c /src/librustdoc/formats/renderer.rs
parent2633e019298f8d9f671c8f3d0d3348ce6fa1b8aa (diff)
parent0585134e709de4a14e509158662fa569c155c195 (diff)
downloadrust-733616f7236b4be140ce851a30b3bb06532b9364.tar.gz
rust-733616f7236b4be140ce851a30b3bb06532b9364.zip
Auto merge of #133841 - matthiaskrgr:rollup-2snj3hc, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #133651 (Update `NonZero` and `NonNull` to not field-project (per MCP#807))
 - #133764 (rustdoc: Rename `set_back_info` to `restore_module_data`.)
 - #133784 (Fix MutVisitor's default implementations to visit Stmt's and BinOp's spans)
 - #133798 (stop replacing bivariant args with `'static` when computing closure requirements)
 - #133804 (Improve code for FileName retrieval in rustdoc)
 - #133817 (Use `eprintln` instead of `println` in bootstrap/compiletest/tidy)

Failed merges:

 - #133810 (remove unnecessary `eval_verify_bound`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/formats/renderer.rs')
-rw-r--r--src/librustdoc/formats/renderer.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs
index 582ef7d2c48..5e4e6f27a15 100644
--- a/src/librustdoc/formats/renderer.rs
+++ b/src/librustdoc/formats/renderer.rs
@@ -17,17 +17,18 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
     ///
     /// This is true for html, and false for json. See #80664
     const RUN_ON_MODULE: bool;
+
     /// This associated type is the type where the current module information is stored.
     ///
     /// For each module, we go through their items by calling for each item:
     ///
-    /// 1. save_module_data
-    /// 2. item
-    /// 3. set_back_info
+    /// 1. `save_module_data`
+    /// 2. `item`
+    /// 3. `restore_module_data`
     ///
-    /// However,the `item` method might update information in `self` (for example if the child is
-    /// a module). To prevent it to impact the other children of the current module, we need to
-    /// reset the information between each call to `item` by using `set_back_info`.
+    /// This is because the `item` method might update information in `self` (for example if the child
+    /// is a module). To prevent it from impacting the other children of the current module, we need to
+    /// reset the information between each call to `item` by using `restore_module_data`.
     type ModuleData;
 
     /// 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 {
 
     /// This method is called right before call [`Self::item`]. This method returns a type
     /// containing information that needs to be reset after the [`Self::item`] method has been
-    /// called with the [`Self::set_back_info`] method.
+    /// called with the [`Self::restore_module_data`] method.
     ///
     /// In short it goes like this:
     ///
     /// ```ignore (not valid code)
-    /// let reset_data = type.save_module_data();
-    /// type.item(item)?;
-    /// type.set_back_info(reset_data);
+    /// let reset_data = renderer.save_module_data();
+    /// renderer.item(item)?;
+    /// renderer.restore_module_data(reset_data);
     /// ```
     fn save_module_data(&mut self) -> Self::ModuleData;
     /// Used to reset current module's information.
-    fn set_back_info(&mut self, info: Self::ModuleData);
+    fn restore_module_data(&mut self, info: Self::ModuleData);
 
     /// Renders a single non-module item. This means no recursive sub-item rendering is required.
     fn item(&mut self, item: clean::Item) -> Result<(), Error>;
@@ -91,7 +92,7 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
         for it in module.items {
             let info = cx.save_module_data();
             run_format_inner(cx, it, prof)?;
-            cx.set_back_info(info);
+            cx.restore_module_data(info);
         }
 
         cx.mod_item_out()?;