-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't override provided source code #300
Conversation
|
||
use crate::{Diagnostic, LabeledSpan, Report, SourceCode, SourceSpan}; | ||
|
||
#[derive(Error, Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't use derive macro here. Looks like it always expands to miette::
, instead of crate::
. This may be fixed with $crate::
in macro implementation, I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a good patch to have
let underlined = String::from_utf8( | ||
report | ||
.source_code() | ||
.unwrap() | ||
.read_span(&(0..5).into(), 0, 0) | ||
.unwrap() | ||
.data() | ||
.to_vec(), | ||
) | ||
.unwrap(); | ||
assert_eq!(underlined, "hello"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there is a better way to check that sources are equal?
}) | ||
.with_source_code(outer_source.to_string()); | ||
|
||
let message = format!("{:?}", report); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug printing without fancy
feature is broken
Fixes #299