Why this fires¶
Use a typed Future or Task with a duration literal, an admitted temporal unit or anonymous temporal Quantity, or an actual std::time::Duration allocation.
async fn load() -> int { sleep 20ms; 42 }
let result = await load() within 1sThe result is the canonical Result<T, std::async::TimeoutError>. A task's own Result stays nested in its Ok payload. Ordinary task failures and cleanup panics remain ordinary failures.
The compiler checks both children in the caller's lexical region, first the awaitable and then the interval. Each runs once before installing the deadline. A number, Any, an unrelated Duration declaration, and public _ms fields do not prove a temporal interval or an authentic runtime allocation.
Intervals use exact arithmetic. Zero stays zero; a positive fraction of a nanosecond rounds up to one nanosecond. Negative, nonfinite, excessive, or unrepresentable intervals fail before the observer starts.
Timeout waits for the selected producer and its owned cleanup to drain. Foreign jobs require actual acknowledgement. Streaming fetch has no authenticated body transfer for this feature and reports an explicit unsupported boundary. Native and LLVM fetch deadlines require an actual async Response host ABI.
Await deadlines inside generators use TE224. JavaScript, comptime and unsupported wasm task backends report their explicit capability boundary.