pub struct EmitOptions<'a> {
pub emit_debug_info: bool,
pub debug_sources: Option<&'a BTreeMap<FileId, String>>,
}Expand description
Codegen-facing knobs for one emit call. emit_debug_info is the only
field today — a struct (not a bare bool parameter) so a future knob
(e.g. a D7 “populate locals” toggle) doesn’t need another emit_with_*
overload.
Fields§
§emit_debug_info: boolEmit the SectionKind::DebugInfo section (docs/debugger-spec.md
§2). false (the Default) reproduces today’s emit() behavior
byte-for-byte — this is what the ship-policy ruling (§1.2) and the
oracle-safety guarantee both depend on.
debug_sources: Option<&'a BTreeMap<FileId, String>>Source text per file, for the DebugInfo file table’s source_hash
and line_starts (#3261). Only read when emit_debug_info is set,
so a release compile never pays for gathering it.
The text must be exactly what the compiler consumed — the hash is a staleness detector and any normalisation applied here but not by a later reader (or vice versa) turns it into a permanent false alarm.
None (or a file missing from the map) means that file’s entry gets
source_hash: 0 and no line index: the section is still valid and
positions still resolve, but staleness cannot be detected and
file:line lookups for that file are unavailable. Degrading rather
than failing is deliberate — a debug artifact without the extras
beats no debug artifact.
Trait Implementations§
Source§impl<'a> Clone for EmitOptions<'a>
impl<'a> Clone for EmitOptions<'a>
Source§fn clone(&self) -> EmitOptions<'a>
fn clone(&self) -> EmitOptions<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more