use rustc_session::Session;
use rustc_span::edition::Edition;
use rustc_span::source_map::FileName;
-use rustc_span::{symbol::sym, Symbol};
+use rustc_span::symbol::sym;
use super::cache::{build_index, ExternalLocation};
use super::print_item::{full_path, item_path, print_item};
crate static_root_path: Option<String>,
/// The fs handle we are working with.
crate fs: DocFS,
- /// The default edition used to parse doctests.
- crate edition: Edition,
pub(super) codes: ErrorCodes,
pub(super) playground: Option<markdown::Playground>,
all: RefCell<AllTypes>,
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<String> {
if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() }
}
+
+ crate fn edition(&self) -> Edition {
+ self.tcx.sess.edition()
+ }
}
impl<'tcx> Context<'tcx> {
fn init(
mut krate: clean::Crate,
options: RenderOptions,
- edition: Edition,
mut cache: Cache,
tcx: TyCtxt<'tcx>,
) -> Result<(Self, clean::Crate), Error> {
resource_suffix,
static_root_path,
fs: DocFS::new(sender),
- edition,
codes: ErrorCodes::from(unstable_features.is_nightly_build()),
playground,
all: RefCell::new(AllTypes::new()),
}
}
- fn after_krate(
- &mut self,
- crate_name: Symbol,
- diag: &rustc_errors::Handler,
- ) -> Result<(), Error> {
+ fn after_krate(&mut self) -> Result<(), Error> {
+ let crate_name = self.tcx().crate_name(LOCAL_CRATE);
let final_file = self.dst.join(&*crate_name.as_str()).join("all.html");
let settings_file = self.dst.join("settings.html");
// Flush pending errors.
Rc::get_mut(&mut self.shared).unwrap().fs.close();
- let nb_errors = self.shared.errors.iter().map(|err| diag.struct_err(&err).emit()).count();
+ let nb_errors =
+ self.shared.errors.iter().map(|err| self.tcx().sess.struct_err(&err).emit()).count();
if nb_errors > 0 {
Err(Error::new(io::Error::new(io::ErrorKind::Other, "I/O error"), ""))
} else {
Ok(())
}
- fn mod_item_out(&mut self, _item_name: &str) -> Result<(), Error> {
+ fn mod_item_out(&mut self) -> Result<(), Error> {
info!("Recursed; leaving {}", self.dst.display());
// Go back to where we were at