diff --git a/Cargo.lock b/Cargo.lock index 69fe3ba159..640d9b97ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1029,12 +1029,6 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" - [[package]] name = "hashbrown" version = "0.11.2" @@ -1050,7 +1044,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" dependencies = [ - "hashbrown 0.11.2", + "hashbrown", ] [[package]] @@ -1115,12 +1109,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg 1.0.1", - "hashbrown 0.9.1", + "hashbrown", ] [[package]] @@ -2424,6 +2418,7 @@ dependencies = [ "hashlink", "hex", "hmac", + "indexmap", "ipnetwork", "itoa", "libc", diff --git a/tests/sqlite/sqlite.rs b/tests/sqlite/sqlite.rs index e794f49a74..ea983540e9 100644 --- a/tests/sqlite/sqlite.rs +++ b/tests/sqlite/sqlite.rs @@ -567,3 +567,26 @@ async fn concurrent_resets_dont_segfault() { sqlx_rt::sleep(Duration::from_millis(1)).await; } + +// https://github.com/launchbadge/sqlx/issues/1419 +// note: this passes before and after the fix; you need to run it with `--nocapture` +// to see the panic from the worker thread, which doesn't happen after the fix +#[sqlx_macros::test] +async fn row_dropped_after_connection_doesnt_panic() { + let mut conn = SqliteConnection::connect(":memory:").await.unwrap(); + + let books = sqlx::query("SELECT 'hello' AS title") + .fetch_all(&mut conn) + .await + .unwrap(); + + for book in &books { + // force the row to be inflated + let _title: String = book.get("title"); + } + + // hold `books` past the lifetime of `conn` + drop(conn); + sqlx_rt::sleep(std::time::Duration::from_secs(1)).await; + drop(books); +}