Open
Description
REPRODUCTION: https://www.rustexplorer.com/b/oe3uh4
error:
error: `impl Executor` does not live long enough
--> src/main.rs:136:5
|
136 | / async move {
137 | | dbg!("I'm:", user);
138 | |
139 | | let mut store = store.unwrap_or_default();
... |
169 | | }
170 | | .boxed()
| |____________^
Some code:
fn query_teams<'a>(
user: &'a str,
db: &'a mut impl Executor,
store: Option<Store>,
with_player: bool,
) -> BoxFuture<'a, Store> {
async move {
dbg!("I'm:", user);
let mut store = store.unwrap_or_default();
let mut query = sqlx::QueryBuilder::new(r#"SELECT "teams".*" FROM "teams"#);
let teams = query
.build_query_as::<Team>()
.fetch_all(db.as_executor())
.await
.unwrap();
for team in teams {
store.teams.insert(team.id.to_string(), team);
}
if with_player {
store = query_players(user, db, Some(store), false).await;
}
store
}
.boxed()
}
error: `impl Executor` does not live long enough
--> src/main.rs:136:5
|
136 | / async move {
137 | | dbg!("I'm:", user);
138 | |
139 | | let mut store = store.unwrap_or_default();
... |
169 | | }
170 | | .boxed()
| |____________^
Meta
rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-pc-windows-msvc
release: 1.69.0
LLVM version: 15.0.7
Metadata
Metadata
Assignees
Labels
Area: Generic associated types (GATs)Area: Async & AwaitArea: Messages for errors, warnings, and lintsArea: Lifetimes / regionsAsync-await issues that have been triaged during a working group meeting.Category: This is a bug.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Status: A Minimal Complete and Verifiable Example has been found for this issue