Error fix suggestion request: replace `Self` with more lifetime lenient self type name
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
The payload gives a minimal SliceMut reproducer and the current and desired lifetime may not live long enough output. Start by finding where that borrowck message is emitted and where the existing Self suggestion logic lives in rustc. Done means the note replace Self with SliceMut appears for this case, with a UI test added under tests/ui that matches the desired output.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Code
pub struct SliceMut<'a, T>(&'a mut [T]);
impl<'a, T> SliceMut<'a, T> {
pub fn subslice_ok(&mut self, start: usize, end: usize) -> SliceMut<'_, T> {
SliceMut(&mut self.0[start .. end])
}
pub fn subslice_fail(&mut self, start: usize, end: usize) -> SliceMut<'_, T> {
Self(&mut self.0[start .. end])
}
}
Current output
error: lifetime may not live long enough
--> src/lib.rs:10:14
|
4 | impl<'a, T> SliceMut<'a, T> {
| -- lifetime `'a` defined here
...
9 | pub fn subslice_fail(&mut self, start: usize, end: usize) -> SliceMut<'_, T> {
| - let's call the lifetime of this reference `'1`
10 | Self(&mut self.0[start .. end])
| ^^^^^^^^^^^^^^^^^^^^^^^^^ this usage requires that `'1` must outlive `'a`
Desired output
error: lifetime may not live long enough
--> src/lib.rs:10:14
|
4 | impl<'a, T> SliceMut<'a, T> {
| -- lifetime `'a` defined here
...
9 | pub fn subslice_fail(&mut self, start: usize, end: usize) -> SliceMut<'_, T> {
| - let's call the lifetime of this reference `'1`
10 | Self(&mut self.0[start .. end])
| ^^^^^^^^^^^^^^^^^^^^^^^^^ this usage requires that `'1` must outlive `'a`
note: replace `Self` with `SliceMut`
Rationale and extra context
rustc should suggest replacing concrete type Self with the not-lifetime-bound self type name when those lifetimes differ
Other cases
Rust Version
rustc 1.101.0-nightly (1a2c4797e 2026-10-21)
binary: rustc
commit-hash: 1a2c4797ef2570bd76ca5dee34449169bc7dc457
commit-date: 2026-10-21
host: x86_64-unknown-linux-gnu
release: 1.101.0-nightly
LLVM version: 23.1.4
Anything else?
No response
- 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
-
Thai project names become 'project', 'project-2'… (slug keeps ASCII only)Posiblemente ocupada @mastel2 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
storytold/craft-anything#2538 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
compiler-explorer/compiler-explorer#9738 ·
Los mantenedores suelen responder en 2 días
-
area: runtime enhancement good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
hffgzktbcc-blip/ounce-core#663 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
zellij-org/zellij#6026 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
tamatebako/tebako#1155 ·
Los mantenedores suelen responder en 1 día