@@ -12,7 +12,6 @@ pub use data::{
12
12
CratePreludeData , Def , DefKind , GlobalCrateId as CrateId , Import , Ref , Relation , RelationKind ,
13
13
SigElement , Signature , SpanData ,
14
14
} ;
15
- use json;
16
15
use listings:: { DirectoryListing , ListingKind } ;
17
16
use { AnalysisLoader , Blacklist } ;
18
17
@@ -157,16 +156,28 @@ fn read_crate_data(path: &Path) -> Option<Analysis> {
157
156
s
158
157
}
159
158
160
- #[ cfg( feature = "serialize-rustc" ) ]
159
+ #[ cfg( all ( feature = "serialize-rustc" , not ( feature = "serialize-serde" ) ) ) ]
161
160
fn decode_buf ( buf : & str ) -> Result < Option < Analysis > , rustc_serialize:: json:: DecoderError > {
162
161
:: rustc_serialize:: json:: decode ( buf)
163
162
}
164
163
165
- #[ cfg( feature = "serialize-serde" ) ]
164
+ #[ cfg( all ( feature = "serialize-serde" , not ( feature = "serialize-rustc" ) ) ) ]
166
165
fn decode_buf ( buf : & str ) -> Result < Option < Analysis > , serde_json:: Error > {
167
166
:: serde_json:: from_str ( buf)
168
167
}
169
168
169
+ #[ cfg( all( feature = "serialize-rustc" , feature = "serialize-serde" ) ) ]
170
+ fn decode_buf ( buf : & str ) -> Result < Option < Analysis > , Box < dyn std:: error:: Error > > {
171
+ compile_error ! ( "Features \" serialize-serde\" and \" serialize-rustc\" cannot both be enabled for this crate." )
172
+ }
173
+
174
+ #[ cfg( not( any( feature = "serialize-serde" , feature = "serialize-rustc" ) ) ) ]
175
+ fn decode_buf ( buf : & str ) -> Result < Option < Analysis > , Box < dyn std:: error:: Error > > {
176
+ compile_error ! (
177
+ "Either feature \" serialize-serde\" or \" serialize-rustc\" must be enabled for this crate."
178
+ )
179
+ }
180
+
170
181
pub fn name_space_for_def_kind ( dk : DefKind ) -> char {
171
182
match dk {
172
183
DefKind :: Enum
0 commit comments