#8492·tokio

Enchance the `Competion` enum/struct to avoid representing invalid states in io-uring

Author: Daksh14Created Sep 17, 2026Updated Sep 17, 2026
LabelsC-bugA-tokioT-io-uring

Version tokio_unstable 1.53

Platform linux

Description Completion should be represented with a state machine roughly like

rust
pub(crate) enum Completion<T, R> {
    Done { result: io::Result<T>, resources: R },
    Cancelled(io::Error),
}

impl<B: ReadBuffer, F: UringFd> Completable for Read<B, F> {
    type Output = Completion<u32, ReadResources<F, B>>;

   ...
}

struct ReadResources<B, F = ArcFd> {
    fd: F,
    buf: B,
}

To avoid states like (Ok(), None, Some)