rustc_incremental::persist::file_format

Function read_file

Source
pub(crate) fn read_file(
    path: &Path,
    report_incremental_info: bool,
    is_nightly_build: bool,
    cfg_version: &'static str,
) -> Result<Option<(Mmap, usize)>>
Expand description

Reads the contents of a file with a file header as defined in this module.

  • Returns Ok(Some(data, pos)) if the file existed and was generated by a compatible compiler version. data is the entire contents of the file and pos points to the first byte after the header.
  • Returns Ok(None) if the file did not exist or was generated by an incompatible version of the compiler.
  • Returns Err(..) if some kind of IO error occurred while reading the file.