@@ -30,9 +30,8 @@ use std::cell::{Cell, RefCell};
30
30
use std:: cmp:: Ordering ;
31
31
use std:: collections:: { BTreeMap , VecDeque } ;
32
32
use std:: default:: Default ;
33
- use std:: error;
34
33
use std:: ffi:: OsStr ;
35
- use std:: fmt:: { self , Formatter , Write } ;
34
+ use std:: fmt:: { self , Write } ;
36
35
use std:: fs:: { self , File } ;
37
36
use std:: io:: prelude:: * ;
38
37
use std:: io:: { self , BufReader } ;
@@ -49,7 +48,6 @@ use rustc_feature::UnstableFeatures;
49
48
use rustc_hir as hir;
50
49
use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
51
50
use rustc_hir:: Mutability ;
52
- use rustc_middle:: middle:: privacy:: AccessLevels ;
53
51
use rustc_middle:: middle:: stability;
54
52
use rustc_span:: edition:: Edition ;
55
53
use rustc_span:: hygiene:: MacroKind ;
@@ -59,9 +57,11 @@ use serde::ser::SerializeSeq;
59
57
use serde:: { Serialize , Serializer } ;
60
58
61
59
use crate :: clean:: { self , AttributesExt , Deprecation , GetDefId , SelfTy , TypeKind } ;
62
- use crate :: config:: { OutputFormat , RenderOptions } ;
60
+ use crate :: config:: RenderInfo ;
61
+ use crate :: config:: RenderOptions ;
63
62
use crate :: docfs:: { DocFS , ErrorStorage , PathError } ;
64
63
use crate :: doctree;
64
+ use crate :: error:: Error ;
65
65
use crate :: html:: escape:: Escape ;
66
66
use crate :: html:: format:: fmt_impl_for_trait_page;
67
67
use crate :: html:: format:: Function ;
@@ -89,55 +89,6 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
89
89
} )
90
90
}
91
91
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
-
141
92
/// Major driving force in all rustdoc rendering. This contains information
142
93
/// about where in the tree-like hierarchy rendering is occurring and controls
143
94
/// how the current page is being rendered.
@@ -261,20 +212,6 @@ impl Impl {
261
212
}
262
213
}
263
214
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
-
278
215
// Helper structs for rendering items/sidebars and carrying along contextual
279
216
// information
280
217
0 commit comments