Unused lifetime in params when is-copy = false
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Rust
- スター
- 1.2k
- フォーク
- 77
- 平均マージ
- 5日 12時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cornucopia-rs/cornucopia のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
cornucopia-rs/cornucopia#334 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
cornucopia-rs/cornucopia#333 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
cornucopia-rs/cornucopia#330 · コメント 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
cornucopia-rs/cornucopia#309 · コメント 2 件 ·
-
configuration feature
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
cornucopia-rs/cornucopia#292 ·
cornucopia-rs/cornucopia の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
n0-computer/iroh#4669 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rubys/roundhouse#1950 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
cloudflare/workers-rs#1130 ·
メンテナーはふだん 11 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
vfarcic/dot-agent-deck#2160 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
RustCrypto/utils#1597 ·
メンテナーはふだん 1 日以内に返信