Cleanup unused diagnostic emission methods - part 2#153509
Cleanup unused diagnostic emission methods - part 2#153509GuillaumeGomez wants to merge 6 commits intorust-lang:mainfrom
Conversation
|
Some changes occurred in match checking cc @Nadrieril Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred to the CTFE / Miri interpreter |
| "cannot use constants which depend on generic parameters in types", | ||
| ); | ||
| }, | ||
| ConstDependingOnGenericParam, |
There was a problem hiding this comment.
I thought we said we'd not convert more things to the struct error style?
There was a problem hiding this comment.
Sorry I don't remember that. Where did we discuss it? Also, we are removing the node_span_lint method to remove the duplicated lint_level function, so there isn't much of a choice, unless we simply wrap the closure in a type.
There was a problem hiding this comment.
Afaik the consensus is that we can use whatever style is prettier. In this case, I think the struct style is quite pretty. I don't like the explicit impl Diagnostic ones in this PR tho, and would like to explore the closure approach for those
| |lint| { | ||
| lint.primary_message(format!("feature `{}` is declared but not used", feature)); | ||
| }, | ||
| UnusedFeature { feature }, |
There was a problem hiding this comment.
I don't really like how positive the diff of this PR is, the explicit Diagnostic implementation is a bit ugly. Could you:
- For diagnostics like this one, use a struct diagnostic instead
- For more complicated ones, see if you can invent a syntax similar to the old one with a closure to make the diagnostics a bit less verbose? If this turns out to be difficult I'm happy to discuss some approaches with you, but I feel like this approach is a bit too verbose
Part of #153099.
r? @JonathanBrouwer