-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Detect unused structs which implement private traits #122382
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use r? to explicitly pick a reviewer |
af4b5be
to
e48bbd3
Compare
r? compiler |
Sorry for the delay, I will try to get to this today! |
@fmease hello, do you have time? it's okay if not. I can roll the dice again ;) |
r? compiler |
Actually, r? petrochenkov |
@rustbot ready |
@petrochenkov friendly ping |
Sorry for the delay, I was either away or busy for quite some time. |
16eb6c2
to
179e046
Compare
179e046
to
9696835
Compare
@rustbot ready |
@bors r+ |
Rollup of 7 pull requests Successful merges: - rust-lang#122382 (Detect unused structs which implement private traits) - rust-lang#124389 (Add a warning to proc_macro::Delimiter::None that rustc currently does not respect it.) - rust-lang#125224 (Migrate `run-make/issue-53964` to `rmake`) - rust-lang#125227 (Migrate `run-make/issue-30063` to `rmake`) - rust-lang#125336 (Add dedicated definition for intrinsics) - rust-lang#125401 (Migrate `run-make/rustdoc-scrape-examples-macros` to `rmake.rs`) - rust-lang#125454 (Improve the doc of query associated_item) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122382 - mu001999:dead_code/enhance, r=petrochenkov Detect unused structs which implement private traits Fixes rust-lang#122361
Hey, I stumbled upon this weird edge case after updating to 1.81 nightly (but this also applies to 1.80 beta).
I thought it came from the binary, which would be extremely weird, because I definitely use this structure to initialize the framebuffer (https://github.com/Soveu/sovos/blob/3b0505cb6dbdc0ac1e7983309100b2d2bd240617/uefi_wrapper/src/main.rs#L55), but upon closer inspection it comes from the library itself:
I assume the "is never constructed" comes from the fact, that this structure doesn't have all the fields public, so it can't be constructed from outside library, so it must be constructed somewhere inside. That is true, I don't construct the structure, but I cast a pointer to this type in the binary, so it definitely is not dead code. I definitely could refactor the code, so that cc @BoxyUwU since we started discussing this PR on discord EDIT: I just found #126169 |
Fixes #122361