-
Notifications
You must be signed in to change notification settings - Fork 88
refactor(interface): Update annotation_snippets emitter #602
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
refactor(interface): Update annotation_snippets emitter #602
Conversation
DaniPopes
left a comment
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.
Thanks, looks right. I'd like @0xrusowsky to give a look first
Overall, there is only one test output changed, which is due to the mentioned change in emitter behavior.
I'm surprised that the behavior stayed mostly the same.
I guess that's a good thing!
0xrusowsky
left a comment
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 think it makes sense overall, just left a couple of nits
| } | ||
| fn shrink_file( | ||
| spans: &[Span], | ||
| _file_name: &FileName, |
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.
nit: should we drop this param if unused?
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.
to keep as close as possible to upstream
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.
is there a reason to move this macro from crates/interface/src/lib.rs?
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.
cannot be in the same crate due to macro_expanded_macro_exports_accessed_by_absolute_paths
Resolve #592
I think the linked issue explains the motivation well enough. I'll list the considerations and changes here for clarity:
that are duplicated or not well structured are kept.
There are part that data is cloning to preserve the ported code behavior.
FileNameand source code handling are simplified as Solardoes not need to handle as much cases as Rustc.
the diagnostic in 4 parts, while Rustc does not separate into parts at all.
I made the change to keep the footer part, and the rest are combined into one like in Rustc.
diagnostics/emitter/rustc.rscompletely obsolete.I still kept it though in case that
FileWithAnnotatedLines::collect_annotations's behavior is more desired.Overall, there is only one test output changed, which is due to the mentioned change in emitter behavior.
I'm surprised that the behavior stayed mostly the same.
Please take a look and let me know if there are any issues. I think the code can be refactored further, either in
this PR or in a separate one.