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;
3535/// A version string that hopefully is always different for compiler versions
3636/// with different encodings of incremental compilation artifacts. Contains
3737/// the git commit hash.
38- const RUSTC_VERSION : & ' static str = env ! ( "CFG_VERSION" ) ;
38+ const RUSTC_VERSION : Option < & ' static str > = option_env ! ( "CFG_VERSION" ) ;
3939
4040pub fn write_file_header < W : io:: Write > ( stream : & mut W ) -> io:: Result < ( ) > {
4141 stream. write_all ( FILE_MAGIC ) ?;
@@ -98,7 +98,7 @@ pub fn read_file(path: &Path) -> io::Result<Option<Vec<u8>>> {
9898 buffer. resize ( rustc_version_str_len, 0 ) ;
9999 file. read_exact ( & mut buffer[ ..] ) ?;
100100
101- if & buffer[ ..] != RUSTC_VERSION . as_bytes ( ) {
101+ if & buffer[ ..] != rustc_version ( ) . as_bytes ( ) {
102102 return Ok ( None ) ;
103103 }
104104 }
@@ -116,5 +116,7 @@ fn rustc_version() -> String {
116116 }
117117 }
118118
119- RUSTC_VERSION . to_string ( )
119+ RUSTC_VERSION . expect ( "Cannot use rustc without explicit version for \
120+ incremental compilation")
121+ . to_string ( )
120122}
You can’t perform that action at this time.
0 commit comments