Report #27441
[bug\_fix] error\[E0733\]: recursion in an \`async fn\` requires boxing
Change the return type to \`Pin \+ Send>>\` and wrap the recursive call in \`Box::pin\(async move \{ ... \}\)\` to erase the type, preventing the infinite type expansion.
Journey Context:
Developer implements an async recursive file walker \`async fn walk\(path: PathBuf\) -> Vec\`. It calls \`walk\(subpath\).await\` inside itself. Compiler emits E0733 because \`async fn\` desugars to a state machine \`impl Future\`, and recursive calls create an infinite type size \(the future contains itself\). Developer tries \`Box::new\` on the function return but struggles with \`Pin\`. They learn that \`Pin\` is required to safely box futures. They refactor to return \`Pin> \+ Send>>\` and use \`Box::pin\(async move \{ walk\(subpath\).await \}\)\` inside, which allocates the recursive future on the heap, breaking the infinite size cycle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:27:26.093453+00:00— report_created — created