Conversation
edcff6f to
930da71
Compare
There was a problem hiding this comment.
🔢 Self-check (PR reviewed by myself and ready for feedback)
-
Code compiles successfully
-
Unit tests added
-
No AI-generated elegant nonsense in PR.
-
Comments added where necessary
-
PR title and description updated
-
Documentation PR created (or confirmed not needed)
-
PR size is reasonable
r? @epage
| } | ||
|
|
||
| let bcx = create_bcx(ws, options, &interner, logger.as_ref())?; | ||
| crate::diagnostics::rules::mostly_unused_hint::diagnose(&bcx)?; |
There was a problem hiding this comment.
Note: The change moved diagnostics before compilation, so the same check now reports warnings even without rebuilding.
There was a problem hiding this comment.
I believe we already have some warnings reported even without rebuilding, so I guess this seems fine.
| if gctx.cli_unstable().profile_hint_mostly_unused { | ||
| continue; | ||
| } | ||
| let profile_hint = unit.profile.hint_mostly_unused; |
There was a problem hiding this comment.
I tried to find its source, but doing so here is too complex. It would almost require us to reimplement the precedence resolution.
| // Profile options come from the workspace itself, so they are reported even for | ||
| // non-local packages. | ||
| let title = format!( | ||
| "ignoring `hint-mostly-unused` profile option for `{}@{}`", |
There was a problem hiding this comment.
Why are we showing a package spec, rather than having an Origin element?
There was a problem hiding this comment.
See #17457 (comment)
If we want to find the exact original element, we have to mirror its precedence resolution here. I tried it, but it seemed too complex, so I abandoned it. So I decided to simply hint that this package has a profile option that has been ignored.
There was a problem hiding this comment.
But I’ll try to do it in the parse pass. I guess that would make it easier.
| } | ||
|
|
||
| let bcx = create_bcx(ws, options, &interner, logger.as_ref())?; | ||
| crate::diagnostics::rules::mostly_unused_hint::diagnose(&bcx)?; |
There was a problem hiding this comment.
Should these be in the parse pass?
| mod manual_readme; | ||
| mod missing_lints_features; | ||
| mod missing_lints_inheritance; | ||
| pub mod mostly_unused_hint; |
There was a problem hiding this comment.
This is a bit weird being publibc. Should we give it a lint pass instead, or should we make a new lint pass for it?
There was a problem hiding this comment.
Another diagnostic does this as we still work out what the diagnostic pass should look like. We only created a formal pass for parsing once we understood it.
930da71 to
74fda82
Compare
74fda82 to
be89b18
Compare
be89b18 to
9c72948
Compare
What does this PR try to resolve?
Try to use
annotate-snippetsto report mostly unused warnings. Inspired by #17368 (comment).How to test and review this PR?
Check the unit tests and review each commit individually.
r?@ghost
LLM disclosure: The unit tests were generated by AI.