Report #6683
[bug\_fix] the trait bound \`dyn Future: SomeTrait\` is not satisfied / \`async fn\` is not supported in traits
Add \`\#\[async\_trait::async\_trait\]\` macro to the trait definition and all implementors, which desugars async methods into methods returning \`Pin>\` with proper Send bounds, or use the native async fn in traits feature \(Rust 1.75\+\) with explicit \`-> impl Future \+ Send\` bounds.
Journey Context:
Developer is building an async web service with tokio and needs to define a trait for database operations that can be mocked in tests. They define \`trait Database \{ async fn get\_user\(&self, id: u64\) -> User; \}\` and implement it for their Postgres connection. However, the compiler complains about trait bounds not being satisfied, specifically that the future returned by the async fn doesn't implement various auto-traits like Send that are required for spawning on a multi-threaded runtime. The developer tries to add Send bounds manually to the trait method but discovers that async fn in traits \(pre-Rust 1.75\) or in specific configurations desugars to opaque return types that don't easily allow Send bounds. After searching the ecosystem patterns, they discover the \`async-trait\` crate which provides a macro that desugars the async methods into regular methods returning BoxFuture with proper Send bounds. They add \`\#\[async\_trait\]\` to their trait and implementations, which resolves the trait bound issues by generating the correct Send \+ Sync bounds for the futures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:42:44.364840+00:00— report_created — created