Skip to main content

DebugFileEntry

Struct DebugFileEntry 

Source
pub struct DebugFileEntry {
    pub surface: FileSurface,
    pub path: String,
    pub source_hash: u64,
    pub line_starts: Vec<u32>,
}
Expand description

One entry in the DebugInfo section’s section-local file table (docs/debugger-spec.md §2.3). Index 0 is always the reserved synthetic sentinel (§2.5) — surface = Synthetic, path = "" — real files start at index 1. Paths are project-root-relative (root_relative_key), not process-cwd-relative or absolute.

Fields§

§surface: FileSurface§path: String§source_hash: u64

content_hash of this file’s text exactly as the compiler consumed it (#3261) — no normalisation of line endings, whitespace or encoding on either side. A reader that hashes differently-normalised text will see a spurious mismatch, so the contract is the raw bytes that were compiled.

Lets a consumer detect that the source it is measuring against is not the source this program was built from, and answer StaleSource instead of a confidently wrong address. That failure applies to byte ranges every bit as much as to line numbers — offsets shift on every inserted character.

Per-file, deliberately: one dirty file then degrades debugging in that file alone, where a whole-program checksum degrades everything.

0 for the reserved synthetic sentinel at index 0, which names no real file.

§line_starts: Vec<u32>

Byte offset of the start of each line in this file, ascending, with line_starts[0] == 0 (#3261). Length is the file’s line count.

Carrying this means the engine can answer file:line without being handed source text at all — which is what a remote debugger frontend (DAP’s setBreakpoints is file + line) needs, and what keeps line↔byte conversion to one implementation instead of one per consumer. Line indexing is 0-based here; a UI showing 1-based line numbers converts at its own edge.

Empty for the synthetic sentinel, and legitimately empty for an empty file.

Trait Implementations§

Source§

impl Clone for DebugFileEntry

Source§

fn clone(&self) -> DebugFileEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DebugFileEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DebugFileEntry

Source§

impl PartialEq for DebugFileEntry

Source§

fn eq(&self, other: &DebugFileEntry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DebugFileEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.