# Function rustc_parse::try_file_to_source_file

source ·

    pub(crate) fn try_file_to_source_file(
        sess: &ParseSess,
        path: &Path,
        spanopt: Option<Span>
    ) -> Result<Lrc<SourceFile>, Diagnostic>

Expand description

Given a session and a path and an optional span (for error reporting), add the path to the session’s source_map and return the new source_file or error when a file can’t be read.