You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using slices into source instead of source+span. (nom uses this approach)
Using slice in error description
#[derive(Error,Diagnostic,Debug,Clone,PartialEq)]#[error("return type mismatch: got \"{got}\", expected \"{expected}\"")]pubstructReturnTypeMismatch<'i>{/// Type of return valuepubgot:String,/// Span of returned value#[label("this has \"{got}\" type")]pubgot_span:SourceSpan,/// Expected type of return valuepubexpected:&'i str,#[label("return type specified here")]pubexpected_span:SourceSpan,// <- This may be inferred from `expected`}
could be changed to
#[derive(Error,Diagnostic,Debug,Clone,PartialEq)]#[error("return type mismatch: got \"{got}\", expected \"{expected}\"")]pubstructReturnTypeMismatch<'i>{/// Type of return valuepubgot:String,/// Span of returned value#[label("this has \"{got}\" type")]pubgot_span:SourceSpan,/// Expected type of return value// Maybe need to add something like: #[source_slice] #[label("return type specified here")]// <- assumes that this is subslice of source codepubexpected:&'i str,}
The text was updated successfully, but these errors were encountered:
SourceSlice
may be helpful when:source+span
. (nom
uses this approach)could be changed to
The text was updated successfully, but these errors were encountered: