Unused lifetime in params when is-copy = false

Abierto
#282 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
postgresql, rust

Línea de trabajo

Start by finding the code that generates query parameter structs and borrowed row structs for mappings with is-copy = false; the issue shows the generated output in crates/clorinde/src/queries/repro.rs. Trace how generated lifetimes are added when mapped fields do not borrow data, then check the generated structs compile without unused lifetime errors for the provided pgvector mapping and query.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

codegen

Migrated from halcyonnouveau/clorinde#257, originally reported by @SinnySupernova on 2026-05-09.

Describe the bug

I'm mapping pgvector and having compiler tell me about unsed lifetime:

error[E0392]: lifetime parameter `'a` is never used
 --> crates/clorinde/src/queries/repro.rs:4:32
  |
4 | pub struct SearchVectorsParams<'a> {
  |                                ^^ unused lifetime parameter
  |
  = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

error[E0392]: lifetime parameter `'a` is never used
  --> crates/clorinde/src/queries/repro.rs:13:30
   |
13 | pub struct VectorRowBorrowed<'a> {
   |                              ^^ unused lifetime parameter
   |
   = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

Reproduction

clorinde.toml (tried with or without borrowed-type)

[types.mapping]
"public.vector" = { rust-type = "pgvector::Vector", borrowed-type = "pgvector::Vector", is-copy = false }

query

--! search_vectors : VectorRow()
SELECT id, embedding FROM vectors
ORDER BY embedding <=> :query_embedding
LIMIT :limit;

result struct file

// This file was generated with `clorinde`. Do not modify.

#[derive(Debug)]
pub struct SearchVectorsParams<'a> {
    pub query_embedding: pgvector::Vector,
    pub limit: i64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct VectorRow {
    pub id: uuid::Uuid,
    pub embedding: pgvector::Vector,
}
pub struct VectorRowBorrowed<'a> {
    pub id: uuid::Uuid,
    pub embedding: pgvector::Vector,
}
impl<'a> From<VectorRowBorrowed<'a>> for VectorRow {
    fn from(VectorRowBorrowed { id, embedding }: VectorRowBorrowed<'a>) -> Self {
        Self {
            id,
            embedding: embedding.into(),
        }
    }
}
// ... more stuff
Expected behavior

no angry compiler

Logs

Additional context

there is halcyonnouveau/clorinde#186 that had similar for the return types

Severity

Annoyance

Lenguaje dominante
Rust
Estrellas
1.2k
Forks
77
Merge medio
5 d 12 h
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cornucopia-rs/cornucopia

Todos los issues de cornucopia-rs/cornucopia

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.