about summary refs log tree commit diff
path: root/src/librustdoc/lib.rs
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-12-11 23:01:26 -0500
committerJoshua Nelson <jyn514@gmail.com>2020-12-12 00:01:01 -0500
commit4fa95b3a078f261267293f3308dd62889167c0bd (patch)
treeb2433cfc476e8a9c9ce83813171b8eea668ec5ce /src/librustdoc/lib.rs
parentaf6aa9f4313983deddd64543c5ad6c15e2160163 (diff)
downloadrust-4fa95b3a078f261267293f3308dd62889167c0bd.tar.gz
rust-4fa95b3a078f261267293f3308dd62889167c0bd.zip
Calculate span info on-demand instead of ahead of time
This should *vastly* reduce memory usage.
Diffstat (limited to 'src/librustdoc/lib.rs')
-rw-r--r--src/librustdoc/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index fbab5735ee7..e094ead12bd 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -555,13 +555,14 @@ fn main_options(options: config::Options) -> MainResult {
     info!("going to format");
     let (error_format, edition, debugging_options) = diag_opts;
     let diag = core::new_handler(error_format, None, &debugging_options);
+    let sess_time = sess.clone();
     match output_format {
-        None | Some(config::OutputFormat::Html) => sess.time("render_html", || {
+        None | Some(config::OutputFormat::Html) => sess_time.time("render_html", || {
             run_renderer::<html::render::Context>(
                 krate, renderopts, renderinfo, &diag, edition, sess,
             )
         }),
-        Some(config::OutputFormat::Json) => sess.time("render_json", || {
+        Some(config::OutputFormat::Json) => sess_time.time("render_json", || {
             run_renderer::<json::JsonRenderer>(krate, renderopts, renderinfo, &diag, edition, sess)
         }),
     }