-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Configure snippets renderer to match rustc/Cargo style #15689
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
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
@@ -415,7 +415,11 @@ impl Shell { | |||
writeln!( | |||
self.err(), | |||
"{}", | |||
Renderer::styled().term_width(term_width).render(message) | |||
Renderer::styled() | |||
.note(NOTE) |
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 should be a pr to annotate snippets if there is a discrepancy
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 don't understand.
shell.render_message(Level::Note.title("foo"))
uses a wrong color. The snippets don't specify a color themselves by design, the color is imposed on the snippets by the stylesheet initialized by styled()
.
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.
Oh, I see. I thought the CI test failure was a false positive:
Summary semver requires new major version: 1 major and 0 minor checks failed
--- failure constructible_struct_adds_field: externally-constructible struct adds field ---
Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/constructible_struct_adds_field.ron
but there's also a UI test failing.
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.
The expectation is that annotate-snippets
defaults are rustc's defaults. If annotate-snippets
is not matching rustc, then that is a bug with annotate-snippers
that should be resolved. We should not work around that bug in Cargo.
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.
Also, i would recommend being pretty sure about a resolution when marking things resolved, otherwise leave it to the original person. While this is a smaller PR and so its less likely to be lost, in larger PRs that can easily make it so misunderstood feedback gets lost.
Renderer::styled()
defaults to green labels fornote
andhelp
, but Cargo andrustc
use cyan.