diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/formats/renderer.rs | 9 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 5 | ||||
| -rw-r--r-- | src/librustdoc/json/mod.rs | 5 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 13 |
4 files changed, 15 insertions, 17 deletions
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs index f61919d78a0..7ec29a70bd0 100644 --- a/src/librustdoc/formats/renderer.rs +++ b/src/librustdoc/formats/renderer.rs @@ -1,7 +1,6 @@ use std::sync::Arc; -use rustc_data_structures::sync::Lrc; -use rustc_session::Session; +use rustc_middle::ty; use rustc_span::edition::Edition; use crate::clean; @@ -21,7 +20,7 @@ crate trait FormatRenderer: Clone { render_info: RenderInfo, edition: Edition, cache: &mut Cache, - sess: Lrc<Session>, + tcx: ty::TyCtxt<'_>, ) -> Result<(Self, clean::Crate), Error>; /// Renders a single non-module item. This means no recursive sub-item rendering is required. @@ -52,7 +51,7 @@ crate fn run_format<T: FormatRenderer>( render_info: RenderInfo, diag: &rustc_errors::Handler, edition: Edition, - sess: Lrc<Session>, + tcx: ty::TyCtxt<'_>, ) -> Result<(), Error> { let (krate, mut cache) = Cache::from_krate( render_info.clone(), @@ -63,7 +62,7 @@ crate fn run_format<T: FormatRenderer>( ); let (mut format_renderer, mut krate) = - T::init(krate, options, render_info, edition, &mut cache, sess)?; + T::init(krate, options, render_info, edition, &mut cache, tcx)?; let cache = Arc::new(cache); // Freeze the cache now that the index has been built. Put an Arc into TLS for future diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index a775c85435c..d8d46adfb63 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -57,6 +57,7 @@ use rustc_hir as hir; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::Mutability; use rustc_middle::middle::stability; +use rustc_middle::ty; use rustc_session::Session; use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; @@ -388,7 +389,7 @@ impl FormatRenderer for Context { _render_info: RenderInfo, edition: Edition, cache: &mut Cache, - sess: Lrc<Session>, + tcx: ty::TyCtxt<'_>, ) -> Result<(Context, clean::Crate), Error> { // need to save a copy of the options for rendering the index page let md_opts = options.clone(); @@ -462,7 +463,7 @@ impl FormatRenderer for Context { } let (sender, receiver) = channel(); let mut scx = SharedContext { - sess, + tcx, collapsed: krate.collapsed, src_root, include_sources, diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 7af26558b76..3d970918407 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -14,6 +14,7 @@ use std::rc::Rc; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; +use rustc_middle::ty; use rustc_session::Session; use rustc_span::edition::Edition; @@ -127,12 +128,12 @@ impl FormatRenderer for JsonRenderer { _render_info: RenderInfo, _edition: Edition, _cache: &mut Cache, - sess: Lrc<Session>, + tcx: ty::TyCtxt<'_>, ) -> Result<(Self, clean::Crate), Error> { debug!("Initializing json renderer"); Ok(( JsonRenderer { - sess, + sess: tcx.sess, index: Rc::new(RefCell::new(FxHashMap::default())), out_path: options.output, }, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 93c849859ab..caa0706fd2b 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -62,13 +62,11 @@ use std::default::Default; use std::env; use std::process; -use rustc_data_structures::sync::Lrc; use rustc_driver::abort_on_err; use rustc_errors::ErrorReported; -use rustc_interface::interface; +use rustc_middle::ty; use rustc_session::config::{make_crate_type_option, ErrorOutputType, RustcOptGroup}; use rustc_session::getopts; -use rustc_session::Session; use rustc_session::{early_error, early_warn}; #[macro_use] @@ -476,9 +474,9 @@ fn run_renderer<T: formats::FormatRenderer>( render_info: config::RenderInfo, diag: &rustc_errors::Handler, edition: rustc_span::edition::Edition, - sess: Lrc<Session>, + tcx: ty::TyCtxt<'_>, ) -> MainResult { - match formats::run_format::<T>(krate, renderopts, render_info, &diag, edition, sess) { + match formats::run_format::<T>(krate, renderopts, render_info, &diag, edition, tcx) { Ok(_) => Ok(()), Err(e) => { let mut msg = diag.struct_err(&format!("couldn't generate documentation: {}", e.error)); @@ -577,7 +575,6 @@ 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_format = sess.clone(); match output_format { None | Some(config::OutputFormat::Html) => sess.time("render_html", || { run_renderer::<html::render::Context>( @@ -586,7 +583,7 @@ fn main_options(options: config::Options) -> MainResult { render_info, &diag, edition, - sess_format, + tcx, ) }), Some(config::OutputFormat::Json) => sess.time("render_json", || { @@ -596,7 +593,7 @@ fn main_options(options: config::Options) -> MainResult { render_info, &diag, edition, - sess_format, + tcx, ) }), } |
