A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.SourceFile.html below:

SourceFile in rustc_span - Rust

pub struct SourceFile {
    pub name: FileName,
    pub src: Option<Arc<String>>,
    pub src_hash: SourceFileHash,
    pub checksum_hash: Option<SourceFileHash>,
    pub external_src: FreezeLock<ExternalSource>,
    pub start_pos: BytePos,
    pub source_len: RelativeBytePos,
    pub lines: FreezeLock<SourceFileLines>,
    pub multibyte_chars: Vec<MultiByteChar>,
    pub normalized_pos: Vec<NormalizedPos>,
    pub stable_id: StableSourceFileId,
    pub cnum: CrateNum,
}
Expand description

A single source in the SourceMap.

The name of the file that the source came from. Source that doesn’t originate from files has names between angle brackets by convention (e.g., <anon>).

The complete source code.

The source code’s hash.

Used to enable cargo to use checksums to check if a crate is fresh rather than mtimes. This might be the same as src_hash, and if the requested algorithm is identical we won’t compute it twice.

The external source code (used for external crates, which will have a None value as self.src.

The start position of this source in the SourceMap.

The byte length of this source.

Locations of lines beginnings in the source code.

Locations of multi-byte characters in the source code.

Locations of characters removed during normalization.

A hash of the filename & crate-id, used for uniquely identifying source files within the crate graph and for speeding up hashing in incremental compilation.

Indicates which crate this SourceFile was imported from.

Source§ Source Source Source

This converts the lines field to contain SourceFileLines::Lines if needed and freezes it.

Source Source

Returns the BytePos of the beginning of the current line.

Source

Add externally loaded source. If the hash of the input doesn’t match or no input is supplied via None, it is interpreted as an error and the corresponding enum variant is set. The return value signifies whether some kind of source is present.

Source

Gets a line from the list of pre-computed line-beginnings. The line number here is 0-based.

Source Source Source Source Source Source Source

Finds the line containing the given position. The return value is the index into the lines array of this SourceFile, not the 1-based line number. If the source_file is empty or the position is located before the first line, None is returned.

Source Source

Returns whether or not the file contains the given SourceMap byte position. The position one past the end of the file is considered to be contained by the file. This implies that files for which is_empty returns true still contain one byte position according to this function.

Source Source

Calculates the original byte position relative to the start of the file based on the given byte position.

Source

Calculates a normalized byte position from a byte offset relative to the start of the file.

When we get an inline assembler error from LLVM during codegen, we import the expanded assembly code as a new SourceFile, which can then be used for error reporting with spans. However the byte offsets given to us by LLVM are relative to the start of the original buffer, not the normalized one. Hence we need to convert those offsets to the normalized form when constructing spans.

Source

Converts an relative RelativeBytePos to a CharPos relative to the SourceFile.

Source

Looks up the file’s (1-based) line number and (0-based CharPos) column offset, for a given RelativeBytePos.

Source

Looks up the file’s (1-based) line number, (0-based CharPos) column offset, and (0-based) column offset when displayed, for a given BytePos.

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 304 bytes


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4