@@ -31,7 +31,6 @@ use std::cmp::Ordering;
31
31
use std:: collections:: { BTreeMap , VecDeque } ;
32
32
use std:: default:: Default ;
33
33
use std:: error;
34
-
35
34
use std:: ffi:: OsStr ;
36
35
use std:: fmt:: { self , Formatter , Write } ;
37
36
use std:: fs:: { self , File } ;
@@ -40,6 +39,7 @@ use std::io::{self, BufReader};
40
39
use std:: path:: { Component , Path , PathBuf } ;
41
40
use std:: rc:: Rc ;
42
41
use std:: str;
42
+ use std:: string:: ToString ;
43
43
use std:: sync:: Arc ;
44
44
45
45
use rustc_ast_pretty:: pprust;
@@ -92,7 +92,7 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
92
92
#[ derive( Debug ) ]
93
93
pub struct Error {
94
94
pub file : PathBuf ,
95
- pub error : io :: Error ,
95
+ pub error : String ,
96
96
}
97
97
98
98
impl error:: Error for Error { }
@@ -109,8 +109,11 @@ impl std::fmt::Display for Error {
109
109
}
110
110
111
111
impl 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 ( ) }
114
117
}
115
118
}
116
119
@@ -557,7 +560,7 @@ pub fn run(
557
560
558
561
// Write shared runs within a flock; disable thread dispatching of IO temporarily.
559
562
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) ?;
561
564
Arc :: get_mut ( & mut cx. shared ) . unwrap ( ) . fs . set_sync_only ( false ) ;
562
565
563
566
// And finally render the whole crate's documentation
@@ -577,7 +580,6 @@ fn write_shared(
577
580
krate : & clean:: Crate ,
578
581
search_index : String ,
579
582
options : & RenderOptions ,
580
- diag : & rustc_errors:: Handler ,
581
583
) -> Result < ( ) , Error > {
582
584
// Write out the shared files. Note that these are shared among all rustdoc
583
585
// docs placed in the output directory, so this needs to be a synchronized
@@ -960,7 +962,8 @@ themePicker.onblur = handleThemeButtonsBlur;
960
962
md_opts. output = cx. dst . clone ( ) ;
961
963
md_opts. external_html = ( * cx. shared ) . layout . external_html . clone ( ) ;
962
964
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) ) ?;
964
967
} else {
965
968
let dst = cx. dst . join ( "index.html" ) ;
966
969
let page = layout:: Page {
0 commit comments