pub struct Session {
pub opts: Options,
pub target: TargetInfo,
pub interner: Interner,
pub sources: SourceMap,
/* private fields */
}Expand description
One compilation.
Holds the options, the string interner and the diagnostics raised so far. Passing a
&mut Session is how a stage reports a problem, and the return value of a stage says
what it produced, never whether it succeeded: that question is answered by
Session::has_errors.
Fields§
§opts: OptionsWhat this compilation was asked to do.
target: TargetInfoEverything known about the target.
interner: InternerThe one interner for the compilation.
sources: SourceMapEvery file read during the compilation, and the flat coordinate space their spans live in.
This is on the session rather than passed around separately because a span is only meaningful against the map that issued it, and one map per compilation is the rule that makes that true by construction.
Implementations§
Source§impl Session
impl Session
Sourcepub fn emit(&mut self, diag: Diagnostic)
pub fn emit(&mut self, diag: Diagnostic)
Records a diagnostic.
Under -Werror a warning is promoted here, once, rather than at every site that
raises one.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Everything raised so far, in the order it was raised.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether anything fatal has been raised.
Sourcepub fn error_count(&self) -> u32
pub fn error_count(&self) -> u32
How many errors have been raised.
Sourcepub fn warning_count(&self) -> u32
pub fn warning_count(&self) -> u32
How many warnings have been raised.
Sourcepub fn error_limit_reached(&self) -> bool
pub fn error_limit_reached(&self) -> bool
Whether the error limit has been reached and the caller should stop.