Regression: false negative lint dead_code: dead code is not detected for struct if it implements FromStr
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
I tried this code:
#![deny(dead_code)]
impl std::str::FromStr for Foo {
type Err = ();
fn from_str(_s: &str) -> Result<Self, Self::Err> {
panic!();
}
}
struct Foo;
fn main() {}
I expected to see this happen: compiler should report that struct Foo is never constructed
Instead, this happened: compiler didn't report this
Version it worked on
It most recently worked on: nightly-2019-08-27
Version with regression
nightly-2019-08-28
Notes
cargo-bisect-rustc reports that the following commits happened between these two versions:
get_commits_between returning commits, len: 5
commit[0] 2019-08-26: Auto merge of #63901 - estebank:unknown-receiver-type, r=zackmdavis
commit[1] 2019-08-27: Auto merge of #63926 - Centril:rollup-6kckn9n, r=Centril
commit[2] 2019-08-27: Auto merge of #63940 - Centril:rollup-47qe9gn, r=Centril
commit[3] 2019-08-27: Auto merge of #63639 - Mark-Simulacrum:rustdoc-clean-3, r=GuillaumeGomez
commit[4] 2019-08-27: Auto merge of #63922 - RalfJung:miri, r=nikomatsakis
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged +A-lints +L-dead_code +L-false-negative
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the regression with the minimal Rust example using #![deny(dead_code)] and the FromStr implementation for Foo. Use cargo-bisect-rustc across nightly-2019-08-27 and nightly-2019-08-28, then inspect the five intervening commits. Done means the compiler reports that Foo is never constructed while retaining correct FromStr behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100