@@ -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 } ;
@@ -49,7 +48,6 @@ use rustc_feature::UnstableFeatures;
4948use rustc_hir as hir;
5049use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
5150use rustc_hir:: Mutability ;
52- use rustc_middle:: middle:: privacy:: AccessLevels ;
5351use rustc_middle:: middle:: stability;
5452use rustc_span:: edition:: Edition ;
5553use rustc_span:: hygiene:: MacroKind ;
@@ -59,9 +57,11 @@ use serde::ser::SerializeSeq;
5957use serde:: { Serialize , Serializer } ;
6058
6159use crate :: clean:: { self , AttributesExt , Deprecation , GetDefId , SelfTy , TypeKind } ;
62- use crate :: config:: { OutputFormat , RenderOptions } ;
60+ use crate :: config:: RenderInfo ;
61+ use crate :: config:: RenderOptions ;
6362use crate :: docfs:: { DocFS , ErrorStorage , PathError } ;
6463use crate :: doctree;
64+ use crate :: error:: Error ;
6565use crate :: html:: escape:: Escape ;
6666use crate :: html:: format:: fmt_impl_for_trait_page;
6767use crate :: html:: format:: Function ;
@@ -89,55 +89,6 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
8989 } )
9090}
9191
92- #[ derive( Debug ) ]
93- pub struct Error {
94- pub file : PathBuf ,
95- pub error : String ,
96- }
97-
98- impl error:: Error for Error { }
99-
100- impl std:: fmt:: Display for Error {
101- fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
102- let file = self . file . display ( ) . to_string ( ) ;
103- if file. is_empty ( ) {
104- write ! ( f, "{}" , self . error)
105- } else {
106- write ! ( f, "\" {}\" : {}" , self . file. display( ) , self . error)
107- }
108- }
109- }
110-
111- impl PathError for Error {
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 ( ) }
117- }
118- }
119-
120- macro_rules! try_none {
121- ( $e: expr, $file: expr) => { {
122- use std:: io;
123- match $e {
124- Some ( e) => e,
125- None => {
126- return Err ( Error :: new( io:: Error :: new( io:: ErrorKind :: Other , "not found" ) , $file) ) ;
127- }
128- }
129- } } ;
130- }
131-
132- macro_rules! try_err {
133- ( $e: expr, $file: expr) => { {
134- match $e {
135- Ok ( e) => e,
136- Err ( e) => return Err ( Error :: new( e, $file) ) ,
137- }
138- } } ;
139- }
140-
14192/// Major driving force in all rustdoc rendering. This contains information
14293/// about where in the tree-like hierarchy rendering is occurring and controls
14394/// how the current page is being rendered.
@@ -261,20 +212,6 @@ impl Impl {
261212 }
262213}
263214
264- /// Temporary storage for data obtained during `RustdocVisitor::clean()`.
265- /// Later on moved into `CACHE_KEY`.
266- #[ derive( Default ) ]
267- pub struct RenderInfo {
268- pub inlined : FxHashSet < DefId > ,
269- pub external_paths : crate :: core:: ExternalPaths ,
270- pub exact_paths : FxHashMap < DefId , Vec < String > > ,
271- pub access_levels : AccessLevels < DefId > ,
272- pub deref_trait_did : Option < DefId > ,
273- pub deref_mut_trait_did : Option < DefId > ,
274- pub owned_box_did : Option < DefId > ,
275- pub output_format : Option < OutputFormat > ,
276- }
277-
278215// Helper structs for rendering items/sidebars and carrying along contextual
279216// information
280217
0 commit comments