@@ -218,6 +218,9 @@ pub struct Build {
218
218
/// User-specified configuration from `config.toml`.
219
219
config : Config ,
220
220
221
+ // Version information
222
+ version : String ,
223
+
221
224
// Properties derived from the above configuration
222
225
src : PathBuf ,
223
226
out : PathBuf ,
@@ -380,6 +383,10 @@ impl Build {
380
383
. unwrap ( )
381
384
. to_path_buf ( ) ;
382
385
386
+ let version = std:: fs:: read_to_string ( src. join ( "src" ) . join ( "version" ) )
387
+ . expect ( "failed to read src/version" ) ;
388
+ let version = version. trim ( ) ;
389
+
383
390
let mut build = Build {
384
391
initial_rustc : config. initial_rustc . clone ( ) ,
385
392
initial_cargo : config. initial_cargo . clone ( ) ,
@@ -395,6 +402,7 @@ impl Build {
395
402
targets : config. targets . clone ( ) ,
396
403
397
404
config,
405
+ version : version. to_string ( ) ,
398
406
src,
399
407
out,
400
408
@@ -433,8 +441,7 @@ impl Build {
433
441
. next ( )
434
442
. unwrap ( )
435
443
. trim ( ) ;
436
- let my_version = channel:: CFG_RELEASE_NUM ;
437
- if local_release. split ( '.' ) . take ( 2 ) . eq ( my_version. split ( '.' ) . take ( 2 ) ) {
444
+ if local_release. split ( '.' ) . take ( 2 ) . eq ( version. split ( '.' ) . take ( 2 ) ) {
438
445
build. verbose ( & format ! ( "auto-detected local-rebuild {}" , local_release) ) ;
439
446
build. local_rebuild = true ;
440
447
}
@@ -785,7 +792,7 @@ impl Build {
785
792
786
793
match which {
787
794
GitRepo :: Rustc => {
788
- let sha = self . rust_sha ( ) . unwrap_or ( channel :: CFG_RELEASE_NUM ) ;
795
+ let sha = self . rust_sha ( ) . unwrap_or ( & self . version ) ;
789
796
Some ( format ! ( "/rustc/{}" , sha) )
790
797
}
791
798
GitRepo :: Llvm => Some ( String :: from ( "/rustc/llvm" ) ) ,
@@ -1016,7 +1023,7 @@ impl Build {
1016
1023
1017
1024
/// Returns the value of `release` above for Rust itself.
1018
1025
fn rust_release ( & self ) -> String {
1019
- self . release ( channel :: CFG_RELEASE_NUM )
1026
+ self . release ( & self . version )
1020
1027
}
1021
1028
1022
1029
/// Returns the "package version" for a component given the `num` release
@@ -1036,7 +1043,7 @@ impl Build {
1036
1043
1037
1044
/// Returns the value of `package_vers` above for Rust itself.
1038
1045
fn rust_package_vers ( & self ) -> String {
1039
- self . package_vers ( channel :: CFG_RELEASE_NUM )
1046
+ self . package_vers ( & self . version )
1040
1047
}
1041
1048
1042
1049
/// Returns the value of `package_vers` above for Cargo
@@ -1070,7 +1077,7 @@ impl Build {
1070
1077
}
1071
1078
1072
1079
fn llvm_tools_package_vers ( & self ) -> String {
1073
- self . package_vers ( channel :: CFG_RELEASE_NUM )
1080
+ self . package_vers ( & self . version )
1074
1081
}
1075
1082
1076
1083
fn llvm_tools_vers ( & self ) -> String {
@@ -1087,7 +1094,7 @@ impl Build {
1087
1094
/// Note that this is a descriptive string which includes the commit date,
1088
1095
/// sha, version, etc.
1089
1096
fn rust_version ( & self ) -> String {
1090
- self . rust_info . version ( self , channel :: CFG_RELEASE_NUM )
1097
+ self . rust_info . version ( self , & self . version )
1091
1098
}
1092
1099
1093
1100
/// Returns the full commit hash.
0 commit comments