@@ -268,7 +268,7 @@ struct SerializedTarget<'a> {
268
268
/// See https://doc.rust-lang.org/reference/linkage.html
269
269
crate_types : Vec < & ' a str > ,
270
270
name : & ' a str ,
271
- src_path : & ' a PathBuf ,
271
+ src_path : Option < & ' a PathBuf > ,
272
272
edition : & ' a str ,
273
273
#[ serde( rename = "required-features" , skip_serializing_if = "Option::is_none" ) ]
274
274
required_features : Option < Vec < & ' a str > > ,
@@ -277,17 +277,16 @@ struct SerializedTarget<'a> {
277
277
impl ser:: Serialize for Target {
278
278
fn serialize < S : ser:: Serializer > ( & self , s : S ) -> Result < S :: Ok , S :: Error > {
279
279
let src_path = match & self . src_path {
280
- TargetSourcePath :: Path ( p) => p. to_path_buf ( ) ,
281
- // This is a lie, to avoid changing the format of SerializedTarget.
282
- // The target dir is unknown here, so the path cannot be determined.
283
- // A better solution eludes me at this time.
284
- TargetSourcePath :: Metabuild => PathBuf :: from ( "metabuild.rs" ) ,
280
+ TargetSourcePath :: Path ( p) => Some ( p) ,
281
+ // Unfortunately getting the correct path would require access to
282
+ // target_dir, which is not available here.
283
+ TargetSourcePath :: Metabuild => None ,
285
284
} ;
286
285
SerializedTarget {
287
286
kind : & self . kind ,
288
287
crate_types : self . rustc_crate_types ( ) ,
289
288
name : & self . name ,
290
- src_path : & src_path,
289
+ src_path : src_path,
291
290
edition : & self . edition . to_string ( ) ,
292
291
required_features : self
293
292
. required_features
0 commit comments