@@ -30,9 +30,8 @@ use std::cell::{Cell, RefCell};
3030use std:: cmp:: Ordering ;
3131use std:: collections:: { BTreeMap , VecDeque } ;
3232use std:: default:: Default ;
33- use std:: error;
3433use std:: ffi:: OsStr ;
35- use std:: fmt:: { self , Formatter , Write } ;
34+ use std:: fmt:: { self , Write } ;
3635use std:: fs:: { self , File } ;
3736use std:: io:: prelude:: * ;
3837use std:: io:: { self , BufReader } ;
@@ -50,7 +49,6 @@ use rustc_feature::UnstableFeatures;
5049use rustc_hir as hir;
5150use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
5251use rustc_hir:: Mutability ;
53- use rustc_middle:: middle:: privacy:: AccessLevels ;
5452use rustc_middle:: middle:: stability;
5553use rustc_span:: edition:: Edition ;
5654use rustc_span:: hygiene:: MacroKind ;
@@ -60,9 +58,11 @@ use serde::ser::SerializeSeq;
6058use serde:: { Serialize , Serializer } ;
6159
6260use crate :: clean:: { self , AttributesExt , Deprecation , GetDefId , SelfTy , TypeKind } ;
63- use crate :: config:: { OutputFormat , RenderOptions } ;
61+ use crate :: config:: RenderInfo ;
62+ use crate :: config:: RenderOptions ;
6463use crate :: docfs:: { DocFS , ErrorStorage , PathError } ;
6564use crate :: doctree;
65+ use crate :: error:: Error ;
6666use crate :: html:: escape:: Escape ;
6767use crate :: html:: format:: fmt_impl_for_trait_page;
6868use crate :: html:: format:: Function ;
@@ -90,55 +90,6 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
9090 } )
9191}
9292
93- #[ derive( Debug ) ]
94- pub struct Error {
95- pub file : PathBuf ,
96- pub error : String ,
97- }
98-
99- impl error:: Error for Error { }
100-
101- impl std:: fmt:: Display for Error {
102- fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
103- let file = self . file . display ( ) . to_string ( ) ;
104- if file. is_empty ( ) {
105- write ! ( f, "{}" , self . error)
106- } else {
107- write ! ( f, "\" {}\" : {}" , self . file. display( ) , self . error)
108- }
109- }
110- }
111-
112- impl PathError for Error {
113- fn new < S , P : AsRef < Path > > ( e : S , path : P ) -> Error
114- where
115- S : ToString + Sized ,
116- {
117- Error { file : path. as_ref ( ) . to_path_buf ( ) , error : e. to_string ( ) }
118- }
119- }
120-
121- macro_rules! try_none {
122- ( $e: expr, $file: expr) => { {
123- use std:: io;
124- match $e {
125- Some ( e) => e,
126- None => {
127- return Err ( Error :: new( io:: Error :: new( io:: ErrorKind :: Other , "not found" ) , $file) ) ;
128- }
129- }
130- } } ;
131- }
132-
133- macro_rules! try_err {
134- ( $e: expr, $file: expr) => { {
135- match $e {
136- Ok ( e) => e,
137- Err ( e) => return Err ( Error :: new( e, $file) ) ,
138- }
139- } } ;
140- }
141-
14293/// Major driving force in all rustdoc rendering. This contains information
14394/// about where in the tree-like hierarchy rendering is occurring and controls
14495/// how the current page is being rendered.
@@ -260,20 +211,6 @@ impl Impl {
260211 }
261212}
262213
263- /// Temporary storage for data obtained during `RustdocVisitor::clean()`.
264- /// Later on moved into `CACHE_KEY`.
265- #[ derive( Default ) ]
266- pub struct RenderInfo {
267- pub inlined : FxHashSet < DefId > ,
268- pub external_paths : crate :: core:: ExternalPaths ,
269- pub exact_paths : FxHashMap < DefId , Vec < String > > ,
270- pub access_levels : AccessLevels < DefId > ,
271- pub deref_trait_did : Option < DefId > ,
272- pub deref_mut_trait_did : Option < DefId > ,
273- pub owned_box_did : Option < DefId > ,
274- pub output_format : Option < OutputFormat > ,
275- }
276-
277214// Helper structs for rendering items/sidebars and carrying along contextual
278215// information
279216
0 commit comments