`mismatched_lifetime_syntaxes` suggests a machine-applicable edit that breaks shared macro invocations
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
- 43/100
Línea de trabajo
Start by reading the mismatched_lifetime_syntaxes lint implementation and its diagnostic tests; the issue does not name specific files. Reproduce the provided macro example and inspect how suggestions are emitted for multiple invocations. Done means the lint still warns but no longer marks an edit as machine-applicable when applying it breaks another invocation.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Issue description
I found bug in Rust’s mismatched_lifetime_syntaxes lint. When 2 functions use the same macro in their return types, one with 'a and the other with 'b, the compiler suggests adding each lifetime at the same place in the macro definition and marks both edits MachineApplicable. Applying either automatic edit makes the other function fail with E0261 because the inserted lifetime name is out of scope there. I reproduced this on Rust 1.100.0 and Rust 1.102.0-nightly (6c709eb42), and cannot find a matching issue or PR yet.
Code
#![allow(dead_code)]
struct Wrap<'a>(&'a u8);
macro_rules! out {
() => {
Wrap
};
}
fn first<'a>(x: &'a u8) -> out!() {
Wrap(x)
}
fn second<'b>(x: &'b u8) -> out!() {
Wrap(x)
}
Current output
Compiler output from Rust 1.102.0-nightly:
warning: hiding a lifetime that's named elsewhere is confusing
help: consistently use `'a`
7 | Wrap<'a>
| ++++
warning: hiding a lifetime that's named elsewhere is confusing
help: consistently use `'b`
7 | Wrap<'b>
| ++++
error[E0261]: use of undeclared lifetime name `'a`
7 | Wrap<'a>
| ^^ undeclared lifetime
...
15 | fn second<'b>(x: &'b u8) -> out!() {
| ------ in this macro invocation
Test observation: Applying the 'a suggestion at line 7, column 13 (MachineApplicable) produces the E0261 error shown above.
Rust Version
rustc 1.102.0-nightly (6c709eb42 2026-11-25)
binary: rustc
commit-hash: 6c709eb428d472a3c3d93681c1ba37d44a1c27cf
commit-date: 2026-11-25
host: aarch64-apple-darwin
release: 1.102.0-nightly
LLVM version: 23.1.6
Desired output
The lint should continue warning about the inconsistent lifetime syntax, but avoid suggesting an automatic edit that breaks another macro invocation.
AI assistance
I used AI assistance to help discover and verify this bug. I independently reproduced it on the listed Rust versions before filing.
- 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
-
bug P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
bug core-lang
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Windows microphone listing treats words in a device name as DirectShow labelsPosiblemente ocupada @Sujal-chaudhary la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
clipy-recorder/clipy#447 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
nightly-cleanup
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
max-sixty/worktrunk#4939 · 1 reacción ·
Los mantenedores suelen responder en 1 día