-
Notifications
You must be signed in to change notification settings - Fork 221
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
feat: don't report warnings for dependencies #6926
base: master
Are you sure you want to change the base?
Conversation
Compilation Report
|
Execution Report
|
Peak Memory Sample
|
Hmm, forcing the user to pass around another piece of compiler state is a little sad. I'd like to avoid this if possible but would need to think more on this. |
The set of root files could be tracked by |
I'm thinking that there's enough information for what we want inside of the
By reading the noir/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs Lines 1121 to 1125 in ebc4d2c
We should then be able to generate this list after the fact rather than needing to pass it around externally to the compiler. Note that this method will mean that we ignore any warnings outside of the current crate as opposed to the current workspace. This seems to be closer to what we want imo as it will avoid a workspace library from having its warnings emitted many times (this also matches up with cargo behaviour). |
We could also track this a little more explicitly inside of the compiler state but the above is a "zero footprint" solution. Edit: agreed that it would be best to keep |
Sounds good, I'll do what you say in the first comment. I was thinking that eventually it would be nice for the compiler to be able to compile crates modularly. It's a bit strange that we read all files of all packages and all dependencies in one go. Ideally we'd process a package by reading its files, compiling it, then moving to dependent packages, even being able to parallelize things... though I know that would be a huge refactor, but in the way we'd get "for free" errors and warnings grouped by package. |
Almost there! In |
We can filter the returned warnings inside of the compiler before we pass it back up to |
The main reason is that for LSP we'd still want to show warnings in crates that are open in the UI but are not the main crate. Though I guess not doing would be fine too... |
It worked! And for some reason it works well in LSP too, maybe the code there is slightly different, or maybe all crates are checked, not sure. |
Execution Memory Report
|
Compilation Memory Report
|
I'm getting zero warnings being thrown in aztec-packages when using this PR despite there definitely being warnings that should be thrown. |
Good catch, I might have changed something in the end that broke it. Now it's fixed. |
Description
Problem
Resolves #6909
Summary
The way this is done here is:
Additional Context
The name of the branch has "2" in it because at first I tried a different approach: avoid collecting warnings as soon as we encounter them in dependencies. However, this is much more complex because we can't immediately know if an error is a warning or not (we have to turn it into a Diagnostic first, or introduce a large refactor to track this separately) and also in LSP it makes sense to track errors from dependencies if they are tracked by the editor, so it doesn't make sense to exclude them right away.
Documentation
Check one:
PR Checklist
cargo fmt
on default settings.