1414
1515pub use crate_id:: CrateId ;
1616pub use target:: { OutputType , Main , Lib , Test , Bench , Target , Build , Install } ;
17- pub use version:: { Version , ExactRevision , NoVersion , split_version, split_version_general,
17+ pub use version:: { Version , split_version, split_version_general,
1818 try_parsing_version} ;
1919pub use rustc:: metadata:: filesearch:: rust_path;
2020use rustc:: metadata:: filesearch:: { libdir, relative_target_lib_path} ;
@@ -85,7 +85,7 @@ pub fn workspace_contains_crate_id_(crateid: &CrateId, workspace: &Path,
8585 None => false ,
8686 Some ( ( ref might_match, ref vers) ) => {
8787 * might_match == crateid. short_name
88- && ( crateid. version == * vers || crateid. version == NoVersion )
88+ && ( crateid. version == * vers || crateid. version == None )
8989 }
9090 }
9191 } )
@@ -188,7 +188,7 @@ pub fn installed_library_in_workspace(pkg_path: &Path, workspace: &Path) -> Opti
188188 Install ,
189189 workspace,
190190 libdir ( ) ,
191- & NoVersion )
191+ & None )
192192 }
193193}
194194
@@ -261,7 +261,8 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
261261 Some ( i) => {
262262 debug ! ( "Maybe {} is a version" , f_name. slice( i + 1 , f_name. len( ) ) ) ;
263263 match try_parsing_version ( f_name. slice ( i + 1 , f_name. len ( ) ) ) {
264- Some ( ref found_vers) if version == found_vers => {
264+ Some ( ref found_vers) if version == & Some ( found_vers. to_owned ( ) ) ||
265+ version == & None => {
265266 match f_name. slice ( 0 , i) . rfind ( '-' ) {
266267 Some ( j) => {
267268 let lib_prefix = match p_path. extension_str ( ) {
@@ -276,7 +277,6 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
276277 }
277278 None => break
278279 }
279-
280280 }
281281 _ => { f_name = f_name. slice ( 0 , i) ; }
282282 }
@@ -306,13 +306,13 @@ fn split_crate_id<'a>(crate_id: &'a str) -> (&'a str, Version) {
306306 match split_version ( crate_id) {
307307 Some ( ( name, vers) ) =>
308308 match vers {
309- ExactRevision ( ref v) => match v. find ( '-' ) {
310- Some ( pos) => ( name, ExactRevision ( v. slice ( 0 , pos) . to_owned ( ) ) ) ,
311- None => ( name, ExactRevision ( v. to_owned ( ) ) )
309+ Some ( ref v) => match v. find ( '-' ) {
310+ Some ( pos) => ( name, Some ( v. slice ( 0 , pos) . to_owned ( ) ) ) ,
311+ None => ( name, Some ( v. to_owned ( ) ) )
312312 } ,
313313 _ => ( name, vers)
314314 } ,
315- None => ( crate_id, NoVersion )
315+ None => ( crate_id, None )
316316 }
317317}
318318
@@ -393,8 +393,7 @@ pub fn build_pkg_id_in_workspace(crateid: &CrateId, workspace: &Path) -> Path {
393393/// given whether we're building a library and whether we're building tests
394394pub fn mk_output_path ( what : OutputType , where : Target ,
395395 pkg_id : & CrateId , workspace : Path ) -> Path {
396- let short_name_with_version = format ! ( "{}-{}" , pkg_id. short_name,
397- pkg_id. version. to_str( ) ) ;
396+ let short_name_with_version = pkg_id. short_name_with_version ( ) ;
398397 // Not local_path.dir_path()! For package foo/bar/blat/, we want
399398 // the executable blat-0.5 to live under blat/
400399 let dir = match where {
@@ -487,7 +486,7 @@ pub fn versionize(p: &Path, v: &Version) -> Path {
487486 let q = p. filename ( ) . expect ( "path is a directory" ) ;
488487 let mut q = q. to_owned ( ) ;
489488 q. push ( '-' as u8 ) ;
490- let vs = v . to_str ( ) ;
489+ let vs = match v { & Some ( ref s ) => s . to_owned ( ) , & None => ~" 0.0 " } ;
491490 q. push_all ( vs. as_bytes ( ) ) ;
492491 p. with_filename ( q)
493492}
0 commit comments