@@ -31,7 +31,6 @@ use std::cmp::Ordering;
3131use std:: collections:: { BTreeMap , VecDeque } ;
3232use std:: default:: Default ;
3333use std:: error;
34-
3534use std:: ffi:: OsStr ;
3635use std:: fmt:: { self , Formatter , Write } ;
3736use std:: fs:: { self , File } ;
@@ -40,6 +39,7 @@ use std::io::{self, BufReader};
4039use std:: path:: { Component , Path , PathBuf } ;
4140use std:: rc:: Rc ;
4241use std:: str;
42+ use std:: string:: ToString ;
4343use std:: sync:: Arc ;
4444
4545use rustc_ast_pretty:: pprust;
@@ -92,7 +92,7 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
9292#[ derive( Debug ) ]
9393pub struct Error {
9494 pub file : PathBuf ,
95- pub error : io :: Error ,
95+ pub error : String ,
9696}
9797
9898impl error:: Error for Error { }
@@ -109,8 +109,11 @@ impl std::fmt::Display for Error {
109109}
110110
111111impl PathError for Error {
112- fn new < P : AsRef < Path > > ( e : io:: Error , path : P ) -> Error {
113- Error { file : path. as_ref ( ) . to_path_buf ( ) , error : e }
112+ fn new < S , P : AsRef < Path > > ( e : S , path : P ) -> Error
113+ where
114+ S : ToString + Sized ,
115+ {
116+ Error { file : path. as_ref ( ) . to_path_buf ( ) , error : e. to_string ( ) }
114117 }
115118}
116119
@@ -557,7 +560,7 @@ pub fn run(
557560
558561 // Write shared runs within a flock; disable thread dispatching of IO temporarily.
559562 Arc :: get_mut ( & mut cx. shared ) . unwrap ( ) . fs . set_sync_only ( true ) ;
560- write_shared ( & cx, & krate, index, & md_opts, diag ) ?;
563+ write_shared ( & cx, & krate, index, & md_opts) ?;
561564 Arc :: get_mut ( & mut cx. shared ) . unwrap ( ) . fs . set_sync_only ( false ) ;
562565
563566 // And finally render the whole crate's documentation
@@ -577,7 +580,6 @@ fn write_shared(
577580 krate : & clean:: Crate ,
578581 search_index : String ,
579582 options : & RenderOptions ,
580- diag : & rustc_errors:: Handler ,
581583) -> Result < ( ) , Error > {
582584 // Write out the shared files. Note that these are shared among all rustdoc
583585 // docs placed in the output directory, so this needs to be a synchronized
@@ -960,7 +962,8 @@ themePicker.onblur = handleThemeButtonsBlur;
960962 md_opts. output = cx. dst . clone ( ) ;
961963 md_opts. external_html = ( * cx. shared ) . layout . external_html . clone ( ) ;
962964
963- crate :: markdown:: render ( index_page, md_opts, diag, cx. shared . edition ) ;
965+ crate :: markdown:: render ( & index_page, md_opts, cx. shared . edition )
966+ . map_err ( |e| Error :: new ( e, & index_page) ) ?;
964967 } else {
965968 let dst = cx. dst . join ( "index.html" ) ;
966969 let page = layout:: Page {
0 commit comments