Misleading warning when a variable is "unused" (used only in unreachable code)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Start with the supplied Rust playground example and compare its diagnostics on Rust 1.100.0 with the earlier behavior referenced in issues #99076 and #115394. The report identifies no compiler files or tests, so first trace how unreachable code and unused-variable warnings are emitted for this example. Done means the final join is reported as unreachable, with the unused-variable warning handled consistently.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Code
let infinite_thread = thread::spawn(|| loop {});
let finite_thread = thread::spawn(|| {});
infinite_thread.join().unwrap();
finite_thread.join().unwrap();
Current output
> warning: unused variable: `finite_thread`
But more importantly, there is not a warning that the last line is unreachable code. I found a few similar issues (#99076, #115394) but in those it sounds like the compiler emitted both warnings, for the unused variable and the unreachable code. In this case I am seeing the unused variable warning only.
Desired output
> warning: unreachable code
either in addition to or instead of the unused variable warning.
Rationale and extra context
I got this warning when upgrading from 1.99 to 1.100 and was confused at first because it seemed quite clear that finite_thread was used.
Rust Version
1.100.0
- Lenguaje dominante
- Rust
- Estrellas
- 123k
- Forks
- 16.6k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 532
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rust-lang/rust
-
strictly_dominates missing a `=`AbiertoC-bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
rust-lang/rust#166722 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
A-attributes relnotes relnotes-needs-review relnotes-tracking-issue T-compiler T-lang
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
A-run-make C-bug T-bootstrap
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Tracking issue for release notes of #161531: Remove `T: Send + Sync` bound from `Arc::downcast`Abiertorelnotes relnotes-tracking-issue T-libs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
A-str A-Unicode relnotes relnotes-tracking-issue T-libs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
Todos los issues de rust-lang/rust
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
tamatebako/tebako#1155 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
swc-project/swc-next-issues#1148 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
registrystack/registry-stack#2828 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit bug priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
SocketDev/socket-patch#2364 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día