1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2026 Mike Grier
//! [`OperationId`]: the name of one in-flight operation.
//!
//! The module is still called `token` because `Token<T>` lived here until
//! `M28.4.1d` retired it; the file name is private (`mod token;`) and renaming
//! it would churn history for no reader's benefit.
use crateRingId;
/// The name of one in-flight operation, carrying no claim on anything.
///
/// Returned by a push so a caller can *refer* to the operation it just
/// queued -- to cancel it, to correlate it, or to feed
/// [`crate::contract::RingContract`]. It is `Copy`, has no `Drop`, and losing
/// one is harmless.
///
/// # A name, not a capability (D-71)
///
/// This deliberately carries **no power to retrieve a payload**. The ring
/// hands a payload back only from the pop that observed its completion, which
/// is what makes a use-after-free unrepresentable: there is no call that turns
/// an identity into the memory an operation may still be using.
///
/// That is the same property `Token::claim_if` bought at runtime, and this
/// buys it structurally. The retired `claim_if` took a
/// [`crate::Completion`] rather than a `usize` precisely because a
/// `Completion` has no public constructor, so the only proof the kernel has
/// finished was one that had been popped; a caller-supplied integer would have
/// let safe code free a buffer the kernel was still writing into. `M28.4.1d.3`
/// removed the call rather than the argument: the payload now comes back *from*
/// the pop, so there is no second entry point to guard.
///
/// Handing an `OperationId` to a cancel stays safe for the reason it was always
/// safe to pass a token's id there: a cancel returns no memory.