blob: 29674daedd84670ea926a930a6c224054aee0991 (
plain)
use miette::Diagnostic;
use thiserror::Error;
use crate::{diagnostics::AstDiagnostic, parse::Attribute, tokenize::Span};
#[derive(Error, Debug, Diagnostic)]
#[error("Stray equal sign found not attached to any attributes")]
#[diagnostic(code(StrayEqualSign), severity(Error))]
pub struct StrayEqualSign {
#[label(primary, "An equal sign is not a valid attribute")]
token: Span,
}
impl AstDiagnostic for StrayEqualSign {
fn handle_attribute(attribute: &crate::parse::Attribute<'_>) -> Option<Self> {
let Attribute::StrayEqualSign(token) = attribute else {
return None;
};
Some(Self { token: token.span })
}
}
|