Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
51fd615
chore(quest): claim quest/m2/ts-drop.md
kixelated Oct 27, 2026
3557c11
Merge remote-tracking branch 'origin/main' into worktree-agent-a78e5d…
kixelated Oct 27, 2026
d8b28dd
feat(ts): drop what std's iterators own
kixelated Oct 27, 2026
ba3bcd5
Merge remote-tracking branch 'origin/main' into worktree-agent-a78e5d…
kixelated Oct 27, 2026
0a01766
feat(ts): skip iterator drop paths where nothing drops, and rewrite t…
kixelated Oct 27, 2026
eb9d876
fix(ts): drop a hash iterator's entries once when a drop panics
kixelated Oct 27, 2026
0ccae57
Merge remote-tracking branch 'origin/main' into worktree-agent-a78e5d…
kixelated Oct 27, 2026
c06f73a
fix(ts): skip from the back as std's `skip`, `take`, and `step_by` do
kixelated Oct 27, 2026
114b9a4
fix(ts): step forward as std's `step_by` does, and saturate its counts
kixelated Oct 27, 2026
1672244
test(ts): a step_by count past usize::MAX saturates
kixelated Oct 27, 2026
e732b4b
fix(ts): a hash iterator that drops nothing reads each entry to count
kixelated Oct 27, 2026
9f7a821
fix(ts): refuse a closure that drops, passed to a map that may drop it
kixelated Oct 27, 2026
1b072d4
fix(ts): read an iterator borrowed by `&mut` through its borrow
kixelated Oct 27, 2026
8fb077e
feat(ts): drop what closures own
kixelated Oct 27, 2026
37cccfa
fix(ts): drop a closure whole only where it is one
kixelated Oct 27, 2026
5871bdb
Merge origin/main into quest/m2/ts-drop
kixelated Oct 27, 2026
2c01ac1
perf(ts): drop-aware iterator paths as functions a bundle can leave out
kixelated Oct 27, 2026
771e3e6
Merge origin/main into quest/m2/ts-drop
kixelated Oct 27, 2026
072f7ae
Merge quest/m2/ts-drop into ts-drop-closures
kixelated Oct 27, 2026
ff5f56c
fix(ts): a panicking collect drops collected items only by their dropper
kixelated Oct 27, 2026
405151c
chore(quest): add ts-iter-nth for std's skips without drops
kixelated Oct 27, 2026
17aba73
Merge origin/main into quest/m2/ts-drop
kixelated Oct 27, 2026
547cd3f
Merge quest/m2/ts-drop into ts-drop-closures
kixelated Oct 27, 2026
a390d5c
fix(ts): split a skip's nth past a usize's greatest as std's does
kixelated Oct 27, 2026
eebf34d
Merge origin/main into quest/m2/ts-drop
kixelated Oct 27, 2026
5594ec5
Merge quest/m2/ts-drop into ts-drop-closures
kixelated Oct 27, 2026
44e7b25
fix(ts): glue for a field generic over lifetimes or a tuple of parame…
kixelated Oct 27, 2026
0fed6e6
Merge quest/m2/ts-drop into ts-drop-closures
kixelated Oct 27, 2026
de3a50a
Merge origin/main into quest/m2/ts-drop
kixelated Oct 27, 2026
514e59d
Merge quest/m2/ts-drop into ts-drop-closures
kixelated Oct 27, 2026
db28893
Merge origin/main into quest/m2/ts-drop
kixelated Oct 27, 2026
3ee1d42
Merge remote-tracking branch 'origin/quest/m2/ts-drop' into iterate-115
kixelated Oct 27, 2026
0a95736
Merge origin/main into ts-drop-closures
kixelated Oct 27, 2026
88e3fba
Merge remote-tracking branch 'origin/main' into iterate-115
kixelated Oct 27, 2026
862ad3d
Merge origin/main into ts-drop-closures
kixelated Oct 27, 2026
4bda3e4
Merge origin/main into ts-drop-closures
kixelated Oct 27, 2026
c731567
Merge origin/main into ts-drop-closures
kixelated Oct 27, 2026
1572755
test(ts): cover rt.once through bool::then
kixelated Oct 27, 2026
a929f07
Merge origin/main into ts-drop-closures
kixelated Oct 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions quest/m2/ts-drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,24 @@ blocks of `-C panic=unwind` MIR, which a function runs from a `catch`. A value w
`drop_in_place` shim. A runtime function that may drop what std's would (a collection's
`clear`, `unwrap_or`'s fallback, an adaptor's rejects) takes a dropper for each such
type after its own arguments (`drop_fn` and `droppers` in `drop.rs`), and a consumer
that takes an iterator by value takes `rt.drop` for it. The task fixture's `drops.rs`
and `drops/iters.rs` check these against native Rust, natively unwinding too.

What still fails translation, by the census at the pinned moq revision (moq-net's, then
kio's):

- A closure that owns a value that drops, dropped without a call that takes it (17, 0),
as `Option::map` drops it on `None` and `Result::map` on an error. An arrow function
has no `[Symbol.dispose]`; one that owns droppable captures needs one, and so do the
adaptors that hold it (`map`'s, `filter`'s), which drop it after their iterator, as
std's fields do.

Refused with none in the census, each where std's order is one JS's can't follow yet:
that takes an iterator by value takes `rt.drop` for it. A closure that owns a value that
drops carries `[Symbol.dispose]` (`rt.closure`), and one that `Fn` or `FnMut` call drops
after a call through `FnOnce` (`rt.callOnce`, and `rt.once` for std's). The task
fixture's `drops.rs`, `drops/iters.rs`, and `drops/closures.rs` check these against
native Rust, natively unwinding too.

Nothing that drops fails translation in the census at the pinned moq revision. Refused
with none in the census, each where std's order is one JS's can't follow yet:
a closure that owns a value that drops, given to std's iterators or a collection's
methods, which hold or call it (an adaptor drops it after its iterator, as std's fields
do, and each consumer where its `fold` path does);
`into_keys` and `into_values` of a hash map whose other half drops (`fold` drops it
after the half it yields, `next` before); `zip` of two `TrustedRandomAccess` iterators
of items that drop; a `flatten` whose inner iterator holds items once ended, or that a
`fold` reads where both its source and inner iterators drop; a B-tree's `collect` of
entries that drop, sorted by the crate's own `Ord`; a `collect` in place of a `zip`
whose second iterator drops; and `DebugList::entries` of items that drop.
whose second iterator drops; `successors` of items that drop, which holds the next one;
and `DebugList::entries` of items that drop.

Watch the cost: a function whose cleanup does something JS can see sets a variable
before each call that can panic and wraps its body in a `try`; measure any change on
Expand Down
7 changes: 4 additions & 3 deletions ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ in `rt/str.ts`, collections in `rt/collections.ts`, ownership and async in
| `HashMap`, `HashSet`, `BTreeMap`, `BTreeSet`, `VecDeque` | `rt.HashMap<K, V>` and so on, each a plain object whose functions are the runtime's: `rt.hashGet(map, key)` |
| `Ordering`, `DefaultHasher` | `rt.Ordering`, which is `-1`, `0`, or `1`; `rt.Hasher` |
| `Duration` | `rt.Duration`: `{ secs, nanos }`, std's whole seconds as an `rt.u64` and the nanoseconds past them, never changed once made |
| closure | an arrow function |
| closure | an arrow function, with `[Symbol.dispose]` if it owns a value that drops |
| constant | its value, inlined as Rust inlines it |
| a type that drops | a class with `[Symbol.dispose]`: its `Drop` impl, then its fields |
| a type's function | a function of the type's module, taking `self` first: `Decoder.slice(dec, 4)` after `import * as Decoder` |
Expand Down Expand Up @@ -412,8 +412,9 @@ to hand-written TS ([bindings](#bindings)).

## Not yet

These fail translation: floats, statics, async closures, values that drop in a closure dropped without a call that
takes it or in an iterator ([Drop](/quest/m2/ts-drop.md)), a `Cow` of other than `str`,
These fail translation: floats, statics, async closures, a closure that owns a value
that drops given to std's iterators or collections, and values that drop in some
iterators ([Drop](/quest/m2/ts-drop.md)), a `Cow` of other than `str`,
a collection holding a type that can be `undefined`, as `()` and `Option` can, a collection's `capacity`, looking up a key by
another type it borrows as through the crate's own `Borrow`, a `&mut` to a value JS
copies that std makes, other than a map's, or hands a closure, as `iter_mut` and
Expand Down
133 changes: 66 additions & 67 deletions ts/fixtures/reject/census.md

Large diffs are not rendered by default.

45 changes: 22 additions & 23 deletions ts/fixtures/reject/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ unsupported type `dyn std::ops::Fn(u8) -> u8` at fixtures/reject/src/lib.rs:11:1
unsupported call to `std::slice::<impl [u8]>::sort` at fixtures/reject/src/lib.rs:28:4
`Option<std::option::Option<u8>>` is not supported: its `None` and `Some` would both be `undefined` at fixtures/reject/src/lib.rs:32:2
`Option<std::option::Option<u8>>` is not supported: its `None` and `Some` would both be `undefined` at fixtures/reject/src/lib.rs:32:42
unsupported call to `std::mem::size_of_val::<Noisy>` at fixtures/reject/src/lib.rs:44:18
dropping a closure that owns a value that drops, which is not supported yet at fixtures/reject/src/lib.rs:46:1
unsupported call to `std::mem::size_of_val::<Noisy>` at fixtures/reject/src/lib.rs:44:29
passing `{closure@fixtures/reject/src/lib.rs:44:10: 44:23}`, a closure that owns a value that drops, to `Iterator::map`, which is not supported yet at fixtures/reject/src/lib.rs:45:11
dropping `std::iter::Map<std::slice::Iter<'_, u8>, {closure@fixtures/reject/src/lib.rs:44:10: 44:23}>`, which is not supported yet at fixtures/reject/src/lib.rs:45:18
`into_keys` of `std::collections::HashMap<u8, Noisy>`, which drops `Noisy`, which is not supported yet at fixtures/reject/src/lib.rs:51:13
a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:59:10: 59:18}` at fixtures/reject/src/lib.rs:60:2
a precision, as in `{:.2}`, is not supported at fixtures/reject/src/lib.rs:67:3
Expand Down Expand Up @@ -58,30 +59,28 @@ comparing `std::vec::Vec<u8>` as a key, which is not supported yet at fixtures/r
`HashMap::contains_key` of `std::collections::HashMap<Id, u8>` by `u8`, which is not supported yet at fixtures/reject/src/lib.rs:309:6
unsupported call to `core::slice::<impl [(u8, u8)]>::copy_within::<std::ops::Range<usize>>` at fixtures/reject/src/lib.rs:359:4
a coercion to `std::sync::Arc<[u8]>` at fixtures/reject/src/lib.rs:364:2
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:407:2
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:409:27
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:408:30
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:414:2
`std::borrow::Cow<'_, [u8]>` is not supported yet at fixtures/reject/src/lib.rs:418:18
unsupported call to `<std::borrow::Cow<'_, [u8]> as std::ops::Deref>::deref` at fixtures/reject/src/lib.rs:419:2
constructing `std::borrow::Cow<'_, std::sync::Arc<u8>>` at fixtures/reject/src/lib.rs:425:53
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:397:2
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:399:27
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:398:30
a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:404:2
`std::borrow::Cow<'_, [u8]>` is not supported yet at fixtures/reject/src/lib.rs:408:18
unsupported call to `<std::borrow::Cow<'_, [u8]> as std::ops::Deref>::deref` at fixtures/reject/src/lib.rs:409:2
constructing `std::borrow::Cow<'_, std::sync::Arc<u8>>` at fixtures/reject/src/lib.rs:415:53
unsupported call to `core::str::<impl str>::split::<[char; 2]>` at fixtures/reject/src/lib.rs:370:4
dropping a closure that owns a value that drops, which is not supported yet at fixtures/reject/src/lib.rs:397:18
dropping a closure that owns a value that drops, which is not supported yet at fixtures/reject/src/lib.rs:399:15
dropping `std::iter::Take<std::iter::Successors<u8, {closure@fixtures/reject/src/lib.rs:399:48: 399:56}>>`, which is not supported yet at fixtures/reject/src/lib.rs:399:79
dropping a closure that owns a value that drops, which is not supported yet at fixtures/reject/src/lib.rs:400:13
dropping `std::iter::Take<std::iter::FromFn<{closure@fixtures/reject/src/lib.rs:400:32: 400:39}>>`, which is not supported yet at fixtures/reject/src/lib.rs:400:62
an iterator that owns `Noisy`, which drops, which is not supported yet at fixtures/reject/src/lib.rs:401:13
unsupported call to `<std::time::Duration as std::ops::AddAssign>::add_assign` at fixtures/reject/src/lib.rs:433:2
`core::slice::<impl [T]>::last_mut` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:439:21
`std::collections::hash_map::Entry::<'a, K, V, A>::and_modify` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:446:15
a mutable reference into a `Result`'s payload, passed on or kept at fixtures/reject/src/lib.rs:456:12
unsupported call to `<std::option::Option<&mut u32> as std::cmp::PartialEq>::eq` at fixtures/reject/src/lib.rs:463:2
passing `{closure@fixtures/reject/src/lib.rs:380:28: 380:35}`, a closure that owns a value that drops, to `Entry::or_insert_with`, which is not supported yet at fixtures/reject/src/lib.rs:380:13
passing `{closure@fixtures/reject/src/lib.rs:381:15: 381:24}`, a closure that owns a value that drops, to `Iterator::any`, which is not supported yet at fixtures/reject/src/lib.rs:381:11
passing `{closure@fixtures/reject/src/lib.rs:389:48: 389:56}`, a closure that owns a value that drops, to `successors::successors`, which is not supported yet at fixtures/reject/src/lib.rs:389:15
dropping `std::iter::Take<std::iter::Successors<u8, {closure@fixtures/reject/src/lib.rs:389:48: 389:56}>>`, which is not supported yet at fixtures/reject/src/lib.rs:389:79
passing `{closure@fixtures/reject/src/lib.rs:390:32: 390:39}`, a closure that owns a value that drops, to `from_fn::from_fn`, which is not supported yet at fixtures/reject/src/lib.rs:390:13
dropping `std::iter::Take<std::iter::FromFn<{closure@fixtures/reject/src/lib.rs:390:32: 390:39}>>`, which is not supported yet at fixtures/reject/src/lib.rs:390:62
an iterator that owns `Noisy`, which drops, which is not supported yet at fixtures/reject/src/lib.rs:391:13
unsupported call to `<std::time::Duration as std::ops::AddAssign>::add_assign` at fixtures/reject/src/lib.rs:423:2
`core::slice::<impl [T]>::last_mut` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:429:21
`std::collections::hash_map::Entry::<'a, K, V, A>::and_modify` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:436:15
a mutable reference into a `Result`'s payload, passed on or kept at fixtures/reject/src/lib.rs:446:12
unsupported call to `<std::option::Option<&mut u32> as std::cmp::PartialEq>::eq` at fixtures/reject/src/lib.rs:453:2
overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:152:2
an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:172:1
overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:206:2
an iterator of the crate implementing `FusedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:226:1
`Hasher::write`, which is not supported yet at fixtures/reject/src/lib.rs:317:9
dropping a closure that owns a value that drops, which is not supported yet, in `std::option::Option::<T>::map` at fixtures/reject/src/lib.rs:378:12
dropping a closure that owns a value that drops, which is not supported yet, in `std::result::Result::<T, E>::map_err` at fixtures/reject/src/lib.rs:382:12
dropping a closure that owns a value that drops, which is not supported yet, in `std::result::Result::<T, E>::and_then` at fixtures/reject/src/lib.rs:386:12
42 changes: 16 additions & 26 deletions ts/fixtures/reject/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ impl Drop for Noisy {
fn drop(&mut self) {}
}

/// Dropping the closure would drop what it captured, which lives in an arrow function.
pub fn owning_closure() -> u8 {
/// A closure that owns a value that drops, which `map` would hold but never drop.
pub fn owning_closure(v: &[u8]) -> usize {
let n = Noisy(1);
let f = move || std::mem::size_of_val(&n) as u8;
f()
let f = move |x: &u8| *x + std::mem::size_of_val(&n) as u8;
v.iter().map(f).count()
}

/// std's `fold` of `into_keys` drops each value after its key, where `next` drops it first.
Expand Down Expand Up @@ -370,36 +370,26 @@ pub fn split_chars(s: &str) -> usize {
s.split(['a', 'b']).count()
}

/// `Option::map` drops its closure on `None`, as `Result::map_err` does on `Ok` and
/// `Result::and_then` on `Err`, and with it what it captured, which lives in an arrow
/// function.
pub fn discarded_closure(a: Option<u8>, b: Result<u8, u8>) -> u8 {
let (m, n, o) = (Noisy(1), Noisy(2), Noisy(3));
let a = a.map(move |x| {
drop(m);
x
});
let c = b.map_err(move |e| {
drop(n);
e
});
let d = b.and_then(move |v| {
drop(o);
Ok(v)
});
a.unwrap_or(0) + c.unwrap_or(0) + d.unwrap_or(0)
/// Closures that own a value that drops, which `any` and `or_insert_with` would call but
/// never drop.
pub fn called_closure(v: &[u8], m: &mut std::collections::HashMap<u8, Noisy>) -> bool {
fn id(n: &Noisy) -> u8 {
n.0
}
let (a, b) = (Noisy(1), Noisy(2));
m.entry(1).or_insert_with(move || b);
v.iter().any(move |&x| x == id(&a))
}

/// Each drops its closure, and the `Noisy` it owns, when it is done with it, as
/// `successors` does the item it holds next.
pub fn owning_lazy(cond: bool) -> usize {
let (a, b, c) = (Noisy(1), Noisy(2), Noisy(3));
let then = cond.then(move || a).is_some() as usize;
pub fn owning_lazy() -> usize {
let (b, c) = (Noisy(2), Noisy(3));
// Through a reference, each owns its `Noisy` whole rather than a copy of its field.
let walked = std::iter::successors(Some(0u8), move |_| Some((&b).0)).take(2).count();
let made = std::iter::from_fn(move || Some((&c).0)).take(2).count();
let held = std::iter::successors(Some(Noisy(4)), |_| None).count();
then + walked + made + held
walked + made + held
}

/// A `Cow<str>` is a JS string, which keeps no variant to match on or ask about.
Expand Down
2 changes: 1 addition & 1 deletion ts/fixtures/reject/ts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ roots = [
"cow_bytes",
"cow_made",
"split_chars",
"discarded_closure",
"called_closure",
"owning_lazy",
"duration_assign",
"last_bumped",
Expand Down
54 changes: 54 additions & 0 deletions ts/fixtures/task/expected/core/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,42 @@ export function unwrapOr$Option_u64(self: rt.u64 | undefined, default_: rt.u64):
return self;
}

export function map$Option_u32_u32_blasted_closure3(self: rt.u32 | undefined, f: (a0: rt.u32) => rt.u32): rt.u32 | undefined {
let _0!: rt.u32 | undefined;
let _8: boolean = false;
_8 = true;
if (self === undefined) {
_0 = undefined;
} else {
const x: rt.u32 = self;
_8 = false;
_0 = f(x);
}
if (_8) {
rt.drop(f);
return _0;
}
return _0;
}

export function map$Option_u32_u32_discarded_closure16(self: rt.u32 | undefined, f: (a0: rt.u32) => rt.u32): rt.u32 | undefined {
let _0!: rt.u32 | undefined;
let _8: boolean = false;
_8 = true;
if (self === undefined) {
_0 = undefined;
} else {
const x: rt.u32 = self;
_8 = false;
_0 = rt.callOnce(f, x);
}
if (_8) {
rt.drop(f);
return _0;
}
return _0;
}

export function mapOr$Option_Guard_u32_drained_closure4(self: Guard.Guard | undefined, default_: rt.u32, f: (a0: Guard.Guard) => rt.u32): rt.u32 {
if (self === undefined) {
return default_;
Expand Down Expand Up @@ -87,6 +123,24 @@ export function mapOr$Option_u32_Guard_options_closure2(self: rt.u32 | undefined
}
}

export function mapOr$Option_u32_u32_discarded_closure12(self: rt.u32 | undefined, default_: rt.u32, f: (a0: rt.u32) => rt.u32): rt.u32 {
let _0!: rt.u32;
let _8: boolean = false;
_8 = true;
if (self === undefined) {
_0 = default_;
} else {
const t: rt.u32 = self;
_8 = false;
_0 = f(t);
}
if (_8) {
rt.drop(f);
return _0;
}
return _0;
}

export function okOr$Option_Guard_Guard(self: Guard.Guard | undefined, err: Guard.Guard): rt.Result<Guard.Guard, Guard.Guard> {
let _0!: rt.Result<Guard.Guard, Guard.Guard>;
let _6: boolean = false;
Expand Down
69 changes: 69 additions & 0 deletions ts/fixtures/task/expected/core/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,64 @@ export function err$Result_Guard_Guard(self: rt.Result<Guard.Guard, Guard.Guard>
return _0;
}

export function map$Result_u32_u32_u32_discarded_closure4(self: rt.Result<rt.u32, rt.u32>, op: (a0: rt.u32) => rt.u32): rt.Result<rt.u32, rt.u32> {
let _0!: rt.Result<rt.u32, rt.u32>;
let _9: boolean = false;
_9 = true;
if (self.ok) {
const t: rt.u32 = self.value;
_9 = false;
_0 = rt.Ok(op(t));
} else {
_0 = self;
}
if (_9) {
rt.drop(op);
return _0;
}
return _0;
}

export function mapOrElse$Result_Guard_Guard_u32_options_closure9_options_closure10(self: rt.Result<Guard.Guard, Guard.Guard>, default_: (a0: Guard.Guard) => rt.u32, f: (a0: Guard.Guard) => rt.u32): rt.u32 {
if (self.ok) {
return f(self.value);
}
return default_(self.error);
}

export function mapErr$Result_u32_u32_u32_discarded_closure6(self: rt.Result<rt.u32, rt.u32>, op: (a0: rt.u32) => rt.u32): rt.Result<rt.u32, rt.u32> {
let _0!: rt.Result<rt.u32, rt.u32>;
let _9: boolean = false;
_9 = true;
if (self.ok) {
_0 = self;
} else {
const e: rt.u32 = self.error;
_9 = false;
_0 = rt.Err(op(e));
}
if (_9) {
rt.drop(op);
return _0;
}
return _0;
}

export function inspectErr$Result_u32_u32_discarded_closure10(self: rt.Result<rt.u32, rt.u32>, f: (a0: rt.u32) => void): rt.Result<rt.u32, rt.u32> {
let _8: boolean = false;
_8 = true;
if (!self.ok) {
_8 = false;
f(self.error);
}
const _0: rt.Result<rt.u32, rt.u32> = self;
if (_8) {
rt.drop(f);
return _0;
}
return _0;
}

export function inspectErr$Result_u8_Key_tripped_closure6(self: rt.Result<rt.u8, Key.Key>, f: (a0: Key.Key) => void): rt.Result<rt.u8, Key.Key> {
let _9!: boolean;
let unwind: number = 0;
Expand Down Expand Up @@ -70,6 +121,24 @@ export function andThen$Result_Guard_Guard_Guard_options_closure8(self: rt.Resul
return self;
}

export function andThen$Result_u32_u32_u32_discarded_closure8(self: rt.Result<rt.u32, rt.u32>, op: (a0: rt.u32) => rt.Result<rt.u32, rt.u32>): rt.Result<rt.u32, rt.u32> {
let _0!: rt.Result<rt.u32, rt.u32>;
let _8: boolean = false;
_8 = true;
if (self.ok) {
const t: rt.u32 = self.value;
_8 = false;
_0 = op(t);
} else {
_0 = self;
}
if (_8) {
rt.drop(op);
return _0;
}
return _0;
}

export function unwrapOr$Result_Guard_Guard(self: rt.Result<Guard.Guard, Guard.Guard>, default_: Guard.Guard): Guard.Guard {
let _0!: Guard.Guard;
let unwind: number = 0;
Expand Down
Loading