File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/librustc_incremental/persist Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ const HEADER_FORMAT_VERSION: u16 = 0;
35
35
/// A version string that hopefully is always different for compiler versions
36
36
/// with different encodings of incremental compilation artifacts. Contains
37
37
/// the git commit hash.
38
- const RUSTC_VERSION : & ' static str = env ! ( "CFG_VERSION" ) ;
38
+ const RUSTC_VERSION : Option < & ' static str > = option_env ! ( "CFG_VERSION" ) ;
39
39
40
40
pub fn write_file_header < W : io:: Write > ( stream : & mut W ) -> io:: Result < ( ) > {
41
41
stream. write_all ( FILE_MAGIC ) ?;
@@ -98,7 +98,7 @@ pub fn read_file(path: &Path) -> io::Result<Option<Vec<u8>>> {
98
98
buffer. resize ( rustc_version_str_len, 0 ) ;
99
99
file. read_exact ( & mut buffer[ ..] ) ?;
100
100
101
- if & buffer[ ..] != RUSTC_VERSION . as_bytes ( ) {
101
+ if & buffer[ ..] != rustc_version ( ) . as_bytes ( ) {
102
102
return Ok ( None ) ;
103
103
}
104
104
}
@@ -116,5 +116,7 @@ fn rustc_version() -> String {
116
116
}
117
117
}
118
118
119
- RUSTC_VERSION . to_string ( )
119
+ RUSTC_VERSION . expect ( "Cannot use rustc without explicit version for \
120
+ incremental compilation")
121
+ . to_string ( )
120
122
}
You can’t perform that action at this time.
0 commit comments