-
Notifications
You must be signed in to change notification settings - Fork 4
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
Try on rustc #2
Comments
Thanks for your interest in warnalyzer! Rustc is definitely one of the targets. You need to watch out though because projects like clippy use rustc as well. Also, there are a few bugs in save-analysis generation in rustc which create tons of false positives (see readme). So be ready for the main job being filtering out of false positives :). Someone familiar with rustc using warnalyzer is a very great idea as this increases the chances of those bugs fixed dramatically :p. You could probably add the save-analysis flag somewhere in rustbuild's rustc wrapper and build stage0 compiler artifacts with it. Then point warnalyzer at the rustc binary crate. If you need any help, I'm right there. |
:)
Thanks! |
rust $ git diff
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 9c01de8aa8..bea1f21272 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -45,6 +45,9 @@ fn main() {
}
}
+
+ args.push("-Zsave-analysis".into());
+
// Detect whether or not we're a build script depending on whether --target
// is passed (a bit janky...)
let target = args.windows(2)
rust $ ./x.py check
rust $ cd ../warnalyzer
warnalyzer $ cargo run ../rust/build/x86_64-*/stage0-rustc/x86_64-*/release/deps/save-analysis/rustc_binary-*.json | wc -l
2612 |
…enkov,varkor Remove unused code Rustc has a builtin lint for detecting unused code inside a crate, but when an item is marked `pub`, the code, even if unused inside the entire workspace, is never marked as such. Therefore, I've built [warnalyzer](https://github.com/est31/warnalyzer) to detect unused items in a cross-crate setting. Closes est31/warnalyzer#2
rust-lang/rust#77739 is merged, closing. |
Might be fun to find out how much of rustc is actually unused.
The text was updated successfully, but these errors were encountered: