pub struct Session {
pub opts: Options,
pub target: TargetInfo,
pub interner: Interner,
/* 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.
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more