-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Split detecting unconstructible pub structs into a new lint from dead_code #128389
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
wired failure:
🤔is there any other way to manually restart gh jobs other than push new? |
compiler/rustc_passes/src/dead.rs
Outdated
let lint = if tcx.visibility(first_item.def_id).is_public() | ||
&& matches!(tcx.def_kind(first_item.def_id), DefKind::Struct) | ||
{ | ||
UNCONSTRUCTIBLE_PUB_STRUCT | ||
} else { | ||
DEAD_CODE | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems very sketchy that this depends on first_item
. Doesn't this suppress dead_code
if a pub ADT comes first in the list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems very sketchy that this depends on
first_item
. Doesn't this suppressdead_code
if a pub ADT comes first in the list?
No, we will only have one pub struct there. Because this function will only be called by warn_dead_code for struct.
This comment has been minimized.
This comment has been minimized.
I will assign to @compiler-errors because he has already started reviewing. |
This PR has the side-effect of now suppressing |
@compiler-errors updated and use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #128404) made this pull request unmergeable. Please resolve the merge conflicts. |
Let's reintroduce this lint later. I will leave it up to you, but this is probably best closed. @rustbot author |
#125572 detects never constructed pub structs, but introduces some regressions (#126169 and #128272).
This does not fix the regressions but just split the detection into a new lint, #127104 and #128329 try to fix them.
I don't know if it is late or not for this PR. But this could at least provide a way to help silence the lint separately for current or potential future regressions.