From 3958db0a8bbbab0090177cad3753ce8aad77e7a7 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 24 Jul 2026 23:10:22 -0400 Subject: [PATCH] desktop M10.4: fix stmt lifetime in reminders/search Both chained `stmt.query_map(...)?.collect()?` as the block's tail expression, so the prepared statement (a block local) was dropped before the borrow held by the mapped rows ended (E0597). Bind `let rows` first, matching every other query in the file. rustc error, so this also unblocks test + the release build. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm --- desktop/src-tauri/src/local/store.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/src-tauri/src/local/store.rs b/desktop/src-tauri/src/local/store.rs index 5899da7..7c6533f 100644 --- a/desktop/src-tauri/src/local/store.rs +++ b/desktop/src-tauri/src/local/store.rs @@ -302,8 +302,8 @@ pub fn reminders(conn: &Connection) -> rusqlite::Result> { let ids: Vec = { let mut stmt = conn.prepare("SELECT id FROM notes WHERE trashed = 0 AND remind_at IS NOT NULL ORDER BY remind_at ASC")?; - stmt.query_map([], |r| r.get::<_, String>(0))? - .collect::>>()? + let rows = stmt.query_map([], |r| r.get::<_, String>(0))?; + rows.collect::>>()? }; ids.iter().map(|id| load_note(conn, id)).collect() } @@ -327,8 +327,8 @@ pub fn search(conn: &Connection, q: &str) -> rusqlite::Result> { let mut stmt = conn.prepare( "SELECT id FROM notes WHERE trashed = 0 AND (title LIKE ?1 ESCAPE '\\' OR body LIKE ?1 ESCAPE '\\') ORDER BY updated_at DESC", )?; - stmt.query_map([&pat], |r| r.get::<_, String>(0))? - .collect::>>()? + let rows = stmt.query_map([&pat], |r| r.get::<_, String>(0))?; + rows.collect::>>()? }; ids.iter().map(|id| load_note(conn, id)).collect() }