-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issue
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
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issue