pub struct BopWarning {
pub line: Option<u32>,
pub column: Option<u32>,
pub message: String,
pub friendly_hint: Option<String>,
}Expand description
Non-fatal diagnostic surfaced by static checks that run
after parsing (currently: match-exhaustiveness analysis in
crate::check). Shape mirrors BopError so the same
source-snippet rendering works; the only divergence is the
leading header, which says warning: instead of error:.
Warnings never halt execution — they’re informational. The
CLI prints them and then runs the program anyway. Embedders
that want to treat them as errors can call
BopWarning::into_error.
Fields§
§line: Option<u32>§column: Option<u32>§message: String§friendly_hint: Option<String>Implementations§
Source§impl BopWarning
impl BopWarning
Sourcepub fn at(message: impl Into<String>, line: u32) -> Self
pub fn at(message: impl Into<String>, line: u32) -> Self
Convenience constructor that matches BopError::runtime’s
shape so check passes can build warnings at a single
source line.
Sourcepub fn with_hint(self, hint: impl Into<String>) -> Self
pub fn with_hint(self, hint: impl Into<String>) -> Self
Attach a “hint:” line to the rendered output. Chained from the constructor so call sites stay tidy.
Sourcepub fn into_error(self) -> BopError
pub fn into_error(self) -> BopError
Promote the warning to a fatal BopError with the same
fields. Useful for -Werror-style embedders.
Sourcepub fn render(&self, source: &str) -> String
pub fn render(&self, source: &str) -> String
Render the warning with a source snippet. Mirrors
BopError::render but leads with warning: rather
than error:.
Trait Implementations§
Source§impl Clone for BopWarning
impl Clone for BopWarning
Source§fn clone(&self) -> BopWarning
fn clone(&self) -> BopWarning
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more