@@ -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 } ;
@@ -50,7 +49,6 @@ use rustc_feature::UnstableFeatures;
50
49
use rustc_hir as hir;
51
50
use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
52
51
use rustc_hir:: Mutability ;
53
- use rustc_middle:: middle:: privacy:: AccessLevels ;
54
52
use rustc_middle:: middle:: stability;
55
53
use rustc_span:: edition:: Edition ;
56
54
use rustc_span:: hygiene:: MacroKind ;
@@ -60,9 +58,11 @@ use serde::ser::SerializeSeq;
60
58
use serde:: { Serialize , Serializer } ;
61
59
62
60
use crate :: clean:: { self , AttributesExt , Deprecation , GetDefId , SelfTy , TypeKind } ;
63
- use crate :: config:: { OutputFormat , RenderOptions } ;
61
+ use crate :: config:: RenderInfo ;
62
+ use crate :: config:: RenderOptions ;
64
63
use crate :: docfs:: { DocFS , ErrorStorage , PathError } ;
65
64
use crate :: doctree;
65
+ use crate :: error:: Error ;
66
66
use crate :: html:: escape:: Escape ;
67
67
use crate :: html:: format:: fmt_impl_for_trait_page;
68
68
use crate :: html:: format:: Function ;
@@ -90,55 +90,6 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
90
90
} )
91
91
}
92
92
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
-
142
93
/// Major driving force in all rustdoc rendering. This contains information
143
94
/// about where in the tree-like hierarchy rendering is occurring and controls
144
95
/// how the current page is being rendered.
@@ -260,20 +211,6 @@ impl Impl {
260
211
}
261
212
}
262
213
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
-
277
214
// Helper structs for rendering items/sidebars and carrying along contextual
278
215
// information
279
216
0 commit comments