From 5f1854280370ba33b36e47661fb7d54a0079edd7 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:12:35 -0700 Subject: [PATCH 1/5] chore(quest): claim quest/m2/ts-model/nested-option.md Quest-Claim: 8f9f13b363f8069b From 24c1333e9b32b6232c27312a474e9ed190c9d178 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:02:40 -0700 Subject: [PATCH 2/5] feat(ts): translate options of values that can be undefined An `Option` whose `T` can already be `undefined`, such as `Option<()>` or `Option>`, has `rt.None` for its `None`, so `None` stays apart from `Some(None)`. Every other `Option` stays `T | undefined`. A std mapping whose runtime function would read or make such an `Option` with `undefined` is refused. Co-Authored-By: Claude Opus 5.5 --- ts/README.md | 14 +- ts/fixtures/lang/expected/combinators.ts | 6 +- ts/fixtures/lang/expected/core/option.ts | 82 +++- ts/fixtures/lang/expected/harness.ts | 5 +- ts/fixtures/lang/expected/iters.ts | 6 +- ts/fixtures/lang/expected/nested.Halves.ts | 21 + ts/fixtures/lang/expected/nested.Slot.ts | 10 + ts/fixtures/lang/expected/nested.ts | 235 +++++++++++ ts/fixtures/lang/expected/shapes.ts | 4 +- ts/fixtures/lang/src/harness.rs | 7 +- ts/fixtures/lang/src/lib.rs | 5 +- ts/fixtures/lang/src/nested.rs | 166 ++++++++ ts/fixtures/reject/census.md | 459 +++++++++++---------- ts/fixtures/reject/expected.txt | 154 ++++--- ts/fixtures/reject/src/lib.rs | 22 +- ts/fixtures/reject/ts.toml | 2 +- ts/runtime/rt.ts | 57 ++- ts/runtime/rt/collections.ts | 31 +- ts/runtime/rt/iter.ts | 20 +- ts/src/census.rs | 1 + ts/src/lower/body.rs | 9 +- ts/src/lower/collections.rs | 10 +- ts/src/lower/consts.rs | 7 +- ts/src/lower/copy.rs | 4 +- ts/src/lower/drop.rs | 1 + ts/src/lower/fmt.rs | 3 +- ts/src/lower/iter.rs | 41 +- ts/src/lower/library.rs | 104 ++++- ts/src/lower/mir/call.rs | 50 ++- ts/src/lower/mir/mod.rs | 26 +- ts/src/lower/mir/place.rs | 11 +- ts/src/lower/mir/rvalue.rs | 2 +- ts/src/lower/mod.rs | 116 +++++- 33 files changed, 1233 insertions(+), 458 deletions(-) create mode 100644 ts/fixtures/lang/expected/nested.Halves.ts create mode 100644 ts/fixtures/lang/expected/nested.Slot.ts create mode 100644 ts/fixtures/lang/expected/nested.ts create mode 100644 ts/fixtures/lang/src/nested.rs diff --git a/ts/README.md b/ts/README.md index 03c6410ae..4ae55726f 100644 --- a/ts/README.md +++ b/ts/README.md @@ -14,7 +14,7 @@ what they reach. A construct outside the subset is a compile error with its span then nothing is written. A type without a JS value is refused where a value of it is made or received, such as a parameter, a field, or a call, rather than again at each variable holding one; any variable or temporary that holds a type whose JS value is ambiguous, such -as `Option<()>`, is refused at its own span. +as `Option>`, is refused at its own span. ```toml # ts.toml, beside the package's Cargo.toml unless --manifest-path says otherwise. @@ -74,7 +74,7 @@ in `rt/str.ts`, collections in `rt/collections.ts`, ownership and async in | `struct` | a plain object, typed by an interface; a class if it may drop | | `enum` without data | a union of strings: `"Lite01" \| "Lite02"`, or `never` without variants | | `enum` | a union of objects tagged by variant | -| `Option` | `T \| undefined`; refused if `T` can already be `undefined`, as `()` and `Option` can | +| `Option` | `T \| undefined`; `T \| rt.None` where `T` can already be `undefined`, as `()` and `Option` can, so `Option<()>` and `Option>` keep `None` apart from each `Some` | | `Result` | `rt.Result`: `{ ok: true, value }` or `{ ok: false, error }`; `rt.OK` or `rt.ERR` where the payload is `undefined`, as in `Ok(())` | | `ControlFlow` | `rt.Result`, `Ok` to continue; what `?` branches on is the value it was applied to | | tuple, `[T; N]`, `&[T]`, `Vec` | an array; for bytes, `Uint8Array` for `[u8; N]`, `rt.ByteSlice` for `&[u8]` and `&[u8; N]`, and `rt.ByteVec` for `Vec` | @@ -343,6 +343,10 @@ they need. function of it is one instance's, typed by its `self`. A type per instance (`Wrap$Pair`) would rename the type for callers, and TS generics with trait dictionaries would undo monomorphization. +- `None` is `undefined`, so a TS caller reads an `Option` with `?.` and `??`, except where + the `Some` can already be `undefined`: there it is `rt.None`, as `Pending` is + `rt.Pending`, chosen by the type alone, so every function agrees on it. A `rt.None` + for every `Option` would cost callers `?.` and `??` everywhere for the few that need it. - A `Cow` is a JS string, as `str` and `String` are, rather than an object tagged by its variant: no `Cow` in moq-net or kio tells its variants apart, and a tag would wrap every value and unwrap it at every read. @@ -424,7 +428,11 @@ to hand-written TS ([bindings](#bindings)). 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 +a collection holding a type that can be `undefined`, as `()` and `Option` can, a std +function without a mapping of its own that makes or reads an `Option` whose `None` is +`rt.None`, as `find` over `Option`s does, an `Option` of an `Option` of `()` or another +`Option`, an instance of a generic type whose field is an `Option` of a type parameter +that can be `undefined`, 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 `and_modify` do, one into a `Result`'s payload passed on or kept, `Hasher::write` of bytes, the adaptors diff --git a/ts/fixtures/lang/expected/combinators.ts b/ts/fixtures/lang/expected/combinators.ts index e2f5a3d05..cda96580a 100644 --- a/ts/fixtures/lang/expected/combinators.ts +++ b/ts/fixtures/lang/expected/combinators.ts @@ -2,7 +2,7 @@ import * as rt from "./rt.ts"; import { copy$Result_u32s_u16, copy$u32s } from "./lib.ts"; -import { isSomeAnd$Option_u8_options_closure0, isNoneOr$Option_u8_options_closure1, unwrapOr$Option_u8, unwrapOrElse$Option_String_owned_closure3, unwrapOrElse$Option_u8_options_closure9, unwrapOrDefault$Option_String, unwrapOrDefault$Option_Vec_u8, unwrapOrDefault$Option_u8, map$Option_u8_String_owned_closure0, map$Option_u8_Vec_u8_owned_closure4, map$Option_u8_u32s_owned_closure9, map$Option_u8_u8_options_closure3_closure0, inspect$Option_u8_options_closure11, mapOr$Option_u16_u8_hash_maps_closure0, mapOr$Option_u8_u8_options_closure5, mapOr$Option_u8_u8_u8_btree_maps_closure0, mapOrElse$Option_u8_u8_options_closure7_options_closure8, okOr$Option_u32s_u8, okOr$Option_u8_u16, okOr$Option_u8_u8, okOrElse$Option_Vec_u8_String_owned_closure5, okOrElse$Option_u8_u16_options_closure12, and$Option_u8_u8, andThen$Option_u8_u8_options_closure2, filter$Option_String_owned_closure1, filter$Option_u8_combinators_closure0, or$Option_u8, orElse$Option_String_owned_closure2, orElse$Option_u8_options_closure6, xor$Option_u8, zip$Option_u8_u8, clone$Clone_Option_String } from "./core/option.ts"; +import { isSomeAnd$Option_u8_options_closure0, isNoneOr$Option_u8_options_closure1, unwrapOr$Option_u8, unwrapOrElse$Option_String_owned_closure3, unwrapOrElse$Option_u8_options_closure9, unwrapOrDefault$Option_String, unwrapOrDefault$Option_Vec_u8, unwrapOrDefault$Option_u8, map$Option_u8_String_owned_closure0, map$Option_u8_Vec_u8_owned_closure4, map$Option_u8_u32s_owned_closure9, map$Option_u8_u8_made_closure0_closure0, inspect$Option_u8_options_closure11, mapOr$Option_u16_u8_hash_maps_closure0, mapOr$Option_u8_u8_iters_closure3, mapOr$Option_u8_u8_u8_btree_maps_closure0, mapOrElse$Option_u8_u8_options_closure7_options_closure8, okOr$Option_u32s_u8, okOr$Option_u8_u16, okOr$Option_u8_u8, okOrElse$Option_Vec_u8_String_owned_closure5, okOrElse$Option_u8_u16_options_closure12, and$Option_u8_u8, andThen$Option_u8_u8_options_closure2, filter$Option_String_owned_closure1, filter$Option_u8_combinators_closure0, or$Option_u8, orElse$Option_String_owned_closure2, orElse$Option_u8_options_closure6, xor$Option_u8, zip$Option_u8_u8, clone$Clone_Option_String } from "./core/option.ts"; import { isOkAnd$Result_u8_u16_results_closure5, isErrAnd$Result_u8_u16_results_closure6, ok$Result_u8_u16, err$Result_u8_u16, asRef$Result_u8_u16, map$Result_Vec_u8_String_Vec_u8_owned_closure6, map$Result_u8_u16_u8_options_closure13, mapOr$Result_u8_u16_u8_results_closure7, mapOrElse$Result_u8_u16_u8_results_closure8_results_closure9, mapErr$Result_u32s_u8_u16_from, mapErr$Result_u8_u16_u16_results_closure14, inspect$Result_u8_u16_results_closure12, inspectErr$Result_u8_u16_results_closure13, unwrapOrDefault$Result_u8_u16, and$Result_u8_u16_u8, andThen$Result_u8_u16_u8_results_closure3, or$Result_u8_u16_u16, orElse$Result_u8_u16_u16_results_closure4, unwrapOr$Result_u8_u16, unwrapOrElse$Result_u8_u16_results_closure11, unwrapOrElse$Result_u8_u8_panics_closure1, copied$Result_u8_u16, clone$Clone_Result_Vec_u8_String } from "./core/result.ts"; /** Run case `kind % 4` over `data`, whose bytes pick each `Some` or `None`, `Ok` or `Err`. */ @@ -39,11 +39,11 @@ export function options(a: rt.u8 | undefined, b: rt.u8 | undefined, limit: rt.u8 return rt.u8CheckedAdd(x3, limit); }), (x4: rt.u8): rt.u8 | undefined => { rt.byteVecPush(out, 162); - return map$Option_u8_u8_options_closure3_closure0(b, (y: rt.u8): rt.u8 => { + return map$Option_u8_u8_made_closure0_closure0(b, (y: rt.u8): rt.u8 => { return x4 ^ y; }); }), 238)); - rt.byteVecPush(out, mapOr$Option_u8_u8_options_closure5(filter$Option_u8_combinators_closure0(a, (x5: rt.u8): boolean => { + rt.byteVecPush(out, mapOr$Option_u8_u8_iters_closure3(filter$Option_u8_combinators_closure0(a, (x5: rt.u8): boolean => { rt.byteVecPush(out, 163); return x5 > limit; }), 221, (x6: rt.u8): rt.u8 => { diff --git a/ts/fixtures/lang/expected/core/option.ts b/ts/fixtures/lang/expected/core/option.ts index b1e3cfd29..7e81ae2d1 100644 --- a/ts/fixtures/lang/expected/core/option.ts +++ b/ts/fixtures/lang/expected/core/option.ts @@ -142,6 +142,13 @@ export function map$Option_Hop_u64_u64_options_closure0(self: Hop.Hop | undefine return f(self); } +export function map$Option_Option_u8_Option_u8_made_closure0(self: rt.u8 | undefined | rt.None, f: (a0: rt.u8 | undefined) => rt.u8 | undefined): rt.u8 | undefined | rt.None { + if (self === rt.None) { + return rt.None; + } + return f(self); +} + export function map$Option_Way_bool_defaults_closure2(self: Way.Way | undefined, f: (a0: Way.Way) => boolean): boolean | undefined { if (self === undefined) { return undefined; @@ -156,6 +163,13 @@ export function map$Option_str_Cow_str_Borrowed(self: string | undefined, _: (a0 return self; } +export function map$Option_u8_Option_u8_made_closure1_closure0(self: rt.u8 | undefined, f: (a0: rt.u8) => rt.u8 | undefined): rt.u8 | undefined | rt.None { + if (self === undefined) { + return rt.None; + } + return f(self); +} + export function map$Option_u8_Side_side(self: rt.u8 | undefined, _: (a0: rt.u8) => Side.Side): Side.Side | undefined { if (self === undefined) { return undefined; @@ -184,13 +198,20 @@ export function map$Option_u8_u32s_owned_closure9(self: rt.u8 | undefined, f: (a return f(self); } -export function map$Option_u8_u8_options_closure3_closure0(self: rt.u8 | undefined, f: (a0: rt.u8) => rt.u8): rt.u8 | undefined { +export function map$Option_u8_u8_made_closure0_closure0(self: rt.u8 | undefined, f: (a0: rt.u8) => rt.u8): rt.u8 | undefined { if (self === undefined) { return undefined; } return f(self); } +export function map$Option_unit_Option_u8_made_closure3(self: undefined | rt.None, f: (a0: undefined) => rt.u8 | undefined): rt.u8 | undefined | rt.None { + if (self === rt.None) { + return rt.None; + } + return f(undefined); +} + export function map$Option_usize_str_str_slices_closure2(self: [rt.usize, string] | undefined, f: (a0: [rt.usize, string]) => string): string | undefined { if (self === undefined) { return undefined; @@ -296,7 +317,7 @@ export function mapOr$Option_u8_bool_take_largest_closure0(self: rt.u8 | undefin return f(self); } -export function mapOr$Option_u8_u8_options_closure5(self: rt.u8 | undefined, default_: rt.u8, f: (a0: rt.u8) => rt.u8): rt.u8 { +export function mapOr$Option_u8_u8_iters_closure3(self: rt.u8 | undefined, default_: rt.u8, f: (a0: rt.u8) => rt.u8): rt.u8 { if (self === undefined) { return default_; } @@ -317,7 +338,7 @@ export function mapOr$Option_u8_u8_u8s_stores_closure2_closure0(self: [rt.u8, rt return f(self); } -export function mapOr$Option_u8_usize_shares_closure1(self: rt.u8 | undefined, default_: rt.usize, f: (a0: rt.u8) => rt.usize): rt.usize { +export function mapOr$Option_u8_usize_iters_closure1(self: rt.u8 | undefined, default_: rt.usize, f: (a0: rt.u8) => rt.usize): rt.usize { if (self === undefined) { return default_; } @@ -338,6 +359,13 @@ export function mapOr$Option_u8s_u8s_u8s_chunks_closure0(self: [rt.ByteSlice, rt return f(self); } +export function mapOr$Option_unit_u8_made_closure4(self: undefined | rt.None, default_: rt.u8, f: (a0: undefined) => rt.u8): rt.u8 { + if (self === rt.None) { + return default_; + } + return f(undefined); +} + export function mapOr$Option_usize_str_slices_closure1_closure0_closure0(self: rt.usize | undefined, default_: string, f: (a0: rt.usize) => string): string { if (self === undefined) { return default_; @@ -436,6 +464,13 @@ export function and$Option_u8_u8(self: rt.u8 | undefined, optb: rt.u8 | undefine return optb; } +export function andThen$Option_Option_u8_Option_u8_made_closure1(self: rt.u8 | undefined | rt.None, f: (a0: rt.u8 | undefined) => rt.u8 | undefined | rt.None): rt.u8 | undefined | rt.None { + if (self === rt.None) { + return rt.None; + } + return f(self); +} + export function andThen$Option_u8_u8_options_closure2(self: rt.u8 | undefined, f: (a0: rt.u8) => rt.u8 | undefined): rt.u8 | undefined { if (self === undefined) { return undefined; @@ -443,6 +478,16 @@ export function andThen$Option_u8_u8_options_closure2(self: rt.u8 | undefined, f return f(self); } +export function filter$Option_Option_u8_made_closure2(self: rt.u8 | undefined | rt.None, predicate: (a0: rt.u8 | undefined) => boolean): rt.u8 | undefined | rt.None { + if (self !== rt.None) { + const x: rt.u8 | undefined = self; + if (predicate(x)) { + return x; + } + } + return rt.None; +} + export function filter$Option_String_owned_closure1(self: string | undefined, predicate: (a0: string) => boolean): string | undefined { if (self !== undefined) { const x: string = self; @@ -463,6 +508,13 @@ export function filter$Option_u8_combinators_closure0(self: rt.u8 | undefined, p return undefined; } +export function or$Option_Option_u8(self: rt.u8 | undefined | rt.None, optb: rt.u8 | undefined | rt.None): rt.u8 | undefined | rt.None { + if (self === rt.None) { + return optb; + } + return self; +} + export function or$Option_u8(self: rt.u8 | undefined, optb: rt.u8 | undefined): rt.u8 | undefined { if (self === undefined) { return optb; @@ -484,6 +536,23 @@ export function orElse$Option_u8_options_closure6(self: rt.u8 | undefined, f: () return self; } +export function xor$Option_Option_u8(self: rt.u8 | undefined | rt.None, optb: rt.u8 | undefined | rt.None): rt.u8 | undefined | rt.None { + let _0!: rt.u8 | undefined | rt.None; + b0: { + if (self === rt.None) { + if (optb !== rt.None) { + _0 = optb; + break b0; + } + } else if (optb === rt.None) { + _0 = self; + break b0; + } + _0 = rt.None; + } + return _0; +} + export function xor$Option_u8(self: rt.u8 | undefined, optb: rt.u8 | undefined): rt.u8 | undefined { let _0!: rt.u8 | undefined; b0: { @@ -522,4 +591,11 @@ export function clone$Clone_Option_String(self: string | undefined): string | un return self; } +export function flatten$Option_Option_u8(self: rt.u8 | undefined | rt.None): rt.u8 | undefined { + if (self === rt.None) { + return undefined; + } + return self; +} + //# sourceMappingURL=option.ts.map diff --git a/ts/fixtures/lang/expected/harness.ts b/ts/fixtures/lang/expected/harness.ts index 832a9c971..9d04b3d05 100644 --- a/ts/fixtures/lang/expected/harness.ts +++ b/ts/fixtures/lang/expected/harness.ts @@ -12,6 +12,7 @@ import { methods } from "./generics.ts"; import { u8Op, u16Op, u32Op, u64Op, u128Op, usizeOp, i8Op, i16Op, i32Op, i64Op, i128Op, isizeOp, i8Neg, i16Neg, i32Neg, i64Neg, i128Neg, isizeNeg, cast, convert } from "./ints.ts"; import { adaptors, consumers, ranges, options, own, values } from "./iters.ts"; import { keys } from "./keys.ts"; +import { nested } from "./nested.ts"; import { refs } from "./refs.ts"; import { copies, order, discriminants, loops, patterns, closures, library, flows } from "./shapes.ts"; import { splits } from "./splits.ts"; @@ -26,7 +27,7 @@ export function run(input: rt.ByteSlice): rt.ByteVec { const _10: [rt.u8, rt.u8] = [input.data[input.start], input.data[input.start + 1]]; const op: rt.u8 = _10[0]; const kind: rt.u8 = _10[1]; - const _14: rt.u8 = rt.u8Rem(op, 51); + const _14: rt.u8 = rt.u8Rem(op, 52); if (_14 === 0) { u8Op(kind, new rt.ByteSlice(input.data, input.start + 2, input.length - 2), out); } else if (_14 === 1) { @@ -144,6 +145,8 @@ export function run(input: rt.ByteSlice): rt.ByteVec { combinators(kind, new rt.ByteSlice(input.data, input.start + 2, input.length - 2), out); } else if (_14 === 49) { splits(kind, new rt.ByteSlice(input.data, input.start + 2, input.length - 2), out); + } else if (_14 === 50) { + nested(kind, new rt.ByteSlice(input.data, input.start + 2, input.length - 2), out); } else { refs(new rt.ByteSlice(input.data, input.start + 2, input.length - 2), out); } diff --git a/ts/fixtures/lang/expected/iters.ts b/ts/fixtures/lang/expected/iters.ts index 9f69940f2..382f797c6 100644 --- a/ts/fixtures/lang/expected/iters.ts +++ b/ts/fixtures/lang/expected/iters.ts @@ -2,7 +2,7 @@ import * as rt from "./rt.ts"; import { copy$Bumped } from "./lib.ts"; -import { unwrapOr$Option_i64, unwrapOr$Option_u64, unwrapOr$Option_u8, unwrapOr$Option_usize_u8, map$Option_u8_u8_options_closure3_closure0, mapOr$Option_Vec_u16_u8_consumers_closure23, mapOr$Option_u8_u8_options_closure5, mapOr$Option_usize_u8_consumers_closure8, mapOr$Option_usize_u8_u8_ranges_closure0 } from "./core/option.ts"; +import { unwrapOr$Option_i64, unwrapOr$Option_u64, unwrapOr$Option_u8, unwrapOr$Option_usize_u8, map$Option_u8_u8_made_closure0_closure0, mapOr$Option_Vec_u16_u8_consumers_closure23, mapOr$Option_u8_u8_iters_closure3, mapOr$Option_usize_u8_consumers_closure8, mapOr$Option_usize_u8_u8_ranges_closure0 } from "./core/option.ts"; import * as Bumped from "./iters.Bumped.ts"; import * as Countdown from "./iters.Countdown.ts"; import * as Doubled from "./iters.Doubled.ts"; @@ -453,7 +453,7 @@ export function fullRange(out: rt.ByteVec): undefined { export function options(data: rt.ByteSlice, out: rt.ByteVec): void { const _83: (a0: rt.u8, a1: rt.ByteVec) => rt.u8 | undefined = (b2: rt.u8, calls2: rt.ByteVec): rt.u8 | undefined => { rt.byteVecPush(calls2, b2); - return map$Option_u8_u8_options_closure3_closure0(rt.u8CheckedSub(b2, 1), (b3: rt.u8): rt.u8 => { + return map$Option_u8_u8_made_closure0_closure0(rt.u8CheckedSub(b2, 1), (b3: rt.u8): rt.u8 => { return rt.u8Div(b3, 2); }); }; @@ -539,7 +539,7 @@ export function options(data: rt.ByteSlice, out: rt.ByteVec): void { if (_114 === rt.DONE) { break; } - rt.byteVecPush(out, mapOr$Option_u8_u8_options_closure5(_114, 170, (b10: rt.u8): rt.u8 => { + rt.byteVecPush(out, mapOr$Option_u8_u8_iters_closure3(_114, 170, (b10: rt.u8): rt.u8 => { return b10; })); } diff --git a/ts/fixtures/lang/expected/nested.Halves.ts b/ts/fixtures/lang/expected/nested.Halves.ts new file mode 100644 index 000000000..cc4680564 --- /dev/null +++ b/ts/fixtures/lang/expected/nested.Halves.ts @@ -0,0 +1,21 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "./rt.ts"; +import { halve } from "./nested.ts"; + +/** Counts down to 0, yielding each count as an `Option`: `None` for each odd one. */ +export interface Halves { + _0: rt.u8; +} + +export function next$Iterator(self: Halves): rt.u8 | undefined | rt.Done { + const _2: rt.u8 | undefined = rt.u8CheckedSub(self._0, 1); + if (_2 !== undefined) { + const n: rt.u8 = _2; + self._0 = n; + return rt.iterFromOption(halve(n), rt.None); + } + return rt.DONE; +} + +//# sourceMappingURL=nested.Halves.ts.map diff --git a/ts/fixtures/lang/expected/nested.Slot.ts b/ts/fixtures/lang/expected/nested.Slot.ts new file mode 100644 index 000000000..faddb020a --- /dev/null +++ b/ts/fixtures/lang/expected/nested.Slot.ts @@ -0,0 +1,10 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "./rt.ts"; + +export interface Slot { + held: rt.u8 | undefined | rt.None; + flag: undefined | rt.None; +} + +//# sourceMappingURL=nested.Slot.ts.map diff --git a/ts/fixtures/lang/expected/nested.ts b/ts/fixtures/lang/expected/nested.ts new file mode 100644 index 000000000..291c6d56a --- /dev/null +++ b/ts/fixtures/lang/expected/nested.ts @@ -0,0 +1,235 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "./rt.ts"; +import { unwrapOr$Option_u8, map$Option_Option_u8_Option_u8_made_closure0, map$Option_u8_Option_u8_made_closure1_closure0, map$Option_u8_u8_made_closure0_closure0, map$Option_unit_Option_u8_made_closure3, mapOr$Option_u8_u8_iters_closure3, mapOr$Option_u8_usize_iters_closure1, mapOr$Option_unit_u8_made_closure4, andThen$Option_Option_u8_Option_u8_made_closure1, filter$Option_Option_u8_made_closure2, or$Option_Option_u8, xor$Option_Option_u8, flatten$Option_Option_u8 } from "./core/option.ts"; +import * as Halves from "./nested.Halves.ts"; +import type * as Slot from "./nested.Slot.ts"; + +/** + * Run case `kind % 4` over `data`, whose bytes pick each `None`, `Some(None)`, or + * `Some(Some(_))`. + */ +export function nested(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { + const _4: rt.u8 = rt.u8Rem(kind, 4); + if (_4 === 0) { + made(data, out); + } else if (_4 === 1) { + keys(data, out); + } else if (_4 === 2) { + iters(data, out); + } else { + panics(data, out); + } +} + +/** `None` for a byte that is 0 mod 3, `Some(None)` for 1, and else `Some(Some(byte))`. */ +export function pick(b: rt.u8): rt.u8 | undefined | rt.None { + const _2: rt.u8 = rt.u8Rem(b, 3); + if (_2 === 0) { + return rt.None; + } + if (_2 === 1) { + return undefined; + } + return b; +} + +/** `Some(())` for an even byte. */ +export function unit(b: rt.u8): undefined | rt.None { + return rt.thenSome(rt.u8Rem(b, 2) === 0, undefined, undefined, rt.None); +} + +/** Which of the three `o` is, and its byte. */ +export function code(o: rt.u8 | undefined | rt.None): rt.u8 { + if (o === rt.None) { + return 224; + } + if (o === undefined) { + return 225; + } + return o; +} + +/** `?` on an `Option<()>` and on an `Option>`, which return their `None`. */ +export function tried(a: undefined | rt.None, b: rt.u8 | undefined | rt.None): rt.u8 | undefined | rt.None { + if (a !== rt.None) { + const _5: rt.u8 | undefined | rt.None = b; + if (_5 !== rt.None) { + return map$Option_u8_u8_made_closure0_closure0(_5, (x: rt.u8): rt.u8 => { + return rt.u8Div(x, 2); + }); + } + return rt.None; + } + return rt.None; +} + +export function made(data: rt.ByteSlice, out: rt.ByteVec): void { + for (const b of rt.byteSliceView(data)) { + const o: rt.u8 | undefined | rt.None = pick(b); + const u: undefined | rt.None = unit(b); + rt.byteVecPush(out, code(o)); + rt.byteVecPush(out, (o !== rt.None ? 1 : 0) | (((o === rt.None ? 1 : 0) << 1) & 0xff) | (((u !== rt.None ? 1 : 0) << 2) & 0xff) | (((u === rt.None ? 1 : 0) << 3) & 0xff)); + rt.byteVecPush(out, code(map$Option_Option_u8_Option_u8_made_closure0(o, (x: rt.u8 | undefined): rt.u8 | undefined => { + return map$Option_u8_u8_made_closure0_closure0(x, (y: rt.u8): rt.u8 => { + return y ^ 85; + }); + }))); + rt.byteVecPush(out, unwrapOr$Option_u8(flatten$Option_Option_u8(o), 240)); + rt.byteVecPush(out, code(andThen$Option_Option_u8_Option_u8_made_closure1(o, (x2: rt.u8 | undefined): rt.u8 | undefined | rt.None => { + return map$Option_u8_Option_u8_made_closure1_closure0(x2, (y2: rt.u8): rt.u8 | undefined => { + return rt.u8WrappingAdd(y2, 1); + }); + }))); + rt.byteVecPush(out, code(filter$Option_Option_u8_made_closure2(o, (x3: rt.u8 | undefined): boolean => { + return x3 !== undefined; + }))); + rt.byteVecPush(out, code(or$Option_Option_u8(o, undefined as rt.u8 | undefined | rt.None))); + const _58: rt.u8 | undefined | rt.None = map$Option_unit_Option_u8_made_closure3(u, (_: undefined): rt.u8 | undefined => { + return undefined; + }); + rt.byteVecPush(out, code(xor$Option_Option_u8(o, _58))); + rt.byteVecPush(out, mapOr$Option_unit_u8_made_closure4(u, 208, (_2: undefined): rt.u8 => { + return 209; + })); + rt.byteVecPush(out, code(tried(u, o))); + rt.byteVecPush(out, o === o ? 1 : 0); + const slot: Slot.Slot = { held: o, flag: u }; + const taken2: rt.u8 | undefined | rt.None = slot.held; + slot.held = rt.None; + const taken: rt.u8 | undefined | rt.None = taken2; + const taken3: undefined | rt.None = slot.flag; + slot.flag = rt.None; + const flag: undefined | rt.None = taken3; + rt.byteVecPush(out, code(taken) ^ code(slot.held)); + rt.byteVecPush(out, (flag !== rt.None ? 1 : 0) | (((slot.flag !== rt.None ? 1 : 0) << 1) & 0xff)); + const old: rt.u8 | undefined | rt.None = slot.held; + slot.held = b as rt.u8 | undefined | rt.None; + rt.byteVecPush(out, code(old) ^ code(slot.held)); + rt.byteVecPush(out, code(rt.None)); + const args2: rt.Fmt[] = [(f: rt.Formatter) => rt.fmtOption(o, f, (value: rt.u8 | undefined, f: rt.Formatter) => rt.fmtOption(value, f, rt.u8Display), rt.None), (f: rt.Formatter) => rt.fmtOption(u, f, rt.fmtUnit, rt.None)]; + rt.byteVecExtendFromSlice(out, rt.stringAsBytes(rt.fmtFormat([args2[0], " ", args2[1]]))); + } +} + +export function hashOf$Option_Option_u8(value: rt.u8 | undefined | rt.None): rt.u64 { + const h: rt.Hasher = rt.hasher(); + rt.hashOption(rt.hashOption(rt.hashInt), rt.None)(value, h); + return rt.hashFinish(h); +} + +export function order(o: rt.Ordering): rt.u8 { + if (o === -1) { + return 1; + } + if (o === 0) { + return 2; + } + return 3; +} + +/** + * Compared, ordered, and hashed: `None` orders before `Some(None)`, which orders before + * each `Some(Some(_))`. + */ +export function keys(data: rt.ByteSlice, out: rt.ByteVec): void { + let _9!: rt.usize; + const hashed: rt.HashMap<[rt.u8, rt.u8 | undefined | rt.None], rt.u8> = rt.hashNew(rt.hashing(rt.hashTuple([rt.hashInt, rt.hashOption(rt.hashOption(rt.hashInt), rt.None)]), rt.eqTuple([rt.same, rt.same]))) as rt.HashMap<[rt.u8, rt.u8 | undefined | rt.None], rt.u8>; + const sorted: rt.BTreeMap<[rt.u8 | undefined | rt.None, rt.u8], rt.u8> = rt.btreeNew(rt.cmpTuple([rt.cmpOption(rt.cmpOption(rt.cmp), rt.None), rt.cmp])) as rt.BTreeMap<[rt.u8 | undefined | rt.None, rt.u8], rt.u8>; + let iterStart: rt.usize = 1; + const iterEnd: rt.usize = data.length; + while ((_9 = iterStart++) < iterEnd) { + const i: rt.usize = _9; + const _18: rt.usize = rt.usizeSub(i, 1); + rt.idx(data, _18); + const _16: rt.u8 | undefined | rt.None = pick(data.data[data.start + _18]); + rt.idx(data, i); + const _15: [rt.u8 | undefined | rt.None, rt.u8 | undefined | rt.None] = [_16, pick(data.data[data.start + i])]; + const a: rt.u8 | undefined | rt.None = _16; + const b: rt.u8 | undefined | rt.None = _15[1]; + rt.byteVecPush(out, (a === b ? 1 : 0) | (((a !== b ? 1 : 0) << 1) & 0xff) | (((rt.cmpOption(rt.cmpOption(rt.cmp), rt.None)(a, b) === -1 ? 1 : 0) << 2) & 0xff) | ((order(rt.cmpOption(rt.cmpOption(rt.cmp), rt.None)(a, b)) << 3) & 0xff)); + rt.byteVecPush(out, (rt.ordMax(a, b, rt.cmpOption(rt.cmpOption(rt.cmp), rt.None)) === b ? 1 : 0) | (((rt.u64Eq(hashOf$Option_Option_u8(a), hashOf$Option_Option_u8(b)) ? 1 : 0) << 1) & 0xff)); + rt.idx(data, i); + const _75: [rt.u8, rt.u8 | undefined | rt.None] = [rt.u8Rem(data.data[data.start + i], 2), a]; + rt.byteVecPush(out, unwrapOr$Option_u8(rt.hashInsert(hashed, _75, i & 0xff), 204)); + rt.idx(data, i); + const _86: [rt.u8 | undefined | rt.None, rt.u8] = [a, rt.u8Rem(data.data[data.start + i], 2)]; + rt.byteVecPush(out, unwrapOr$Option_u8(rt.btreeInsert(sorted, _86, i & 0xff), 204)); + const _101: rt.usize = rt.usizeSub(i, 1); + rt.idx(data, _101); + const _98: [rt.u8, rt.u8 | undefined | rt.None] = [rt.u8Rem(data.data[data.start + _101], 2), b]; + rt.byteVecPush(out, rt.hashContains(hashed, _98) ? 1 : 0); + } + const iter2: rt.Iter<[[rt.u8 | undefined | rt.None, rt.u8], rt.u8]> = rt.btreeIter(sorted); + while (true) { + const _109: [[rt.u8 | undefined | rt.None, rt.u8], rt.u8] | rt.Done = iter2.next(); + if (_109 === rt.DONE) { + break; + } + rt.byteVecPush(out, code(_109[0][0])); + rt.byteVecPush(out, _109[0][1]); + rt.byteVecPush(out, _109[1]); + } +} + +export function halve(n: rt.u8): rt.u8 | undefined | rt.None { + return rt.thenSome(rt.u8Rem(n, 2) === 0, rt.u8Div(n, 2)); +} + +export function iters(data: rt.ByteSlice, out: rt.ByteVec): void { + const items: Array = rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), (_2: rt.u8): rt.u8 | undefined => { + const b: rt.u8 = _2; + return rt.thenSome(rt.u8Rem(b, 2) === 0, b); + })); + const at: rt.usize = mapOr$Option_u8_usize_iters_closure1(rt.byteSliceFirst(data), 0, (b2: rt.u8): rt.usize => { + return rt.usizeRem(b2 as rt.usize, 4); + }); + rt.byteVecPush(out, code(rt.sliceGet(items, at, rt.None))); + rt.byteVecPush(out, code(rt.sliceFirst(items, rt.None))); + rt.byteVecPush(out, code(rt.boolThen(at > 1, (): rt.u8 | undefined => { + return flatten$Option_Option_u8(rt.sliceGet(items, at, rt.None)); + }, undefined, rt.None))); + const it: rt.Iter = rt.iterSlice(items); + rt.byteVecPush(out, code(rt.iterToOption(it.next(), rt.None))); + rt.byteVecPush(out, code(rt.iterToOption(it.nextBack(), rt.None))); + const iter: rt.Iter = it; + while (true) { + const _42: rt.u8 | undefined | rt.Done = iter.next(); + if (_42 === rt.DONE) { + break; + } + rt.byteVecPush(out, unwrapOr$Option_u8(_42, 225)); + } + const own: Halves.Halves = { _0: rt.u8Rem(data.length & 0xff, 8) }; + rt.byteVecPush(out, code(rt.iterToOption(Halves.next$Iterator(own), rt.None))); + const iter2: Halves.Halves = own; + while (true) { + const _60: rt.u8 | undefined | rt.Done = Halves.next$Iterator(iter2); + if (_60 === rt.DONE) { + break; + } + rt.byteVecPush(out, mapOr$Option_u8_u8_iters_closure3(_60, 225, (x: rt.u8): rt.u8 => { + return x; + })); + } + for (const _68 of rt.byteSliceView(data)) { + const o: rt.u8 | undefined | rt.None = pick(_68); + rt.byteVecPush(out, rt.iterCount(rt.iterOption(o, undefined, rt.None)) & 0xff); + rt.iterForEach(rt.iterOption(o, undefined, rt.None), (x2: rt.u8 | undefined): void => { + rt.byteVecPush(out, unwrapOr$Option_u8(x2, 225)); + }); + rt.iterForEach(rt.iterOption(unit(_68), undefined, rt.None), (_: undefined): void => { + rt.byteVecPush(out, 209); + }); + } +} + +export function panics(data: rt.ByteSlice, out: rt.ByteVec): void { + for (const b of rt.byteSliceView(data)) { + rt.byteVecPush(out, unwrapOr$Option_u8(rt.optionExpect(pick(b), "picked none", rt.None), 225)); + rt.byteVecPush(out, code(rt.optionUnwrap(pick(b), rt.None))); + rt.optionUnwrap(unit(b ^ 1), rt.None); + } +} + +//# sourceMappingURL=nested.ts.map diff --git a/ts/fixtures/lang/expected/shapes.ts b/ts/fixtures/lang/expected/shapes.ts index 4e9f1cb1e..951442313 100644 --- a/ts/fixtures/lang/expected/shapes.ts +++ b/ts/fixtures/lang/expected/shapes.ts @@ -2,7 +2,7 @@ import * as rt from "./rt.ts"; import { copy$ControlFlow_Arc_u8_u8s, copy$ControlFlow_unit_u8s, copy$Gauge, copy$Held, copy$Lens, copy$Level, copy$Mutex_u8_u8, copy$Mutex_u8s, copy$Option_Mutex_u8_u8, copy$Option_Shape, copy$Point, copy$Point_u8, copy$Points, copy$Poll_u8s, copy$Result_Mutex_u8_u8_u8, copy$Shape, copy$u8_u8, copy$u8s } from "./lib.ts"; -import { unwrapOr$Option_u8, map$Option_Dir_Shape_rematched_closure1, map$Option_Dir_u8_from, mapOr$Option_Meters_u64_copies_closure0, mapOr$Option_Mutex_u8_u8_u8_shares_closure0, mapOr$Option_Point_u8_known_closure0_closure0, mapOr$Option_Shape_u8_rematched_closure0, mapOr$Option_Vec_u8_u8_library_closure5, mapOr$Option_u8_usize_shares_closure1, okOr$Option_u8_u8 } from "./core/option.ts"; +import { unwrapOr$Option_u8, map$Option_Dir_Shape_rematched_closure1, map$Option_Dir_u8_from, mapOr$Option_Meters_u64_copies_closure0, mapOr$Option_Mutex_u8_u8_u8_shares_closure0, mapOr$Option_Point_u8_known_closure0_closure0, mapOr$Option_Shape_u8_rematched_closure0, mapOr$Option_Vec_u8_u8_library_closure5, mapOr$Option_u8_usize_iters_closure1, okOr$Option_u8_u8 } from "./core/option.ts"; import { map$Result_u8_str_u8_library_closure1, mapErr$Result_u8_str_u8_library_closure2 } from "./core/result.ts"; import * as Pair from "./fmt.Pair.ts"; import { advance, reset$Gauge } from "./generics.ts"; @@ -390,7 +390,7 @@ export function shares(data: rt.ByteSlice, out: rt.ByteVec): void { const bytes: Uint8Array = Uint8Array.of(a, 1); rt.byteVecPush(out, unsizedCopy(rt.byteSliceFrom(bytes))); rt.byteVecPush(out, bytes[0]); - const at: rt.usize = mapOr$Option_u8_usize_shares_closure1(rt.byteSliceGet(data, 1), 0, (_22: rt.u8): rt.usize => { + const at: rt.usize = mapOr$Option_u8_usize_iters_closure1(rt.byteSliceGet(data, 1), 0, (_22: rt.u8): rt.usize => { return rt.usizeRem(_22 as rt.usize, 3); }); rt.byteVecPush(out, writeAt(rt.byteSliceFrom(bytes), at, a)); diff --git a/ts/fixtures/lang/src/harness.rs b/ts/fixtures/lang/src/harness.rs index 4e8dd0de3..ba25e4799 100644 --- a/ts/fixtures/lang/src/harness.rs +++ b/ts/fixtures/lang/src/harness.rs @@ -2,8 +2,8 @@ //! case and the rest is its input. use crate::{ - chars, chunks, collections, combinators, cows, durations, fmt, generics, ints, iters, keys, refs, shapes, splits, - strs, + chars, chunks, collections, combinators, cows, durations, fmt, generics, ints, iters, keys, nested, refs, shapes, + splits, strs, }; /// The native side's entry: [`run`], except that a case starting with 0xff prints a @@ -22,7 +22,7 @@ pub fn run(input: &[u8]) -> Vec { return out; }; let (op, kind) = (*op, *kind); - match op % 51 { + match op % 52 { 0 => ints::u8_op(kind, data, &mut out), 1 => ints::u16_op(kind, data, &mut out), 2 => ints::u32_op(kind, data, &mut out), @@ -83,6 +83,7 @@ pub fn run(input: &[u8]) -> Vec { 47 => durations::durations(kind, data, &mut out), 48 => combinators::combinators(kind, data, &mut out), 49 => splits::splits(kind, data, &mut out), + 50 => nested::nested(kind, data, &mut out), _ => refs::refs(data, &mut out), } out diff --git a/ts/fixtures/lang/src/lib.rs b/ts/fixtures/lang/src/lib.rs index 25671b6a0..029e20f99 100644 --- a/ts/fixtures/lang/src/lib.rs +++ b/ts/fixtures/lang/src/lib.rs @@ -2,8 +2,8 @@ //! width's arithmetic and casts, `char`s and the `str` methods over them, `Cow`, //! `Duration`, control flow, patterns, byte slices split apart, `Copy` aggregates, //! closures, traits, generic types, formatting, collections, `&mut` to values JS -//! copies, the standard library calls it maps, and `Option`'s and `Result`'s -//! combinators from core's MIR. +//! copies, the standard library calls it maps, `Option`'s and `Result`'s combinators +//! from core's MIR, and `Option`s of values that can already be `undefined`. //! //! `harness::run` is the entry point both sides of the differential test run, and //! `fmt::Fault` an error only `caller.ts` prints. @@ -20,6 +20,7 @@ pub mod harness; mod ints; mod iters; mod keys; +mod nested; mod refs; mod shapes; mod splits; diff --git a/ts/fixtures/lang/src/nested.rs b/ts/fixtures/lang/src/nested.rs new file mode 100644 index 000000000..af717ddb2 --- /dev/null +++ b/ts/fixtures/lang/src/nested.rs @@ -0,0 +1,166 @@ +//! Options of values that can already be `undefined`, `Option>` and +//! `Option<()>`, whose `None` is `rt.None` apart from each `Some`. + +use std::cmp::Ordering; +use std::collections::{BTreeMap, HashMap}; +use std::hash::{DefaultHasher, Hash, Hasher}; + +/// Run case `kind % 4` over `data`, whose bytes pick each `None`, `Some(None)`, or +/// `Some(Some(_))`. +pub fn nested(kind: u8, data: &[u8], out: &mut Vec) { + match kind % 4 { + 0 => made(data, out), + 1 => keys(data, out), + 2 => iters(data, out), + _ => panics(data, out), + } +} + +/// `None` for a byte that is 0 mod 3, `Some(None)` for 1, and else `Some(Some(byte))`. +fn pick(b: u8) -> Option> { + match b % 3 { + 0 => None, + 1 => Some(None), + _ => Some(Some(b)), + } +} + +/// `Some(())` for an even byte. +fn unit(b: u8) -> Option<()> { + (b % 2 == 0).then_some(()) +} + +/// Which of the three `o` is, and its byte. +fn code(o: Option>) -> u8 { + match o { + None => 0xe0, + Some(None) => 0xe1, + Some(Some(b)) => b, + } +} + +/// `?` on an `Option<()>` and on an `Option>`, which return their `None`. +fn tried(a: Option<()>, b: Option>) -> Option> { + a?; + let inner = b?; + Some(inner.map(|x| x / 2)) +} + +struct Slot { + held: Option>, + flag: Option<()>, +} + +fn made(data: &[u8], out: &mut Vec) { + for &b in data { + let o = pick(b); + let u = unit(b); + out.push(code(o)); + out.push(o.is_some() as u8 | (o.is_none() as u8) << 1 | (u.is_some() as u8) << 2 | (u.is_none() as u8) << 3); + out.push(code(o.map(|x| x.map(|y| y ^ 0x55)))); + out.push(o.flatten().unwrap_or(0xf0)); + out.push(code(o.and_then(|x| x.map(|y| Some(y.wrapping_add(1)))))); + out.push(code(o.filter(|x| x.is_some()))); + out.push(code(o.or(Some(None)))); + out.push(code(o.xor(u.map(|()| None)))); + out.push(u.map_or(0xd0, |()| 0xd1)); + out.push(code(tried(u, o))); + let copied = o.as_ref().copied(); + out.push((copied == o) as u8); + let mut slot = Slot { held: o, flag: u }; + let taken = slot.held.take(); + let flag = std::mem::take(&mut slot.flag); + out.push(code(taken) ^ code(slot.held)); + out.push(flag.is_some() as u8 | (slot.flag.is_some() as u8) << 1); + let replaced = std::mem::replace(&mut slot.held, Some(Some(b))); + out.push(code(replaced) ^ code(slot.held)); + let default: Option> = Default::default(); + out.push(code(default)); + out.extend_from_slice(format!("{o:?} {u:?}").as_bytes()); + } +} + +fn hash_of(value: &T) -> u64 { + let mut h = DefaultHasher::new(); + value.hash(&mut h); + h.finish() +} + +fn order(o: Ordering) -> u8 { + match o { + Ordering::Less => 1, + Ordering::Equal => 2, + Ordering::Greater => 3, + } +} + +/// Compared, ordered, and hashed: `None` orders before `Some(None)`, which orders before +/// each `Some(Some(_))`. +fn keys(data: &[u8], out: &mut Vec) { + let mut hashed: HashMap<(u8, Option>), u8> = HashMap::new(); + let mut sorted: BTreeMap<(Option>, u8), u8> = BTreeMap::new(); + for i in 1..data.len() { + let (a, b) = (pick(data[i - 1]), pick(data[i])); + out.push((a == b) as u8 | ((a != b) as u8) << 1 | ((a < b) as u8) << 2 | order(a.cmp(&b)) << 3); + out.push((a.max(b) == b) as u8 | ((hash_of(&a) == hash_of(&b)) as u8) << 1); + out.push(hashed.insert((data[i] % 2, a), i as u8).unwrap_or(0xcc)); + out.push(sorted.insert((a, data[i] % 2), i as u8).unwrap_or(0xcc)); + out.push(hashed.contains_key(&(data[i - 1] % 2, b)) as u8); + } + for ((o, n), v) in &sorted { + out.push(code(*o)); + out.push(*n); + out.push(*v); + } +} + +/// Counts down to 0, yielding each count as an `Option`: `None` for each odd one. +struct Halves(u8); + +impl Iterator for Halves { + type Item = Option; + + fn next(&mut self) -> Option> { + let n = self.0.checked_sub(1)?; + self.0 = n; + halve(n) + } +} + +fn halve(n: u8) -> Option> { + Some((n % 2 == 0).then_some(n / 2)) +} + +fn iters(data: &[u8], out: &mut Vec) { + let items: Vec> = data.iter().map(|&b| (b % 2 == 0).then_some(b)).collect(); + let at = data.first().map_or(0, |b| usize::from(*b) % 4); + out.push(code(items.get(at).copied())); + out.push(code(items.first().copied())); + out.push(code((at > 1).then(|| items.get(at).copied().flatten()))); + let mut it = items.iter().copied(); + out.push(code(it.next())); + out.push(code(it.next_back())); + for item in it { + out.push(item.unwrap_or(0xe1)); + } + let mut own = Halves(data.len() as u8 % 8); + let first = own.next(); + out.push(code(first)); + for item in own { + out.push(item.map_or(0xe1, |x| x)); + } + for b in data { + let o = pick(*b); + out.push(o.iter().count() as u8); + o.into_iter().for_each(|x| out.push(x.unwrap_or(0xe1))); + unit(*b).into_iter().for_each(|()| out.push(0xd1)); + } +} + +fn panics(data: &[u8], out: &mut Vec) { + for &b in data { + out.push(pick(b).expect("picked none").unwrap_or(0xe1)); + out.push(code(Some(pick(b).unwrap()))); + unit(b ^ 1).unwrap(); + } +} diff --git a/ts/fixtures/reject/census.md b/ts/fixtures/reject/census.md index 846a14f13..a65260fdf 100644 --- a/ts/fixtures/reject/census.md +++ b/ts/fixtures/reject/census.md @@ -1,6 +1,6 @@ # Census of `reject-fixture` -- Refusals: 86 +- Refusals: 84 - Function instances: 73 - Generic functions no instance reached, lowered over their type parameters: 2 @@ -9,52 +9,53 @@ | Count | Construct | First | | ---: | --- | --- | | 10 | unsupported call to `_` | fixtures/reject/src/lib.rs:28:4 | -| 6 | `_` is not supported: its `None` and `Some` would both be `undefined` | fixtures/reject/src/lib.rs:23:15 | -| 5 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | fixtures/reject/src/lib.rs:45:11 | -| 4 | a variant of `_`, which is not supported: either is the same JS string | fixtures/reject/src/lib.rs:397:2 | -| 4 | an assignment through a reference to `_` | fixtures/reject/src/lib.rs:109:2 | +| 5 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | fixtures/reject/src/lib.rs:56:11 | +| 4 | a variant of `_`, which is not supported: either is the same JS string | fixtures/reject/src/lib.rs:403:2 | +| 4 | an assignment through a reference to `_` | fixtures/reject/src/lib.rs:120:2 | | 4 | unsupported type `_` | fixtures/reject/src/lib.rs:7:14 | | 3 | `_` with a mutable reference to a value JS copies, which its mapping would copy | fixtures/reject/src/lib.rs:17:2 | -| 3 | dropping `_`, which is not supported yet | fixtures/reject/src/lib.rs:45:18 | -| 3 | replacing the value behind a reference to `_` | fixtures/reject/src/lib.rs:93:2 | -| 2 | `_` is not supported: it would be pending two ways with one value | fixtures/reject/src/lib.rs:113:20 | -| 2 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | fixtures/reject/src/lib.rs:265:16 | -| 2 | a field of `_` | fixtures/reject/src/lib.rs:281:7 | -| 2 | an iterator of the crate implementing `_`, which is not supported yet | fixtures/reject/src/lib.rs:172:1 | -| 2 | constructing `_` from another crate | fixtures/reject/src/lib.rs:158:23 | -| 2 | overriding `_`, which std's adaptors call in place of `next` or beside it | fixtures/reject/src/lib.rs:152:2 | -| 1 | `Binary` formatting, as in `{:b}`, is not supported | fixtures/reject/src/lib.rs:70:3 | -| 1 | `LowerExp` formatting, as in `{:e}`, is not supported | fixtures/reject/src/lib.rs:72:3 | -| 1 | `Octal` formatting, as in `{:o}`, is not supported | fixtures/reject/src/lib.rs:71:3 | -| 1 | `Pointer` formatting, as in `{:p}`, is not supported | fixtures/reject/src/lib.rs:75:3 | -| 1 | `_` holds `_`, which is `undefined` as `None` is, which is not supported | fixtures/reject/src/lib.rs:286:6 | -| 1 | `_` is not supported yet | fixtures/reject/src/lib.rs:408:18 | -| 1 | `_` of `_` by `_`, which is not supported yet | fixtures/reject/src/lib.rs:309:6 | -| 1 | `_` of `_`, which drops `_`, which is not supported yet | fixtures/reject/src/lib.rs:51:13 | -| 1 | `_` through a held type's own, which is not supported yet | fixtures/reject/src/lib.rs:341:2 | -| 1 | `_`, which is not supported yet | fixtures/reject/src/lib.rs:317:9 | -| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | fixtures/reject/src/lib.rs:234:26 | -| 1 | a `_` cast from `_` to `_` | fixtures/reject/src/lib.rs:104:2 | -| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | fixtures/reject/src/lib.rs:239:30 | -| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | fixtures/reject/src/lib.rs:185:51 | -| 1 | a coercion to `_` | fixtures/reject/src/lib.rs:364:2 | -| 1 | a constant of type `_` | fixtures/reject/src/lib.rs:88:2 | -| 1 | a copy of a closure that changes what it captured | fixtures/reject/src/lib.rs:275:14 | -| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | fixtures/reject/src/lib.rs:244:13 | -| 1 | a mutable reference into a `Result`'s payload, passed on or kept | fixtures/reject/src/lib.rs:446:12 | -| 1 | a precision, as in `{:.2}`, is not supported | fixtures/reject/src/lib.rs:67:3 | -| 1 | a printable type must implement `Display` or `Debug` | fixtures/reject/src/lib.rs:100:1 | +| 3 | dropping `_`, which is not supported yet | fixtures/reject/src/lib.rs:56:18 | +| 3 | replacing the value behind a reference to `_` | fixtures/reject/src/lib.rs:104:2 | +| 2 | `_` is not supported: it would be pending two ways with one value | fixtures/reject/src/lib.rs:124:20 | +| 2 | `_` is not supported: its `None` and `Some` would both be `rt.None` | fixtures/reject/src/lib.rs:23:15 | +| 2 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | fixtures/reject/src/lib.rs:43:42 | +| 2 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | fixtures/reject/src/lib.rs:271:16 | +| 2 | a field of `_` | fixtures/reject/src/lib.rs:287:7 | +| 2 | an iterator of the crate implementing `_`, which is not supported yet | fixtures/reject/src/lib.rs:178:1 | +| 2 | constructing `_` from another crate | fixtures/reject/src/lib.rs:164:23 | +| 2 | overriding `_`, which std's adaptors call in place of `next` or beside it | fixtures/reject/src/lib.rs:158:2 | +| 1 | `Binary` formatting, as in `{:b}`, is not supported | fixtures/reject/src/lib.rs:81:3 | +| 1 | `LowerExp` formatting, as in `{:e}`, is not supported | fixtures/reject/src/lib.rs:83:3 | +| 1 | `Octal` formatting, as in `{:o}`, is not supported | fixtures/reject/src/lib.rs:82:3 | +| 1 | `Pointer` formatting, as in `{:p}`, is not supported | fixtures/reject/src/lib.rs:86:3 | +| 1 | `_` is not supported yet | fixtures/reject/src/lib.rs:414:18 | +| 1 | `_` is not supported: its field `_` is `_`, typed `_`, whose `None` would be `rt.None` as `_` | fixtures/reject/src/lib.rs:38:2 | +| 1 | `_` of `_` by `_`, which is not supported yet | fixtures/reject/src/lib.rs:315:6 | +| 1 | `_` of `_`, which drops `_`, which is not supported yet | fixtures/reject/src/lib.rs:62:13 | +| 1 | `_` through a held type's own, which is not supported yet | fixtures/reject/src/lib.rs:347:2 | +| 1 | `_`, which is not supported yet | fixtures/reject/src/lib.rs:323:9 | +| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | fixtures/reject/src/lib.rs:240:26 | +| 1 | a `_` cast from `_` to `_` | fixtures/reject/src/lib.rs:115:2 | +| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | fixtures/reject/src/lib.rs:245:30 | +| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | fixtures/reject/src/lib.rs:191:51 | +| 1 | a coercion to `_` | fixtures/reject/src/lib.rs:370:2 | +| 1 | a constant of type `_` | fixtures/reject/src/lib.rs:99:2 | +| 1 | a copy of a closure that changes what it captured | fixtures/reject/src/lib.rs:281:14 | +| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | fixtures/reject/src/lib.rs:250:13 | +| 1 | a mutable reference into a `Result`'s payload, passed on or kept | fixtures/reject/src/lib.rs:452:12 | +| 1 | a precision, as in `{:.2}`, is not supported | fixtures/reject/src/lib.rs:78:3 | +| 1 | a printable type must implement `Display` or `Debug` | fixtures/reject/src/lib.rs:111:1 | | 1 | a scalar constant of type `_` | fixtures/reject/src/lib.rs:8:2 | -| 1 | a width or precision from an argument, as in `{:1$}`, is not supported | fixtures/reject/src/lib.rs:74:3 | -| 1 | a zero-sized constant of type `_` | fixtures/reject/src/lib.rs:60:2 | -| 1 | an iterator that owns `_`, which drops, which is not supported yet | fixtures/reject/src/lib.rs:391:13 | +| 1 | a width or precision from an argument, as in `{:1$}`, is not supported | fixtures/reject/src/lib.rs:85:3 | +| 1 | a zero-sized constant of type `_` | fixtures/reject/src/lib.rs:71:2 | +| 1 | an iterator that owns `_`, which drops, which is not supported yet | fixtures/reject/src/lib.rs:397:13 | | 1 | arithmetic on `_` | fixtures/reject/src/lib.rs:8:2 | -| 1 | comparing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:291:52 | -| 1 | constructing `_` | fixtures/reject/src/lib.rs:415:53 | -| 1 | hashing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:291:52 | -| 1 | hex `Debug`, as in `{:x?}`, is not supported | fixtures/reject/src/lib.rs:73:3 | -| 1 | the `+` flag of a format spec is not supported | fixtures/reject/src/lib.rs:68:3 | -| 1 | the `-` flag of a format spec is not supported | fixtures/reject/src/lib.rs:69:3 | +| 1 | comparing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:297:52 | +| 1 | constructing `_` | fixtures/reject/src/lib.rs:421:53 | +| 1 | hashing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:297:52 | +| 1 | hex `Debug`, as in `{:x?}`, is not supported | fixtures/reject/src/lib.rs:84:3 | +| 1 | the `+` flag of a format spec is not supported | fixtures/reject/src/lib.rs:79:3 | +| 1 | the `-` flag of a format spec is not supported | fixtures/reject/src/lib.rs:80:3 | ## By API @@ -62,116 +63,121 @@ The type or module each refused type or path belongs to. | Count | API | First | | ---: | --- | --- | -| 7 | `std::borrow::Cow` | fixtures/reject/src/lib.rs:397:2 | -| 6 | `Option` | fixtures/reject/src/lib.rs:23:15 | +| 7 | `std::borrow::Cow` | fixtures/reject/src/lib.rs:403:2 | | 6 | `f64` | fixtures/reject/src/lib.rs:7:14 | -| 5 | `{closure}` | fixtures/reject/src/lib.rs:45:11 | -| 4 | `Iterator` | fixtures/reject/src/lib.rs:45:11 | -| 3 | `std::collections::HashMap` | fixtures/reject/src/lib.rs:51:13 | -| 3 | `std::iter::Map` | fixtures/reject/src/lib.rs:45:18 | +| 5 | `Iterator` | fixtures/reject/src/lib.rs:43:42 | +| 5 | `Option` | fixtures/reject/src/lib.rs:23:15 | +| 5 | `{closure}` | fixtures/reject/src/lib.rs:56:11 | +| 3 | `std::iter::Map` | fixtures/reject/src/lib.rs:56:18 | | 3 | `std::slice` | fixtures/reject/src/lib.rs:28:4 | -| 3 | `std::sync::Arc` | fixtures/reject/src/lib.rs:109:2 | -| 2 | `Meters` | fixtures/reject/src/lib.rs:93:2 | -| 2 | `Noisy` | fixtures/reject/src/lib.rs:51:13 | -| 2 | `Poll` | fixtures/reject/src/lib.rs:113:20 | -| 2 | `std::iter::Iterator` | fixtures/reject/src/lib.rs:265:16 | -| 2 | `std::iter::Take` | fixtures/reject/src/lib.rs:389:79 | -| 2 | `std::ops::Range` | fixtures/reject/src/lib.rs:193:8 | -| 2 | `std::option::Option` | fixtures/reject/src/lib.rs:286:6 | -| 2 | `std::pin::Pin` | fixtures/reject/src/lib.rs:129:2 | -| 2 | `std::vec::Vec` | fixtures/reject/src/lib.rs:291:52 | -| 2 | `u8` | fixtures/reject/src/lib.rs:88:2 | -| 1 | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:172:1 | -| 1 | `Entry` | fixtures/reject/src/lib.rs:380:13 | -| 1 | `FusedIterator` | fixtures/reject/src/lib.rs:226:1 | -| 1 | `HashMap` | fixtures/reject/src/lib.rs:309:6 | -| 1 | `Hasher` | fixtures/reject/src/lib.rs:317:9 | -| 1 | `IntToFloat` | fixtures/reject/src/lib.rs:104:2 | -| 1 | `[u16; 1]` | fixtures/reject/src/lib.rs:258:22 | +| 3 | `std::sync::Arc` | fixtures/reject/src/lib.rs:120:2 | +| 2 | `HashMap` | fixtures/reject/src/lib.rs:292:6 | +| 2 | `Meters` | fixtures/reject/src/lib.rs:104:2 | +| 2 | `Noisy` | fixtures/reject/src/lib.rs:62:13 | +| 2 | `Poll` | fixtures/reject/src/lib.rs:124:20 | +| 2 | `std::collections::HashMap` | fixtures/reject/src/lib.rs:62:13 | +| 2 | `std::iter::Iterator` | fixtures/reject/src/lib.rs:271:16 | +| 2 | `std::iter::Take` | fixtures/reject/src/lib.rs:395:79 | +| 2 | `std::ops::Range` | fixtures/reject/src/lib.rs:199:8 | +| 2 | `std::pin::Pin` | fixtures/reject/src/lib.rs:135:2 | +| 2 | `std::vec::Vec` | fixtures/reject/src/lib.rs:297:52 | +| 2 | `u8` | fixtures/reject/src/lib.rs:99:2 | +| 1 | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:178:1 | +| 1 | `Entry` | fixtures/reject/src/lib.rs:386:13 | +| 1 | `FusedIterator` | fixtures/reject/src/lib.rs:232:1 | +| 1 | `Hasher` | fixtures/reject/src/lib.rs:323:9 | +| 1 | `IntToFloat` | fixtures/reject/src/lib.rs:115:2 | +| 1 | `Maybe` | fixtures/reject/src/lib.rs:38:2 | +| 1 | `T \| undefined` | fixtures/reject/src/lib.rs:38:2 | +| 1 | `[u16; 1]` | fixtures/reject/src/lib.rs:264:22 | | 1 | `dyn std::ops::Fn(u8) -> u8` | fixtures/reject/src/lib.rs:11:16 | -| 1 | `from_fn` | fixtures/reject/src/lib.rs:390:13 | -| 1 | `into_keys` | fixtures/reject/src/lib.rs:51:13 | -| 1 | `std::collections::hash_map::Entry` | fixtures/reject/src/lib.rs:436:15 | -| 1 | `std::iter::Chain` | fixtures/reject/src/lib.rs:185:51 | -| 1 | `std::iter::Flatten` | fixtures/reject/src/lib.rs:234:26 | +| 1 | `from_fn` | fixtures/reject/src/lib.rs:396:13 | +| 1 | `into_keys` | fixtures/reject/src/lib.rs:62:13 | +| 1 | `std::collections::hash_map::Entry` | fixtures/reject/src/lib.rs:442:15 | +| 1 | `std::iter::Chain` | fixtures/reject/src/lib.rs:191:51 | +| 1 | `std::iter::Flatten` | fixtures/reject/src/lib.rs:240:26 | | 1 | `std::iter::IntoIterator` | fixtures/reject/src/lib.rs:17:2 | -| 1 | `std::iter::Rev` | fixtures/reject/src/lib.rs:179:14 | -| 1 | `std::mem` | fixtures/reject/src/lib.rs:44:29 | -| 1 | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:281:48 | -| 1 | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:281:7 | -| 1 | `std::slice::Iter` | fixtures/reject/src/lib.rs:139:11 | -| 1 | `std::str` | fixtures/reject/src/lib.rs:370:4 | -| 1 | `std::string::String` | fixtures/reject/src/lib.rs:82:10 | -| 1 | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:134:2 | -| 1 | `std::time::Duration` | fixtures/reject/src/lib.rs:423:2 | -| 1 | `successors` | fixtures/reject/src/lib.rs:389:15 | -| 1 | `u32` | fixtures/reject/src/lib.rs:244:13 | -| 1 | `u64` | fixtures/reject/src/lib.rs:104:2 | -| 1 | `{async closure}` | fixtures/reject/src/lib.rs:60:2 | +| 1 | `std::iter::Rev` | fixtures/reject/src/lib.rs:185:14 | +| 1 | `std::mem` | fixtures/reject/src/lib.rs:55:29 | +| 1 | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:287:48 | +| 1 | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:287:7 | +| 1 | `std::option::Option` | fixtures/reject/src/lib.rs:459:2 | +| 1 | `std::slice::Iter` | fixtures/reject/src/lib.rs:145:11 | +| 1 | `std::str` | fixtures/reject/src/lib.rs:376:4 | +| 1 | `std::string::String` | fixtures/reject/src/lib.rs:93:10 | +| 1 | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:140:2 | +| 1 | `std::time::Duration` | fixtures/reject/src/lib.rs:429:2 | +| 1 | `successors` | fixtures/reject/src/lib.rs:395:15 | +| 1 | `u32` | fixtures/reject/src/lib.rs:250:13 | +| 1 | `u64` | fixtures/reject/src/lib.rs:115:2 | +| 1 | `value` | fixtures/reject/src/lib.rs:38:2 | +| 1 | `{async closure}` | fixtures/reject/src/lib.rs:71:2 | ## By type or path | Count | Construct | Type or path | First | | ---: | --- | --- | --- | -| 6 | `_` is not supported: its `None` and `Some` would both be `undefined` | `Option` | fixtures/reject/src/lib.rs:23:15 | -| 4 | a variant of `_`, which is not supported: either is the same JS string | `std::borrow::Cow` | fixtures/reject/src/lib.rs:397:2 | +| 4 | a variant of `_`, which is not supported: either is the same JS string | `std::borrow::Cow` | fixtures/reject/src/lib.rs:403:2 | | 3 | unsupported type `_` | `f64` | fixtures/reject/src/lib.rs:7:14 | -| 2 | `_` is not supported: it would be pending two ways with one value | `Poll` | fixtures/reject/src/lib.rs:113:20 | -| 2 | an assignment through a reference to `_` | `std::pin::Pin` | fixtures/reject/src/lib.rs:129:2 | -| 2 | dropping `_`, which is not supported yet | `std::iter::Take` | fixtures/reject/src/lib.rs:389:79 | -| 2 | replacing the value behind a reference to `_` | `Meters` | fixtures/reject/src/lib.rs:93:2 | -| 1 | `_` holds `_`, which is `undefined` as `None` is, which is not supported | `std::collections::HashMap`, `std::option::Option` | fixtures/reject/src/lib.rs:286:6 | -| 1 | `_` is not supported yet | `std::borrow::Cow` | fixtures/reject/src/lib.rs:408:18 | -| 1 | `_` of `_` by `_`, which is not supported yet | `HashMap::contains_key`, `std::collections::HashMap`, `u8` | fixtures/reject/src/lib.rs:309:6 | -| 1 | `_` of `_`, which drops `_`, which is not supported yet | `into_keys`, `std::collections::HashMap`, `Noisy` | fixtures/reject/src/lib.rs:51:13 | -| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::count` | fixtures/reject/src/lib.rs:265:38 | -| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::filter` | fixtures/reject/src/lib.rs:265:16 | -| 1 | `_` through a held type's own, which is not supported yet | `::ne` | fixtures/reject/src/lib.rs:341:2 | -| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::collections::hash_map::Entry::and_modify` | fixtures/reject/src/lib.rs:436:15 | +| 2 | `_` is not supported: it would be pending two ways with one value | `Poll` | fixtures/reject/src/lib.rs:124:20 | +| 2 | `_` is not supported: its `None` and `Some` would both be `rt.None` | `Option` | fixtures/reject/src/lib.rs:23:15 | +| 2 | an assignment through a reference to `_` | `std::pin::Pin` | fixtures/reject/src/lib.rs:135:2 | +| 2 | dropping `_`, which is not supported yet | `std::iter::Take` | fixtures/reject/src/lib.rs:395:79 | +| 2 | replacing the value behind a reference to `_` | `Meters` | fixtures/reject/src/lib.rs:104:2 | +| 1 | `_` is not supported yet | `std::borrow::Cow` | fixtures/reject/src/lib.rs:414:18 | +| 1 | `_` is not supported: its field `_` is `_`, typed `_`, whose `None` would be `rt.None` as `_` | `Maybe`, `value`, `Option`, `T \| undefined`, `Option` | fixtures/reject/src/lib.rs:38:2 | +| 1 | `_` of `_` by `_`, which is not supported yet | `HashMap::contains_key`, `std::collections::HashMap`, `u8` | fixtures/reject/src/lib.rs:315:6 | +| 1 | `_` of `_`, which drops `_`, which is not supported yet | `into_keys`, `std::collections::HashMap`, `Noisy` | fixtures/reject/src/lib.rs:62:13 | +| 1 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | `HashMap::get`, `Option` | fixtures/reject/src/lib.rs:292:6 | +| 1 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | `Iterator::find`, `Option` | fixtures/reject/src/lib.rs:43:42 | +| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::count` | fixtures/reject/src/lib.rs:271:38 | +| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::filter` | fixtures/reject/src/lib.rs:271:16 | +| 1 | `_` through a held type's own, which is not supported yet | `::ne` | fixtures/reject/src/lib.rs:347:2 | +| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::collections::hash_map::Entry::and_modify` | fixtures/reject/src/lib.rs:442:15 | | 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::iter::IntoIterator::into_iter` | fixtures/reject/src/lib.rs:17:2 | -| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::slice::last_mut` | fixtures/reject/src/lib.rs:429:21 | -| 1 | `_`, which is not supported yet | `Hasher::write` | fixtures/reject/src/lib.rs:317:9 | -| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | `std::iter::Flatten` | fixtures/reject/src/lib.rs:234:26 | -| 1 | a `_` cast from `_` to `_` | `IntToFloat`, `u64`, `f64` | fixtures/reject/src/lib.rs:104:2 | -| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | `std::iter::Map`, `std::ops::Range` | fixtures/reject/src/lib.rs:239:30 | -| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | `std::iter::Chain` | fixtures/reject/src/lib.rs:185:51 | -| 1 | a coercion to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:364:2 | -| 1 | a constant of type `_` | `&u8` | fixtures/reject/src/lib.rs:88:2 | -| 1 | a field of `_` | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:281:48 | -| 1 | a field of `_` | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:281:7 | -| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | `u32` | fixtures/reject/src/lib.rs:244:13 | +| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::slice::last_mut` | fixtures/reject/src/lib.rs:435:21 | +| 1 | `_`, which is not supported yet | `Hasher::write` | fixtures/reject/src/lib.rs:323:9 | +| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | `std::iter::Flatten` | fixtures/reject/src/lib.rs:240:26 | +| 1 | a `_` cast from `_` to `_` | `IntToFloat`, `u64`, `f64` | fixtures/reject/src/lib.rs:115:2 | +| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | `std::iter::Map`, `std::ops::Range` | fixtures/reject/src/lib.rs:245:30 | +| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | `std::iter::Chain` | fixtures/reject/src/lib.rs:191:51 | +| 1 | a coercion to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:370:2 | +| 1 | a constant of type `_` | `&u8` | fixtures/reject/src/lib.rs:99:2 | +| 1 | a field of `_` | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:287:48 | +| 1 | a field of `_` | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:287:7 | +| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | `u32` | fixtures/reject/src/lib.rs:250:13 | | 1 | a scalar constant of type `_` | `f64` | fixtures/reject/src/lib.rs:8:2 | -| 1 | a zero-sized constant of type `_` | `{async closure}` | fixtures/reject/src/lib.rs:60:2 | -| 1 | an assignment through a reference to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:109:2 | -| 1 | an assignment through a reference to `_` | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:134:2 | -| 1 | an iterator of the crate implementing `_`, which is not supported yet | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:172:1 | -| 1 | an iterator of the crate implementing `_`, which is not supported yet | `FusedIterator` | fixtures/reject/src/lib.rs:226:1 | -| 1 | an iterator that owns `_`, which drops, which is not supported yet | `Noisy` | fixtures/reject/src/lib.rs:391:13 | +| 1 | a zero-sized constant of type `_` | `{async closure}` | fixtures/reject/src/lib.rs:71:2 | +| 1 | an assignment through a reference to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:120:2 | +| 1 | an assignment through a reference to `_` | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:140:2 | +| 1 | an iterator of the crate implementing `_`, which is not supported yet | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:178:1 | +| 1 | an iterator of the crate implementing `_`, which is not supported yet | `FusedIterator` | fixtures/reject/src/lib.rs:232:1 | +| 1 | an iterator that owns `_`, which drops, which is not supported yet | `Noisy` | fixtures/reject/src/lib.rs:397:13 | | 1 | arithmetic on `_` | `f64` | fixtures/reject/src/lib.rs:8:2 | -| 1 | comparing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:291:52 | -| 1 | constructing `_` | `std::borrow::Cow` | fixtures/reject/src/lib.rs:415:53 | -| 1 | constructing `_` from another crate | `std::iter::Map` | fixtures/reject/src/lib.rs:158:23 | -| 1 | constructing `_` from another crate | `std::iter::Rev` | fixtures/reject/src/lib.rs:179:14 | -| 1 | dropping `_`, which is not supported yet | `std::iter::Map` | fixtures/reject/src/lib.rs:45:18 | -| 1 | hashing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:291:52 | -| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::fold` | fixtures/reject/src/lib.rs:152:2 | -| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::size_hint` | fixtures/reject/src/lib.rs:206:2 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Entry::or_insert_with` | fixtures/reject/src/lib.rs:380:13 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::any` | fixtures/reject/src/lib.rs:381:11 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::map` | fixtures/reject/src/lib.rs:45:11 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `from_fn::from_fn` | fixtures/reject/src/lib.rs:390:13 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `successors::successors` | fixtures/reject/src/lib.rs:389:15 | -| 1 | replacing the value behind a reference to `_` | `[u16; 1]` | fixtures/reject/src/lib.rs:258:22 | -| 1 | unsupported call to `_` | `::deref` | fixtures/reject/src/lib.rs:409:2 | -| 1 | unsupported call to `_` | `::eq` | fixtures/reject/src/lib.rs:453:2 | -| 1 | unsupported call to `_` | `::cycle` | fixtures/reject/src/lib.rs:139:11 | -| 1 | unsupported call to `_` | `::write_fmt` | fixtures/reject/src/lib.rs:82:10 | -| 1 | unsupported call to `_` | `::add_assign` | fixtures/reject/src/lib.rs:423:2 | -| 1 | unsupported call to `_` | `std::mem::size_of_val` | fixtures/reject/src/lib.rs:44:29 | -| 1 | unsupported call to `_` | `std::ops::Range::contains` | fixtures/reject/src/lib.rs:193:8 | -| 1 | unsupported call to `_` | `std::slice::copy_within` | fixtures/reject/src/lib.rs:359:4 | +| 1 | comparing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:297:52 | +| 1 | constructing `_` | `std::borrow::Cow` | fixtures/reject/src/lib.rs:421:53 | +| 1 | constructing `_` from another crate | `std::iter::Map` | fixtures/reject/src/lib.rs:164:23 | +| 1 | constructing `_` from another crate | `std::iter::Rev` | fixtures/reject/src/lib.rs:185:14 | +| 1 | dropping `_`, which is not supported yet | `std::iter::Map` | fixtures/reject/src/lib.rs:56:18 | +| 1 | hashing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:297:52 | +| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::fold` | fixtures/reject/src/lib.rs:158:2 | +| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::size_hint` | fixtures/reject/src/lib.rs:212:2 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Entry::or_insert_with` | fixtures/reject/src/lib.rs:386:13 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::any` | fixtures/reject/src/lib.rs:387:11 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::map` | fixtures/reject/src/lib.rs:56:11 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `from_fn::from_fn` | fixtures/reject/src/lib.rs:396:13 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `successors::successors` | fixtures/reject/src/lib.rs:395:15 | +| 1 | replacing the value behind a reference to `_` | `[u16; 1]` | fixtures/reject/src/lib.rs:264:22 | +| 1 | unsupported call to `_` | `::deref` | fixtures/reject/src/lib.rs:415:2 | +| 1 | unsupported call to `_` | `::eq` | fixtures/reject/src/lib.rs:459:2 | +| 1 | unsupported call to `_` | `::cycle` | fixtures/reject/src/lib.rs:145:11 | +| 1 | unsupported call to `_` | `::write_fmt` | fixtures/reject/src/lib.rs:93:10 | +| 1 | unsupported call to `_` | `::add_assign` | fixtures/reject/src/lib.rs:429:2 | +| 1 | unsupported call to `_` | `std::mem::size_of_val` | fixtures/reject/src/lib.rs:55:29 | +| 1 | unsupported call to `_` | `std::ops::Range::contains` | fixtures/reject/src/lib.rs:199:8 | +| 1 | unsupported call to `_` | `std::slice::copy_within` | fixtures/reject/src/lib.rs:365:4 | | 1 | unsupported call to `_` | `std::slice::sort` | fixtures/reject/src/lib.rs:28:4 | -| 1 | unsupported call to `_` | `std::str::split` | fixtures/reject/src/lib.rs:370:4 | +| 1 | unsupported call to `_` | `std::str::split` | fixtures/reject/src/lib.rs:376:4 | | 1 | unsupported type `_` | `dyn std::ops::Fn(u8) -> u8` | fixtures/reject/src/lib.rs:11:16 | ## Spans @@ -179,54 +185,43 @@ The type or module each refused type or path belongs to.
unsupported call to `_` (10) - fixtures/reject/src/lib.rs:28:4: unsupported call to `std::slice::::sort` -- fixtures/reject/src/lib.rs:44:29: unsupported call to `std::mem::size_of_val::` -- fixtures/reject/src/lib.rs:82:10: unsupported call to `::write_fmt` -- fixtures/reject/src/lib.rs:139:11: unsupported call to ` as std::iter::Iterator>::cycle` -- fixtures/reject/src/lib.rs:193:8: unsupported call to `std::ops::Range::::contains::` -- fixtures/reject/src/lib.rs:359:4: unsupported call to `core::slice::::copy_within::>` -- fixtures/reject/src/lib.rs:370:4: unsupported call to `core::str::::split::<[char; 2]>` -- fixtures/reject/src/lib.rs:409:2: unsupported call to ` as std::ops::Deref>::deref` -- fixtures/reject/src/lib.rs:423:2: unsupported call to `::add_assign` -- fixtures/reject/src/lib.rs:453:2: unsupported call to ` as std::cmp::PartialEq>::eq` - -
- -
`_` is not supported: its `None` and `Some` would both be `undefined` (6) - -- fixtures/reject/src/lib.rs:23:15: `Option>` is not supported: its `None` and `Some` would both be `undefined` -- fixtures/reject/src/lib.rs:24:2: `Option>` is not supported: its `None` and `Some` would both be `undefined` -- fixtures/reject/src/lib.rs:32:2: `Option>` is not supported: its `None` and `Some` would both be `undefined` -- fixtures/reject/src/lib.rs:32:42: `Option>` is not supported: its `None` and `Some` would both be `undefined` -- fixtures/reject/src/lib.rs:118:19: `Option>` is not supported: its `None` and `Some` would both be `undefined` -- fixtures/reject/src/lib.rs:286:2: `Option<&std::option::Option>` is not supported: its `None` and `Some` would both be `undefined` +- fixtures/reject/src/lib.rs:55:29: unsupported call to `std::mem::size_of_val::` +- fixtures/reject/src/lib.rs:93:10: unsupported call to `::write_fmt` +- fixtures/reject/src/lib.rs:145:11: unsupported call to ` as std::iter::Iterator>::cycle` +- fixtures/reject/src/lib.rs:199:8: unsupported call to `std::ops::Range::::contains::` +- fixtures/reject/src/lib.rs:365:4: unsupported call to `core::slice::::copy_within::>` +- fixtures/reject/src/lib.rs:376:4: unsupported call to `core::str::::split::<[char; 2]>` +- fixtures/reject/src/lib.rs:415:2: unsupported call to ` as std::ops::Deref>::deref` +- fixtures/reject/src/lib.rs:429:2: unsupported call to `::add_assign` +- fixtures/reject/src/lib.rs:459:2: unsupported call to ` as std::cmp::PartialEq>::eq`
passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet (5) -- fixtures/reject/src/lib.rs:45:11: 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 -- fixtures/reject/src/lib.rs:380:13: 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 -- fixtures/reject/src/lib.rs:381:11: 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 -- fixtures/reject/src/lib.rs:389:15: 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 -- fixtures/reject/src/lib.rs:390:13: 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 +- fixtures/reject/src/lib.rs:56:11: passing `{closure@fixtures/reject/src/lib.rs:55:10: 55:23}`, a closure that owns a value that drops, to `Iterator::map`, which is not supported yet +- fixtures/reject/src/lib.rs:386:13: passing `{closure@fixtures/reject/src/lib.rs:386:28: 386:35}`, a closure that owns a value that drops, to `Entry::or_insert_with`, which is not supported yet +- fixtures/reject/src/lib.rs:387:11: passing `{closure@fixtures/reject/src/lib.rs:387:15: 387:24}`, a closure that owns a value that drops, to `Iterator::any`, which is not supported yet +- fixtures/reject/src/lib.rs:395:15: passing `{closure@fixtures/reject/src/lib.rs:395:48: 395:56}`, a closure that owns a value that drops, to `successors::successors`, which is not supported yet +- fixtures/reject/src/lib.rs:396:13: passing `{closure@fixtures/reject/src/lib.rs:396:32: 396:39}`, a closure that owns a value that drops, to `from_fn::from_fn`, which is not supported yet
a variant of `_`, which is not supported: either is the same JS string (4) -- fixtures/reject/src/lib.rs:397:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string -- fixtures/reject/src/lib.rs:398:30: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string -- fixtures/reject/src/lib.rs:399:27: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string -- fixtures/reject/src/lib.rs:404:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:403:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:404:30: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:405:27: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:410:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string
an assignment through a reference to `_` (4) -- fixtures/reject/src/lib.rs:109:2: an assignment through a reference to `std::sync::Arc` -- fixtures/reject/src/lib.rs:129:2: an assignment through a reference to `std::pin::Pin>` -- fixtures/reject/src/lib.rs:134:2: an assignment through a reference to `std::sync::MutexGuard<'_, u8>` -- fixtures/reject/src/lib.rs:252:2: an assignment through a reference to `std::pin::Pin<&mut Noisy>` +- fixtures/reject/src/lib.rs:120:2: an assignment through a reference to `std::sync::Arc` +- fixtures/reject/src/lib.rs:135:2: an assignment through a reference to `std::pin::Pin>` +- fixtures/reject/src/lib.rs:140:2: an assignment through a reference to `std::sync::MutexGuard<'_, u8>` +- fixtures/reject/src/lib.rs:258:2: an assignment through a reference to `std::pin::Pin<&mut Noisy>`
@@ -235,199 +230,213 @@ The type or module each refused type or path belongs to. - fixtures/reject/src/lib.rs:7:14: unsupported type `f64` - fixtures/reject/src/lib.rs:7:25: unsupported type `f64` - fixtures/reject/src/lib.rs:11:16: unsupported type `dyn std::ops::Fn(u8) -> u8` -- fixtures/reject/src/lib.rs:102:51: unsupported type `f64` +- fixtures/reject/src/lib.rs:113:51: unsupported type `f64`
`_` with a mutable reference to a value JS copies, which its mapping would copy (3) - fixtures/reject/src/lib.rs:17:2: `std::iter::IntoIterator::into_iter` with a mutable reference to a value JS copies, which its mapping would copy -- fixtures/reject/src/lib.rs:429:21: `core::slice::::last_mut` with a mutable reference to a value JS copies, which its mapping would copy -- fixtures/reject/src/lib.rs:436:15: `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 +- fixtures/reject/src/lib.rs:435:21: `core::slice::::last_mut` with a mutable reference to a value JS copies, which its mapping would copy +- fixtures/reject/src/lib.rs:442:15: `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
dropping `_`, which is not supported yet (3) -- fixtures/reject/src/lib.rs:45:18: dropping `std::iter::Map, {closure@fixtures/reject/src/lib.rs:44:10: 44:23}>`, which is not supported yet -- fixtures/reject/src/lib.rs:389:79: dropping `std::iter::Take>`, which is not supported yet -- fixtures/reject/src/lib.rs:390:62: dropping `std::iter::Take>`, which is not supported yet +- fixtures/reject/src/lib.rs:56:18: dropping `std::iter::Map, {closure@fixtures/reject/src/lib.rs:55:10: 55:23}>`, which is not supported yet +- fixtures/reject/src/lib.rs:395:79: dropping `std::iter::Take>`, which is not supported yet +- fixtures/reject/src/lib.rs:396:62: dropping `std::iter::Take>`, which is not supported yet
replacing the value behind a reference to `_` (3) -- fixtures/reject/src/lib.rs:93:2: replacing the value behind a reference to `Meters` -- fixtures/reject/src/lib.rs:97:2: replacing the value behind a reference to `Meters` -- fixtures/reject/src/lib.rs:258:22: replacing the value behind a reference to `[u16; 1]` +- fixtures/reject/src/lib.rs:104:2: replacing the value behind a reference to `Meters` +- fixtures/reject/src/lib.rs:108:2: replacing the value behind a reference to `Meters` +- fixtures/reject/src/lib.rs:264:22: replacing the value behind a reference to `[u16; 1]`
`_` is not supported: it would be pending two ways with one value (2) -- fixtures/reject/src/lib.rs:113:20: `Poll>>` is not supported: it would be pending two ways with one value -- fixtures/reject/src/lib.rs:123:54: `Poll>` is not supported: it would be pending two ways with one value +- fixtures/reject/src/lib.rs:124:20: `Poll>>` is not supported: it would be pending two ways with one value +- fixtures/reject/src/lib.rs:129:54: `Poll>` is not supported: it would be pending two ways with one value + +
+ +
`_` is not supported: its `None` and `Some` would both be `rt.None` (2) + +- fixtures/reject/src/lib.rs:23:15: `Option>>` is not supported: its `None` and `Some` would both be `rt.None` +- fixtures/reject/src/lib.rs:24:2: `Option>>` is not supported: its `None` and `Some` would both be `rt.None` + +
+ +
`_` of `_`, whose `None` is `rt.None`, which is not supported yet (2) + +- fixtures/reject/src/lib.rs:43:42: `Iterator::find` of `Option>`, whose `None` is `rt.None`, which is not supported yet +- fixtures/reject/src/lib.rs:292:6: `HashMap::get` of `Option<&std::option::Option>`, whose `None` is `rt.None`, which is not supported yet
`_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it (2) -- fixtures/reject/src/lib.rs:265:16: `std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it -- fixtures/reject/src/lib.rs:265:38: `std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it +- fixtures/reject/src/lib.rs:271:16: `std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it +- fixtures/reject/src/lib.rs:271:38: `std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it
a field of `_` (2) -- fixtures/reject/src/lib.rs:281:7: a field of `std::ops::RangeTo` -- fixtures/reject/src/lib.rs:281:48: a field of `std::ops::RangeFrom` +- fixtures/reject/src/lib.rs:287:7: a field of `std::ops::RangeTo` +- fixtures/reject/src/lib.rs:287:48: a field of `std::ops::RangeFrom`
an iterator of the crate implementing `_`, which is not supported yet (2) -- fixtures/reject/src/lib.rs:172:1: an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet -- fixtures/reject/src/lib.rs:226:1: an iterator of the crate implementing `FusedIterator`, which is not supported yet +- fixtures/reject/src/lib.rs:178:1: an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet +- fixtures/reject/src/lib.rs:232:1: an iterator of the crate implementing `FusedIterator`, which is not supported yet
constructing `_` from another crate (2) -- fixtures/reject/src/lib.rs:158:23: constructing `std::iter::Map` from another crate -- fixtures/reject/src/lib.rs:179:14: constructing `std::iter::Rev` from another crate +- fixtures/reject/src/lib.rs:164:23: constructing `std::iter::Map` from another crate +- fixtures/reject/src/lib.rs:185:14: constructing `std::iter::Rev` from another crate
overriding `_`, which std's adaptors call in place of `next` or beside it (2) -- fixtures/reject/src/lib.rs:152:2: overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it -- fixtures/reject/src/lib.rs:206:2: overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it +- fixtures/reject/src/lib.rs:158:2: overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it +- fixtures/reject/src/lib.rs:212:2: overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it
`Binary` formatting, as in `{:b}`, is not supported (1) -- fixtures/reject/src/lib.rs:70:3: `Binary` formatting, as in `{:b}`, is not supported +- fixtures/reject/src/lib.rs:81:3: `Binary` formatting, as in `{:b}`, is not supported
`LowerExp` formatting, as in `{:e}`, is not supported (1) -- fixtures/reject/src/lib.rs:72:3: `LowerExp` formatting, as in `{:e}`, is not supported +- fixtures/reject/src/lib.rs:83:3: `LowerExp` formatting, as in `{:e}`, is not supported
`Octal` formatting, as in `{:o}`, is not supported (1) -- fixtures/reject/src/lib.rs:71:3: `Octal` formatting, as in `{:o}`, is not supported +- fixtures/reject/src/lib.rs:82:3: `Octal` formatting, as in `{:o}`, is not supported
`Pointer` formatting, as in `{:p}`, is not supported (1) -- fixtures/reject/src/lib.rs:75:3: `Pointer` formatting, as in `{:p}`, is not supported +- fixtures/reject/src/lib.rs:86:3: `Pointer` formatting, as in `{:p}`, is not supported
-
`_` holds `_`, which is `undefined` as `None` is, which is not supported (1) +
`_` is not supported yet (1) -- fixtures/reject/src/lib.rs:286:6: `std::collections::HashMap>` holds `std::option::Option`, which is `undefined` as `None` is, which is not supported +- fixtures/reject/src/lib.rs:414:18: `std::borrow::Cow<'_, [u8]>` is not supported yet
-
`_` is not supported yet (1) +
`_` is not supported: its field `_` is `_`, typed `_`, whose `None` would be `rt.None` as `_` (1) -- fixtures/reject/src/lib.rs:408:18: `std::borrow::Cow<'_, [u8]>` is not supported yet +- fixtures/reject/src/lib.rs:38:2: `Maybe<()>` is not supported: its field `value` is `Option`, typed `T | undefined`, whose `None` would be `rt.None` as `Option<()>`
`_` of `_` by `_`, which is not supported yet (1) -- fixtures/reject/src/lib.rs:309:6: `HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet +- fixtures/reject/src/lib.rs:315:6: `HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet
`_` of `_`, which drops `_`, which is not supported yet (1) -- fixtures/reject/src/lib.rs:51:13: `into_keys` of `std::collections::HashMap`, which drops `Noisy`, which is not supported yet +- fixtures/reject/src/lib.rs:62:13: `into_keys` of `std::collections::HashMap`, which drops `Noisy`, which is not supported yet
`_` through a held type's own, which is not supported yet (1) -- fixtures/reject/src/lib.rs:341:2: ` as PartialEq>::ne` through a held type's own, which is not supported yet +- fixtures/reject/src/lib.rs:347:2: ` as PartialEq>::ne` through a held type's own, which is not supported yet
`_`, which is not supported yet (1) -- fixtures/reject/src/lib.rs:317:9: `Hasher::write`, which is not supported yet +- fixtures/reject/src/lib.rs:323:9: `Hasher::write`, which is not supported yet
`fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet (1) -- fixtures/reject/src/lib.rs:234:26: `fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet +- fixtures/reject/src/lib.rs:240:26: `fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet
a `_` cast from `_` to `_` (1) -- fixtures/reject/src/lib.rs:104:2: a `IntToFloat` cast from `u64` to `f64` +- fixtures/reject/src/lib.rs:115:2: a `IntToFloat` cast from `u64` to `f64`
a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet (1) -- fixtures/reject/src/lib.rs:239:30: a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:239:15: 239:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet +- fixtures/reject/src/lib.rs:245:30: a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:245:15: 245:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet
a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` (1) -- fixtures/reject/src/lib.rs:185:51: a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:185:15: 185:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold` +- fixtures/reject/src/lib.rs:191:51: a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:191:15: 191:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold`
a coercion to `_` (1) -- fixtures/reject/src/lib.rs:364:2: a coercion to `std::sync::Arc<[u8]>` +- fixtures/reject/src/lib.rs:370:2: a coercion to `std::sync::Arc<[u8]>`
a constant of type `_` (1) -- fixtures/reject/src/lib.rs:88:2: a constant of type `&u8` +- fixtures/reject/src/lib.rs:99:2: a constant of type `&u8`
a copy of a closure that changes what it captured (1) -- fixtures/reject/src/lib.rs:275:14: a copy of a closure that changes what it captured +- fixtures/reject/src/lib.rs:281:14: a copy of a closure that changes what it captured
a mutable borrow of a subslice of `_`, which JS would copy, having no views (1) -- fixtures/reject/src/lib.rs:244:13: a mutable borrow of a subslice of `u32`, which JS would copy, having no views +- fixtures/reject/src/lib.rs:250:13: a mutable borrow of a subslice of `u32`, which JS would copy, having no views
a mutable reference into a `Result`'s payload, passed on or kept (1) -- fixtures/reject/src/lib.rs:446:12: a mutable reference into a `Result`'s payload, passed on or kept +- fixtures/reject/src/lib.rs:452:12: a mutable reference into a `Result`'s payload, passed on or kept
a precision, as in `{:.2}`, is not supported (1) -- fixtures/reject/src/lib.rs:67:3: a precision, as in `{:.2}`, is not supported +- fixtures/reject/src/lib.rs:78:3: a precision, as in `{:.2}`, is not supported
a printable type must implement `Display` or `Debug` (1) -- fixtures/reject/src/lib.rs:100:1: a printable type must implement `Display` or `Debug` +- fixtures/reject/src/lib.rs:111:1: a printable type must implement `Display` or `Debug`
@@ -439,19 +448,19 @@ The type or module each refused type or path belongs to.
a width or precision from an argument, as in `{:1$}`, is not supported (1) -- fixtures/reject/src/lib.rs:74:3: a width or precision from an argument, as in `{:1$}`, is not supported +- fixtures/reject/src/lib.rs:85:3: a width or precision from an argument, as in `{:1$}`, is not supported
a zero-sized constant of type `_` (1) -- fixtures/reject/src/lib.rs:60:2: a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:59:10: 59:18}` +- fixtures/reject/src/lib.rs:71:2: a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:70:10: 70:18}`
an iterator that owns `_`, which drops, which is not supported yet (1) -- fixtures/reject/src/lib.rs:391:13: an iterator that owns `Noisy`, which drops, which is not supported yet +- fixtures/reject/src/lib.rs:397:13: an iterator that owns `Noisy`, which drops, which is not supported yet
@@ -463,36 +472,36 @@ The type or module each refused type or path belongs to.
comparing `_` as a key, which is not supported yet (1) -- fixtures/reject/src/lib.rs:291:52: comparing `std::vec::Vec` as a key, which is not supported yet +- fixtures/reject/src/lib.rs:297:52: comparing `std::vec::Vec` as a key, which is not supported yet
constructing `_` (1) -- fixtures/reject/src/lib.rs:415:53: constructing `std::borrow::Cow<'_, std::sync::Arc>` +- fixtures/reject/src/lib.rs:421:53: constructing `std::borrow::Cow<'_, std::sync::Arc>`
hashing `_` as a key, which is not supported yet (1) -- fixtures/reject/src/lib.rs:291:52: hashing `std::vec::Vec` as a key, which is not supported yet +- fixtures/reject/src/lib.rs:297:52: hashing `std::vec::Vec` as a key, which is not supported yet
hex `Debug`, as in `{:x?}`, is not supported (1) -- fixtures/reject/src/lib.rs:73:3: hex `Debug`, as in `{:x?}`, is not supported +- fixtures/reject/src/lib.rs:84:3: hex `Debug`, as in `{:x?}`, is not supported
the `+` flag of a format spec is not supported (1) -- fixtures/reject/src/lib.rs:68:3: the `+` flag of a format spec is not supported +- fixtures/reject/src/lib.rs:79:3: the `+` flag of a format spec is not supported
the `-` flag of a format spec is not supported (1) -- fixtures/reject/src/lib.rs:69:3: the `-` flag of a format spec is not supported +- fixtures/reject/src/lib.rs:80:3: the `-` flag of a format spec is not supported
diff --git a/ts/fixtures/reject/expected.txt b/ts/fixtures/reject/expected.txt index 6a5d50716..f79b29254 100644 --- a/ts/fixtures/reject/expected.txt +++ b/ts/fixtures/reject/expected.txt @@ -1,86 +1,84 @@ -a root must not be generic at fixtures/reject/src/lib.rs:102:1 +a root must not be generic at fixtures/reject/src/lib.rs:113:1 no item `missing` in the crate -a printable type must implement `Display` or `Debug` at fixtures/reject/src/lib.rs:100:1 +a printable type must implement `Display` or `Debug` at fixtures/reject/src/lib.rs:111:1 unsupported type `f64` at fixtures/reject/src/lib.rs:7:14 a scalar constant of type `f64` at fixtures/reject/src/lib.rs:8:2 arithmetic on `f64` at fixtures/reject/src/lib.rs:8:2 unsupported type `f64` at fixtures/reject/src/lib.rs:7:25 unsupported type `dyn std::ops::Fn(u8) -> u8` at fixtures/reject/src/lib.rs:11:16 `std::iter::IntoIterator::into_iter` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:17:11 -`Option>` is not supported: its `None` and `Some` would both be `undefined` at fixtures/reject/src/lib.rs:24:2 -`Option>` is not supported: its `None` and `Some` would both be `undefined` at fixtures/reject/src/lib.rs:23:15 +`Option>>` is not supported: its `None` and `Some` would both be `rt.None` at fixtures/reject/src/lib.rs:24:2 +`Option>>` is not supported: its `None` and `Some` would both be `rt.None` at fixtures/reject/src/lib.rs:23:15 unsupported call to `std::slice::::sort` at fixtures/reject/src/lib.rs:28:4 -`Option>` is not supported: its `None` and `Some` would both be `undefined` at fixtures/reject/src/lib.rs:32:2 -`Option>` 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::` 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, {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`, 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 -the `+` flag of a format spec is not supported at fixtures/reject/src/lib.rs:68:3 -the `-` flag of a format spec is not supported at fixtures/reject/src/lib.rs:69:3 -`Binary` formatting, as in `{:b}`, is not supported at fixtures/reject/src/lib.rs:70:12 -`Octal` formatting, as in `{:o}`, is not supported at fixtures/reject/src/lib.rs:71:12 -`LowerExp` formatting, as in `{:e}`, is not supported at fixtures/reject/src/lib.rs:72:12 -hex `Debug`, as in `{:x?}`, is not supported at fixtures/reject/src/lib.rs:73:3 -a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:74:15 -a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:74:3 -`Pointer` formatting, as in `{:p}`, is not supported at fixtures/reject/src/lib.rs:75:12 -unsupported call to `::write_fmt` at fixtures/reject/src/lib.rs:82:10 -a constant of type `&u8` at fixtures/reject/src/lib.rs:88:2 -replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:93:2 -replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:97:2 -an assignment through a reference to `std::sync::Arc` at fixtures/reject/src/lib.rs:109:2 -`Poll>>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:113:20 -`Option>` is not supported: its `None` and `Some` would both be `undefined` at fixtures/reject/src/lib.rs:118:19 -`Poll>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:123:54 -an assignment through a reference to `std::pin::Pin>` at fixtures/reject/src/lib.rs:129:2 -an assignment through a reference to `std::sync::MutexGuard<'_, u8>` at fixtures/reject/src/lib.rs:134:2 -unsupported call to ` as std::iter::Iterator>::cycle` at fixtures/reject/src/lib.rs:139:11 -constructing `std::iter::Map` from another crate at fixtures/reject/src/lib.rs:158:23 -constructing `std::iter::Rev` from another crate at fixtures/reject/src/lib.rs:179:14 -a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:185:15: 185:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold` at fixtures/reject/src/lib.rs:185:51 -unsupported call to `std::ops::Range::::contains::` at fixtures/reject/src/lib.rs:193:8 -`fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet at fixtures/reject/src/lib.rs:234:26 -a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:239:15: 239:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet at fixtures/reject/src/lib.rs:239:30 -a mutable borrow of a subslice of `u32`, which JS would copy, having no views at fixtures/reject/src/lib.rs:244:13 -an assignment through a reference to `std::pin::Pin<&mut Noisy>` at fixtures/reject/src/lib.rs:252:2 -replacing the value behind a reference to `[u16; 1]` at fixtures/reject/src/lib.rs:258:22 -`std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:265:16 -`std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:265:38 -a copy of a closure that changes what it captured at fixtures/reject/src/lib.rs:275:14 -a field of `std::ops::RangeTo` at fixtures/reject/src/lib.rs:281:7 -a field of `std::ops::RangeFrom` at fixtures/reject/src/lib.rs:281:48 -`Option<&std::option::Option>` is not supported: its `None` and `Some` would both be `undefined` at fixtures/reject/src/lib.rs:286:2 -`std::collections::HashMap>` holds `std::option::Option`, which is `undefined` as `None` is, which is not supported at fixtures/reject/src/lib.rs:286:6 -hashing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:291:52 -comparing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:291:52 -`HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet at fixtures/reject/src/lib.rs:309:6 -unsupported call to `core::slice::::copy_within::>` 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: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 ` as std::ops::Deref>::deref` at fixtures/reject/src/lib.rs:409:2 -constructing `std::borrow::Cow<'_, std::sync::Arc>` at fixtures/reject/src/lib.rs:415:53 -unsupported call to `core::str::::split::<[char; 2]>` at fixtures/reject/src/lib.rs:370:4 -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>`, 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>`, 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 `::add_assign` at fixtures/reject/src/lib.rs:423:2 -`core::slice::::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 ` 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 +`Iterator::find` of `Option>`, whose `None` is `rt.None`, which is not supported yet at fixtures/reject/src/lib.rs:43:42 +`Maybe<()>` is not supported: its field `value` is `Option`, typed `T | undefined`, whose `None` would be `rt.None` as `Option<()>` at fixtures/reject/src/lib.rs:38:2 +unsupported call to `std::mem::size_of_val::` at fixtures/reject/src/lib.rs:55:29 +passing `{closure@fixtures/reject/src/lib.rs:55:10: 55:23}`, a closure that owns a value that drops, to `Iterator::map`, which is not supported yet at fixtures/reject/src/lib.rs:56:11 +dropping `std::iter::Map, {closure@fixtures/reject/src/lib.rs:55:10: 55:23}>`, which is not supported yet at fixtures/reject/src/lib.rs:56:18 +`into_keys` of `std::collections::HashMap`, which drops `Noisy`, which is not supported yet at fixtures/reject/src/lib.rs:62:13 +a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:70:10: 70:18}` at fixtures/reject/src/lib.rs:71:2 +a precision, as in `{:.2}`, is not supported at fixtures/reject/src/lib.rs:78:3 +the `+` flag of a format spec is not supported at fixtures/reject/src/lib.rs:79:3 +the `-` flag of a format spec is not supported at fixtures/reject/src/lib.rs:80:3 +`Binary` formatting, as in `{:b}`, is not supported at fixtures/reject/src/lib.rs:81:12 +`Octal` formatting, as in `{:o}`, is not supported at fixtures/reject/src/lib.rs:82:12 +`LowerExp` formatting, as in `{:e}`, is not supported at fixtures/reject/src/lib.rs:83:12 +hex `Debug`, as in `{:x?}`, is not supported at fixtures/reject/src/lib.rs:84:3 +a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:85:15 +a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:85:3 +`Pointer` formatting, as in `{:p}`, is not supported at fixtures/reject/src/lib.rs:86:12 +unsupported call to `::write_fmt` at fixtures/reject/src/lib.rs:93:10 +a constant of type `&u8` at fixtures/reject/src/lib.rs:99:2 +replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:104:2 +replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:108:2 +an assignment through a reference to `std::sync::Arc` at fixtures/reject/src/lib.rs:120:2 +`Poll>>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:124:20 +`Poll>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:129:54 +an assignment through a reference to `std::pin::Pin>` at fixtures/reject/src/lib.rs:135:2 +an assignment through a reference to `std::sync::MutexGuard<'_, u8>` at fixtures/reject/src/lib.rs:140:2 +unsupported call to ` as std::iter::Iterator>::cycle` at fixtures/reject/src/lib.rs:145:11 +constructing `std::iter::Map` from another crate at fixtures/reject/src/lib.rs:164:23 +constructing `std::iter::Rev` from another crate at fixtures/reject/src/lib.rs:185:14 +a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:191:15: 191:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold` at fixtures/reject/src/lib.rs:191:51 +unsupported call to `std::ops::Range::::contains::` at fixtures/reject/src/lib.rs:199:8 +`fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet at fixtures/reject/src/lib.rs:240:26 +a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:245:15: 245:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet at fixtures/reject/src/lib.rs:245:30 +a mutable borrow of a subslice of `u32`, which JS would copy, having no views at fixtures/reject/src/lib.rs:250:13 +an assignment through a reference to `std::pin::Pin<&mut Noisy>` at fixtures/reject/src/lib.rs:258:2 +replacing the value behind a reference to `[u16; 1]` at fixtures/reject/src/lib.rs:264:22 +`std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:271:16 +`std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:271:38 +a copy of a closure that changes what it captured at fixtures/reject/src/lib.rs:281:14 +a field of `std::ops::RangeTo` at fixtures/reject/src/lib.rs:287:7 +a field of `std::ops::RangeFrom` at fixtures/reject/src/lib.rs:287:48 +`HashMap::get` of `Option<&std::option::Option>`, whose `None` is `rt.None`, which is not supported yet at fixtures/reject/src/lib.rs:292:6 +hashing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:297:52 +comparing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:297:52 +`HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet at fixtures/reject/src/lib.rs:315:6 +unsupported call to `core::slice::::copy_within::>` at fixtures/reject/src/lib.rs:365:4 +a coercion to `std::sync::Arc<[u8]>` at fixtures/reject/src/lib.rs:370:2 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:403:2 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:405:27 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:404:30 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:410:2 +`std::borrow::Cow<'_, [u8]>` is not supported yet at fixtures/reject/src/lib.rs:414:18 +unsupported call to ` as std::ops::Deref>::deref` at fixtures/reject/src/lib.rs:415:2 +constructing `std::borrow::Cow<'_, std::sync::Arc>` at fixtures/reject/src/lib.rs:421:53 +unsupported call to `core::str::::split::<[char; 2]>` at fixtures/reject/src/lib.rs:376:4 +passing `{closure@fixtures/reject/src/lib.rs:386:28: 386: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:386:13 +passing `{closure@fixtures/reject/src/lib.rs:387:15: 387:24}`, a closure that owns a value that drops, to `Iterator::any`, which is not supported yet at fixtures/reject/src/lib.rs:387:11 +passing `{closure@fixtures/reject/src/lib.rs:395:48: 395:56}`, a closure that owns a value that drops, to `successors::successors`, which is not supported yet at fixtures/reject/src/lib.rs:395:15 +dropping `std::iter::Take>`, which is not supported yet at fixtures/reject/src/lib.rs:395:79 +passing `{closure@fixtures/reject/src/lib.rs:396:32: 396: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:396:13 +dropping `std::iter::Take>`, which is not supported yet at fixtures/reject/src/lib.rs:396:62 +an iterator that owns `Noisy`, which drops, which is not supported yet at fixtures/reject/src/lib.rs:397:13 +unsupported call to `::add_assign` at fixtures/reject/src/lib.rs:429:2 +`core::slice::::last_mut` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:435: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:442:15 +a mutable reference into a `Result`'s payload, passed on or kept at fixtures/reject/src/lib.rs:452:12 +unsupported call to ` as std::cmp::PartialEq>::eq` at fixtures/reject/src/lib.rs:459:2 +overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:158:2 +an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:178:1 +overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:212:2 +an iterator of the crate implementing `FusedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:232:1 +`Hasher::write`, which is not supported yet at fixtures/reject/src/lib.rs:323:9 diff --git a/ts/fixtures/reject/src/lib.rs b/ts/fixtures/reject/src/lib.rs index 68cdbd1e6..626481eb8 100644 --- a/ts/fixtures/reject/src/lib.rs +++ b/ts/fixtures/reject/src/lib.rs @@ -19,8 +19,8 @@ pub fn increment(v: &mut [u32]) { } } -/// `None` and `Some(None)` would both be `undefined`. -pub fn nested(x: Option>) -> bool { +/// `None` and `Some(None)` would both be `rt.None`, as `Some(Some(None))` is `undefined`. +pub fn nested(x: Option>>) -> bool { x.is_some() } @@ -28,8 +28,19 @@ pub fn sorted(v: &mut [u8]) { v.sort(); } +/// A generic type's `Option` is `T | undefined`, which can't hold `rt.None`, the `None` +/// of an `Option<()>`. +pub struct Maybe { + pub value: Option, +} + +pub fn generic_unit(value: Option<()>) -> bool { + Maybe { value }.value.is_some() +} + +/// The runtime's `find` takes `None` to be `undefined`, which `Some(None)` is. pub fn iterators(v: &[u8]) -> bool { - v.iter().map(|&b| (b > 1).then_some(b)).next().is_some() + v.iter().map(|&b| (b > 1).then_some(b)).find(Option::is_none).is_some() } pub struct Noisy(pub u8); @@ -114,11 +125,6 @@ pub fn nested_poll(p: std::task::Poll>>) -> bool { matches!(p, std::task::Poll::Pending) } -/// `None` and `Some(Ready(()))` would both be `undefined`. -pub fn ready_unit(p: Option>) -> bool { - matches!(p, None) -} - /// A future's `Ready(Pending)` would be `rt.Pending`, as its own pending is. pub async fn pending_output() -> std::task::Poll { std::task::Poll::Pending diff --git a/ts/fixtures/reject/ts.toml b/ts/fixtures/reject/ts.toml index 5765d60e8..d9c2edc1a 100644 --- a/ts/fixtures/reject/ts.toml +++ b/ts/fixtures/reject/ts.toml @@ -6,6 +6,7 @@ roots = [ "nested", "sorted", "iterators", + "generic_unit", "Noisy", "owning_closure", "keys", @@ -18,7 +19,6 @@ roots = [ "generic", "replace_shared", "nested_poll", - "ready_unit", "pending_output", "replace_pinned", "replace_guard", diff --git a/ts/runtime/rt.ts b/ts/runtime/rt.ts index 91dac163b..cb0afb849 100644 --- a/ts/runtime/rt.ts +++ b/ts/runtime/rt.ts @@ -159,33 +159,48 @@ export function resultUnwrapErr(r: Result, debug: Debug, drop?: ( return r.error; } -// Options, which are `T | undefined`. +// Options, which are `T | undefined`, or `T | None` where `T` can already be `undefined`. +// A function taking one takes that `None` after its own arguments. + +/** `None` of an `Option` whose `Some` can already be `undefined`, as `Option<()>`'s is. */ +export const None: unique symbol = /* @__PURE__ */ Symbol("None"); + +/** The type of `None`. */ +export type None = typeof None; /** `Option::unwrap`: the value, or a panic. */ -export function optionUnwrap(o: T | undefined): T { - if (o === undefined) panic("called `Option::unwrap()` on a `None` value"); - return o; +export function optionUnwrap(o: T | undefined): T; +export function optionUnwrap(o: T | None, none: None): T; +export function optionUnwrap(o: T | undefined | None, none?: None): T { + if (o === none) panic("called `Option::unwrap()` on a `None` value"); + return o as T; } /** `Option::expect`: the value, or a panic with `message`. */ -export function optionExpect(o: T | undefined, message: string): T { - if (o === undefined) panic(message); - return o; +export function optionExpect(o: T | undefined, message: string): T; +export function optionExpect(o: T | None, message: string, none: None): T; +export function optionExpect(o: T | undefined | None, message: string, none?: None): T { + if (o === none) panic(message); + return o as T; } /** `bool::then_some`: `value` if `cond`, which is evaluated either way, and else drops. */ -export function thenSome(cond: boolean, value: T, drop?: (value: T) => void): T | undefined { +export function thenSome(cond: boolean, value: T, drop?: (value: T) => void): T | undefined; +export function thenSome(cond: boolean, value: T, drop: ((value: T) => void) | undefined, none: None): T | None; +export function thenSome(cond: boolean, value: T, drop?: (value: T) => void, none?: None): T | undefined | None { if (cond) return value; drop?.(value); - return undefined; + return none; } // Not `then`, which would make the module's namespace a thenable that `await` calls. /** `bool::then`: `f()` if `cond`, which is called only then, and else `f` drops. */ -export function boolThen(cond: boolean, f: () => T, drop?: (f: () => T) => void): T | undefined { +export function boolThen(cond: boolean, f: () => T, drop?: (f: () => T) => void): T | undefined; +export function boolThen(cond: boolean, f: () => T, drop: ((f: () => T) => void) | undefined, none: None): T | None; +export function boolThen(cond: boolean, f: () => T, drop?: (f: () => T) => void, none?: None): T | undefined | None { if (cond) return f(); drop?.(f); - return undefined; + return none; } // Slices: arrays, but for bytes, which are `ByteSlice`s. @@ -236,13 +251,17 @@ export function sliceSplitAtChecked(s: T[], n: number): [T[], T[]] | undefine } /** `first`: the first element, or `undefined` if empty. */ -export function sliceFirst(s: ArrayLike): T | undefined { - return s.length === 0 ? undefined : s[0]; +export function sliceFirst(s: ArrayLike): T | undefined; +export function sliceFirst(s: ArrayLike, none: None): T | None; +export function sliceFirst(s: ArrayLike, none?: None): T | undefined | None { + return s.length === 0 ? none : s[0]; } /** `get`: the element at `index`, or `undefined` past the end. */ -export function sliceGet(s: ArrayLike, index: number): T | undefined { - return index < s.length ? s[index] : undefined; +export function sliceGet(s: ArrayLike, index: number): T | undefined; +export function sliceGet(s: ArrayLike, index: number, none: None): T | None; +export function sliceGet(s: ArrayLike, index: number, none?: None): T | undefined | None { + return index < s.length ? s[index] : none; } /** @@ -921,9 +940,11 @@ export function fmtUnit(_: undefined, f: Formatter): FmtResult { } /** `Debug` of an `Option`, through its value's. */ -export function fmtOption(o: T | undefined, f: Formatter, debug: Debug): FmtResult { - if (o === undefined) return f.out.writeStr("None"); - return debugTupleFinish(debugTupleField(fmtDebugTuple(f, "Some"), (f) => debug(o, f))); +export function fmtOption(o: T | undefined, f: Formatter, debug: Debug): FmtResult; +export function fmtOption(o: T | None, f: Formatter, debug: Debug, none: None): FmtResult; +export function fmtOption(o: T | undefined | None, f: Formatter, debug: Debug, none?: None): FmtResult { + if (o === none) return f.out.writeStr("None"); + return debugTupleFinish(debugTupleField(fmtDebugTuple(f, "Some"), (f) => debug(o as T, f))); } /** `Debug` of a `Result`, through its value's and error's. */ diff --git a/ts/runtime/rt/collections.ts b/ts/runtime/rt/collections.ts index 41a698be6..d819d7334 100644 --- a/ts/runtime/rt/collections.ts +++ b/ts/runtime/rt/collections.ts @@ -14,7 +14,7 @@ // A function that may drop a key, value, or item std's would, rather than return or keep // it, takes what drops each that does, as `k`, `v`, or `f`, and drops it where std's does. -import { type Place, panic } from "../rt.ts"; +import { type None, type Place, panic } from "../rt.ts"; import { type Limbs, lt } from "./int.ts"; import { DONE, type Done, Iter, iterSlice, type RangeInclusive } from "./iter.ts"; import { type Arc, dropAll } from "./task.ts"; @@ -66,8 +66,13 @@ export function cmpTuple(cmp: (a: T, b: T) => O): (a: T | undefined, b: T | undefined) => O { - return (a, b) => (a === undefined ? (b === undefined ? 0 : -1) : b === undefined ? 1 : cmp(a, b)) as O; +export function cmpOption(cmp: (a: T, b: T) => O): (a: T | undefined, b: T | undefined) => O; +export function cmpOption(cmp: (a: T, b: T) => O, none: None): (a: T | None, b: T | None) => O; +export function cmpOption( + cmp: (a: T, b: T) => O, + none?: None, +): (a: T | undefined | None, b: T | undefined | None) => O { + return (a, b) => (a === none ? (b === none ? 0 : -1) : b === none ? 1 : cmp(a as T, b as T)) as O; } /** `Ord::cmp` of `Arc`s, or `PartialOrd::partial_cmp`: their values'. */ @@ -132,8 +137,13 @@ export function eqTuple(fields: readonly ((a: neve } /** `PartialEq::eq` of `Option`s, from their values'. */ -export function eqOption(eq: (a: T, b: T) => boolean): (a: T | undefined, b: T | undefined) => boolean { - return (a, b) => (a === undefined || b === undefined ? a === b : eq(a, b)); +export function eqOption(eq: (a: T, b: T) => boolean): (a: T | undefined, b: T | undefined) => boolean; +export function eqOption(eq: (a: T, b: T) => boolean, none: None): (a: T | None, b: T | None) => boolean; +export function eqOption( + eq: (a: T, b: T) => boolean, + none?: None, +): (a: T | undefined | None, b: T | undefined | None) => boolean { + return (a, b) => (a === none || b === none ? a === b : eq(a as T, b as T)); } /** @@ -194,10 +204,15 @@ export function hashTuple(fields: readonly ((value } /** `Hash::hash` of an `Option`: whether it is `Some`, then its value's. */ -export function hashOption(hash: (value: T, s: Hasher) => void): (value: T | undefined, s: Hasher) => void { +export function hashOption(hash: (value: T, s: Hasher) => void): (value: T | undefined, s: Hasher) => void; +export function hashOption(hash: (value: T, s: Hasher) => void, none: None): (value: T | None, s: Hasher) => void; +export function hashOption( + hash: (value: T, s: Hasher) => void, + none?: None, +): (value: T | undefined | None, s: Hasher) => void { return (value, s) => { - mix(s, value === undefined ? 0 : 1); - if (value !== undefined) hash(value, s); + mix(s, value === none ? 0 : 1); + if (value !== none) hash(value as T, s); }; } diff --git a/ts/runtime/rt/iter.ts b/ts/runtime/rt/iter.ts index 96a292a87..778d714dd 100644 --- a/ts/runtime/rt/iter.ts +++ b/ts/runtime/rt/iter.ts @@ -17,7 +17,7 @@ // iterator has its own, the `owned` functions follow it, dispatching on the kind, so a // bundle that never drops an item carries none of it. -import { ByteVec, byteVecPush, Err, Ok, panic, type Result } from "../rt.ts"; +import { ByteVec, byteVecPush, Err, type None, Ok, panic, type Result } from "../rt.ts"; import { BTreeIter, HashIter } from "./collections.ts"; import { type Limbs, lt as wideLt, type Step } from "./int.ts"; import { drop as dispose, dropAll, dropRange } from "./task.ts"; @@ -92,13 +92,17 @@ function both(a: () => void, b: () => void): void { } /** The item `next` returned, as an `Option`. */ -export function iterToOption(item: T | Done): T | undefined { - return item === DONE ? undefined : item; +export function iterToOption(item: T | Done): T | undefined; +export function iterToOption(item: T | Done, none: None): T | None; +export function iterToOption(item: T | Done, none?: None): T | undefined | None { + return item === DONE ? none : item; } /** An `Option`, as `next` returns it. */ -export function iterFromOption(option: T | undefined): T | Done { - return option === undefined ? DONE : option; +export function iterFromOption(option: T | undefined): T | Done; +export function iterFromOption(option: T | None, none: None): T | Done; +export function iterFromOption(option: T | undefined | None, none?: None): T | Done { + return option === none ? DONE : (option as T); } // Where std's iterators come from. @@ -109,8 +113,10 @@ export function iterSlice(s: ArrayLike, drop?: Drop): Iter { } /** `Option::iter`, and with what drops its item, `option::IntoIter`. */ -export function iterOption(o: T | undefined, drop?: Drop): Iter { - return new OptionIter(o, o !== undefined, drop); +export function iterOption(o: T | undefined, drop?: Drop): Iter; +export function iterOption(o: T | None, drop: Drop | undefined, none: None): Iter; +export function iterOption(o: T | undefined | None, drop?: Drop, none?: None): Iter { + return new OptionIter(o as T, o !== none, drop); } /** `iter::once`. */ diff --git a/ts/src/census.rs b/ts/src/census.rs index 579ed8af0..dd8cdb383 100644 --- a/ts/src/census.rs +++ b/ts/src/census.rs @@ -176,6 +176,7 @@ const VERBATIM: &[&str] = &[ "match", "next", "ref mut", + "rt.None", "self", "undefined", "zip", diff --git a/ts/src/lower/body.rs b/ts/src/lower/body.rs index 504d125d7..ed1ffc61b 100644 --- a/ts/src/lower/body.rs +++ b/ts/src/lower/body.rs @@ -120,8 +120,13 @@ impl<'b, 'a, 'tcx> Body<'b, 'a, 'tcx> { // The crate's own `next` returns an item or `rt.DONE`, and its caller an `Option`. if super::iter::is_next(tcx, did) { let sig = tcx.fn_sig(did).instantiate(tcx, instance.args).skip_norm_wip(); - self.t.ty(tcx.instantiate_bound_regions_with_erased(sig).output(), span); - return Expr::rt("iterToOption", vec![call]); + let option = tcx.instantiate_bound_regions_with_erased(sig).output(); + self.t.ty(option, span); + let ty::Adt(_, option_args) = option.kind() else { + unreachable!("`next` returns an `Option`") + }; + let none = self.t.none_arg(option_args.type_at(0)); + return Expr::rt("iterToOption", [call].into_iter().chain(none).collect()); } return call; } diff --git a/ts/src/lower/collections.rs b/ts/src/lower/collections.rs index 13ed1ae38..64f078257 100644 --- a/ts/src/lower/collections.rs +++ b/ts/src/lower/collections.rs @@ -960,7 +960,8 @@ fn cmp_fn<'tcx>(b: &mut Body<'_, '_, 'tcx>, ty: Ty<'tcx>, partial: bool, span: S Expr::rt("cmpTuple", vec![Expr::Array(fns)]) } ty::Adt(..) if let Some(inner) = option_of(b, ty) => { - Expr::rt("cmpOption", vec![cmp_fn(b, inner, partial, span)]) + let cmp = cmp_fn(b, inner, partial, span); + Expr::rt("cmpOption", [cmp].into_iter().chain(b.t.none_arg(inner)).collect()) } ty::Adt(..) if let Some(inner) = arc_of(b, ty) => Expr::rt("cmpArc", vec![cmp_fn(b, inner, partial, span)]), ty::Adt(adt, _) if b.t.own(adt.did()) && partial => { @@ -996,9 +997,9 @@ fn eq_fn<'tcx>(b: &mut Body<'_, '_, 'tcx>, ty: Ty<'tcx>, span: Span) -> Expr { Expr::rt("eqTuple", vec![Expr::Array(fns)]) } ty::Adt(..) if let Some(inner) = option_of(b, ty) => match eq_fn(b, inner, span) { - // No value of `inner` is `undefined`, so `===` tells `None` from each. + // `None` is no value of `inner`, so `===` tells it from each. Expr::Rt(same) if same == "same" => Expr::Rt(same), - eq => Expr::rt("eqOption", vec![eq]), + eq => Expr::rt("eqOption", [eq].into_iter().chain(b.t.none_arg(inner)).collect()), }, ty::Adt(..) if let Some(inner) = arc_of(b, ty) => { let mut values = vec![eq_fn(b, inner, span)]; @@ -1033,7 +1034,8 @@ fn hash_fn<'tcx>(b: &mut Body<'_, '_, 'tcx>, ty: Ty<'tcx>, hasher: Ty<'tcx>, spa Expr::rt("hashTuple", vec![Expr::Array(fns)]) } ty::Adt(..) if let Some(inner) = option_of(b, ty) => { - Expr::rt("hashOption", vec![hash_fn(b, inner, hasher, span)]) + let hash = hash_fn(b, inner, hasher, span); + Expr::rt("hashOption", [hash].into_iter().chain(b.t.none_arg(inner)).collect()) } ty::Adt(..) if let Some(inner) = arc_of(b, ty) => Expr::rt("hashArc", vec![hash_fn(b, inner, hasher, span)]), ty::Adt(adt, _) if b.t.own(adt.did()) => { diff --git a/ts/src/lower/consts.rs b/ts/src/lower/consts.rs index 97111dc7c..ca357511c 100644 --- a/ts/src/lower/consts.rs +++ b/ts/src/lower/consts.rs @@ -89,7 +89,7 @@ impl<'b, 'a, 'tcx> Body<'b, 'a, 'tcx> { .map(|(t, v)| self.value(t, v, span)) .collect(), ), - ty::Adt(adt, _) => { + ty::Adt(adt, args) => { let fields = children(valtree); // Its nanoseconds are a pattern type, which only it reads. if Std::of(tcx, adt.did()) == Some(Std::Duration) { @@ -111,7 +111,7 @@ impl<'b, 'a, 'tcx> Body<'b, 'a, 'tcx> { let mut values: Vec = fields.into_iter().map(|(t, v)| self.value(t, v, span)).collect(); if let Some(std) = Std::of(tcx, adt.did()) { return match (std, variant.index()) { - (Std::Option, 0) => Expr::undefined(), + (Std::Option, 0) => self.t.none(args.type_at(0)), (Std::Option, _) => values.pop().unwrap(), (Std::Cow, _) if crate::lower::library::string(tcx, ty) => values.pop().unwrap(), (Std::Result, i) => Expr::result(i == 0, values.pop().unwrap()), @@ -120,9 +120,6 @@ impl<'b, 'a, 'tcx> Body<'b, 'a, 'tcx> { if values.len() == 3 && matches!(&values[2], Expr::Lit(l) if l == "false") => { values.pop(); - let ty::Adt(_, args) = ty.kind() else { - unreachable!("matched above") - }; values.extend(crate::lower::num::Int::of(args.type_at(0)).map(|int| int.func("step"))); Expr::New(Box::new(Expr::Rt("RangeInclusive".into())), values) } diff --git a/ts/src/lower/copy.rs b/ts/src/lower/copy.rs index 747f33372..502d6e66b 100644 --- a/ts/src/lower/copy.rs +++ b/ts/src/lower/copy.rs @@ -120,14 +120,14 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { None => v().member("slice").call(Vec::new()), }), ty::Adt(adt, args) => match Std::of(tcx, adt.did()) { - Some(Std::Option) => ret(self.copy_unless(Expr::undefined(), args.type_at(0), span)), + Some(Std::Option) => ret(self.copy_unless(self.none(args.type_at(0)), args.type_at(0), span)), Some(Std::Poll) => ret(self.copy_unless(Expr::Rt("Pending".into()), args.type_at(0), span)), Some(Std::Result) => ret(self.copy_result(args.type_at(0), args.type_at(1), span)), Some(Std::ControlFlow) => { let (residual, value) = (args.type_at(0), args.type_at(1)); ret(match (Flow::of(tcx, args), residual.kind()) { (Flow::Result, ty::Adt(_, residual)) => self.copy_result(value, residual.type_at(1), span), - (Flow::Option, _) => self.copy_unless(Expr::undefined(), value, span), + (Flow::Option, _) => self.copy_unless(self.none(value), value, span), _ => self.copy_result(value, residual, span), }) } diff --git a/ts/src/lower/drop.rs b/ts/src/lower/drop.rs index b7c3b2828..f5a335a50 100644 --- a/ts/src/lower/drop.rs +++ b/ts/src/lower/drop.rs @@ -372,6 +372,7 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { ty::Array(elem, _) => Some(*elem), ty::Adt(adt, args) => match Std::of(self.tcx, adt.did())? { Std::Vec => Some(args.type_at(0)), + Std::Option if self.erases_to(args.type_at(0)).undefined => None, Std::Option | Std::Box | Std::Pin => self.elements(args.type_at(0)), _ => None, }, diff --git a/ts/src/lower/fmt.rs b/ts/src/lower/fmt.rs index cd6b3a1f1..fb9bcd508 100644 --- a/ts/src/lower/fmt.rs +++ b/ts/src/lower/fmt.rs @@ -265,7 +265,8 @@ pub fn std_impl<'tcx>( } (Std::Option, Trait::Debug) => { let some = b.fmt_fn(tr, args.type_at(0), span); - rt("option", vec![value, f, some]) + let none = b.t.none_arg(args.type_at(0)); + rt("option", [vec![value, f, some], none.into_iter().collect()].concat()) } (Std::Result, Trait::Debug) => { let ok = b.fmt_fn(tr, args.type_at(0), span); diff --git a/ts/src/lower/iter.rs b/ts/src/lower/iter.rs index 1931aa134..5551b8b8e 100644 --- a/ts/src/lower/iter.rs +++ b/ts/src/lower/iter.rs @@ -164,8 +164,13 @@ pub fn into_iter<'tcx>(b: &mut Body<'_, '_, 'tcx>, ty: Ty<'tcx>, value: Expr, sp Some(items(Expr::rt("iterSlice", values), args.type_at(0))) } Std::Option => { - option_ok(b, args.type_at(0), span); - Some(Expr::rt("iterOption", each(b, args.type_at(0), vec![value]))) + let inner = args.type_at(0); + let mut values = each(b, inner, vec![value]); + if let Some(none) = b.t.none_arg(inner) { + values.resize(2, Expr::undefined()); + values.push(none); + } + Some(Expr::rt("iterOption", values)) } _ => super::collections::into_iter(b, ty, value, span), }, @@ -219,16 +224,6 @@ fn not_bound<'tcx>(b: &mut Body<'_, '_, 'tcx>, ty: Ty<'tcx>, span: Span) { } } -/// Refuse an `Option` of `ty` that `T | undefined` can't hold, as the type would be. -pub fn option_ok<'tcx>(b: &mut Body<'_, '_, 'tcx>, ty: Ty<'tcx>, span: Span) { - if b.t.erases_to(ty).undefined { - b.t.err( - span, - format!("`Option<{ty}>` is not supported: its `None` and `Some` would both be `undefined`"), - ); - } -} - /// The mapping of a call on or to an iterator, if it is one. Where std drops an item it /// skips, rejects, or holds, or an iterator it takes by value, the runtime function is /// given what drops it after its own arguments. @@ -254,7 +249,10 @@ pub fn call<'tcx>( return Some(by_ref(Expr::rt("iterSlice", vec![s]), targ(0)?)); } ("Option", "iter" | "iter_mut") => { - option_ok(b, targ(0)?, span); + let mut args = args; + if let Some(none) = b.t.none_arg(targ(0)?) { + args.extend([Expr::undefined(), none]); + } return Some(Expr::rt("iterOption", args)); } ("IntoIterator", "into_iter") => { @@ -333,7 +331,7 @@ pub fn call<'tcx>( // `next` by the protocol, as an `Option`. if matches!(name, "next" | "next_back" | "nth_back") { - option_ok(b, item, span); + let none = b.t.none_arg(item); let item = match name { "next" => next(b, self_ty, recv), "next_back" => recv.member("nextBack").call(Vec::new()), @@ -345,7 +343,7 @@ pub fn call<'tcx>( recv.member("nthBackItem").call(rest) } }; - return Some(Expr::rt("iterToOption", vec![item])); + return Some(Expr::rt("iterToOption", [item].into_iter().chain(none).collect())); } // The same object, borrowed. if name == "by_ref" { @@ -417,7 +415,6 @@ pub fn call<'tcx>( // `ExactSizeIterator::len` is each iterator's own. "len" => Some(recv.member("len").call(rest)), "last" | "nth" => { - option_ok(b, item, span); let droppers = match name { "last" => vec![iter_dropper(b, self_ty, span), b.t.dropper(item, span)], _ => vec![b.t.dropper(item, span)], @@ -425,7 +422,6 @@ pub fn call<'tcx>( owned(&camel, rest, droppers) } "find" | "peek" | "next_if" => { - option_ok(b, item, span); let droppers = match name { "find" => vec![b.t.dropper(item, span)], _ => Vec::new(), @@ -433,7 +429,6 @@ pub fn call<'tcx>( method(&camel, tail(rest, droppers)) } "max" | "min" if primitive(item.peel_refs()) => { - option_ok(b, item, span); // A `BTreeMap`'s `into_keys` reads the one end and drops the rest with it. if std_iter_path(tcx, self_ty).is_some_and(|p| p == ["collections", "btree", "map", "IntoKeys"]) && b.t.drops(self_ty) @@ -447,7 +442,6 @@ pub fn call<'tcx>( method(name, tail(rest, vec![dropper])) } "max_by_key" | "min_by_key" if primitive(targ(1)?) => { - option_ok(b, item, span); let droppers = vec![iter_dropper(b, self_ty, span), b.t.dropper(item, span)]; method(&camel, tail(rest, droppers)) } @@ -725,8 +719,13 @@ fn collect<'tcx>( return None; }; let value = item_args.type_at(0); - if std == Std::Option { - option_ok(b, args.type_at(0), span); + // The runtime ends at the first `undefined`. + if std == Std::Option && b.t.erases_to(args.type_at(0)).undefined { + let msg = format!( + "collecting `Option<{}>`, whose `None` is `rt.None`, which is not supported yet", + args.type_at(0) + ); + b.t.err(span, msg); } let value_ty = b.t.ty(value, span); // What it collects from is what `from` yields up to the first `Err` or `None`, which diff --git a/ts/src/lower/library.rs b/ts/src/lower/library.rs index f8da3d846..7964772d1 100644 --- a/ts/src/lower/library.rs +++ b/ts/src/lower/library.rs @@ -200,7 +200,7 @@ impl Std { pub enum Flow { /// Breaking with a `Result`: the `rt.Result` `?` was applied to. Result, - /// Breaking with an `Option`: the `C | undefined` `?` was applied to. + /// Breaking with an `Option`: the `Option` `?` was applied to. Option, /// Any other: an `rt.Result`, `Ok` to continue and `Err` to break. Other, @@ -221,13 +221,13 @@ impl Flow { } } - /// The test that `value`, a `ControlFlow` represented so, continues, or breaks. - pub fn test(self, value: Expr, continues: bool) -> Expr { - match (self, continues) { + /// The test that `value`, a `ControlFlow` with `args`, continues, or breaks. + pub fn test<'tcx>(t: &Translator<'_, 'tcx>, args: GenericArgsRef<'tcx>, value: Expr, continues: bool) -> Expr { + match (Self::of(t.tcx, args), continues) { (Self::Result | Self::Other, true) => value.member("ok"), (Self::Result | Self::Other, false) => value.member("ok").not(), - (Self::Option, true) => value.binary("!==", Expr::undefined()), - (Self::Option, false) => value.binary("===", Expr::undefined()), + (Self::Option, true) => value.binary("!==", t.none(args.type_at(1))), + (Self::Option, false) => value.binary("===", t.none(args.type_at(1))), } } } @@ -475,6 +475,67 @@ fn discards(owner: &str, name: &str) -> Option<&'static [usize]> { }) } +/// Whether the mapping of `owner::name` tells an `Option`'s `None` from its `Some` where +/// the `None` is `rt.None`, as the runtime's functions that take `None` to be `undefined` +/// do not. +fn takes_none(owner: &str, name: &str) -> bool { + none_last(owner, name) + || matches!( + (owner, name), + ( + "Option", + "is_some" | "is_none" | "as_ref" | "copied" | "cloned" | "iter" | "iter_mut" + ) | ("Iterator", "next") + | ("DoubleEndedIterator", "next_back" | "nth_back") + ) +} + +/// Whether the runtime function `owner::name` maps to takes the `None` of the `Option` it +/// makes or reads, where that is `rt.None`, last: after what drops its operands. +fn none_last(owner: &str, name: &str) -> bool { + matches!( + (owner, name), + ("Option", "unwrap" | "expect") | ("slice", "first" | "get") | ("bool", "then" | "then_some") + ) +} + +/// The type of the first `Some` whose `Option`'s `None` is `rt.None`, of those in the +/// signature and bounds of the function `call` calls, over its type arguments: what the +/// mapping of a std function would make or read with `undefined` for `None`. +fn sentinel_option<'tcx>(t: &Translator<'_, 'tcx>, call: &Call<'tcx>) -> Option> { + let tcx = t.tcx; + let sig = tcx.fn_sig(call.def_id).instantiate_identity().skip_norm_wip(); + let sig = tcx.instantiate_bound_regions_with_erased(sig); + let bounds = tcx.param_env(call.def_id).caller_bounds(); + let bound_args = bounds.flat_map(|clause| { + let trait_args = clause.as_trait_clause().map(|c| c.skip_binder().trait_ref.args); + let projection = clause.as_projection_clause().map(|c| c.skip_binder()); + let projection_args = projection.map(|p| p.projection_term.args); + let term = projection.and_then(|p| p.term.as_type()); + (trait_args.into_iter().chain(projection_args)) + .flat_map(|args| args.types().collect::>()) + .chain(term) + }); + let env = t.typing_env_pub(); + sig.inputs_and_output + .iter() + .chain(bound_args) + .flat_map(|ty| ty.walk().filter_map(|arg| arg.as_type()).collect::>()) + .filter_map(|ty| match ty.kind() { + ty::Adt(adt, args) if Std::of(tcx, adt.did()) == Some(Std::Option) => Some(args.type_at(0)), + _ => None, + }) + .map(|inner| { + let inner = ty::EarlyBinder::bind(tcx, inner) + .instantiate(tcx, call.args) + .skip_norm_wip(); + let inner = tcx.erase_and_anonymize_regions(inner); + tcx.try_normalize_erasing_regions(env, ty::Unnormalized::new_wip(inner)) + .unwrap_or(inner) + }) + .find(|&inner| t.erases_to(inner).undefined) +} + /// The first closure `call` calls that owns a value that drops, of those its mapping does /// not drop where std would: not in `discarded`, the types it may drop by their index among /// the call's type arguments. A closure that `Fn` or `FnMut` call, given to one that calls @@ -590,6 +651,14 @@ pub fn call<'tcx>(b: &mut Body<'_, '_, 'tcx>, call: &Call<'tcx>, args: Vec return None; } let (owner, name) = key(tcx, call.def_id)?; + if !takes_none(&owner, &name) + && let Some(inner) = sentinel_option(b.t, call) + { + return Some(b.err( + call.span, + format!("`{owner}::{name}` of `Option<{inner}>`, whose `None` is `rt.None`, which is not supported yet"), + )); + } let discarded = discards(&owner, &name); let mut args = args; let leaked = called_closures(b, call, discarded, &mut args); @@ -780,10 +849,9 @@ fn mapping<'tcx>( ("Default", "default") => default_value(b, targ(gargs, 0))?, // Options, whose other combinators lower from core's MIR. - ("Option", "unwrap") => rt2(args, "option", "unwrap"), - ("Option", "expect") => rt2(args, "option", "expect"), - ("Option", "is_some") => args.pop()?.binary("!==", Expr::undefined()), - ("Option", "is_none") => args.pop()?.binary("===", Expr::undefined()), + ("Option", "unwrap" | "expect") => rt2(args, "option", &name), + ("Option", "is_some") => args.pop()?.binary("!==", b.t.none(targ(gargs, 0))), + ("Option", "is_none") => args.pop()?.binary("===", b.t.none(targ(gargs, 0))), ("Option", "as_ref" | "as_mut") => args.pop()?, ("Option", "copied" | "cloned") => { let sig = tcx.fn_sig(call.def_id).instantiate(tcx, call.args).skip_norm_wip(); @@ -807,7 +875,7 @@ fn mapping<'tcx>( Expr::rt_of("result", method).call(values) } - ("ControlFlow", "is_continue" | "is_break") => Flow::of(tcx, gargs).test(args.pop()?, name == "is_continue"), + ("ControlFlow", "is_continue" | "is_break") => Flow::test(b.t, gargs, args.pop()?, name == "is_continue"), // Ranges, which are their own iterators. // An integer range wraps within its type's bounds where std's `nth` does. @@ -1091,11 +1159,19 @@ fn mapping<'tcx>( format!("passing `{ty}`, which drops, to `{owner}::{name}`, which is not supported yet"), )); } - // What drops each operand the mapping may discard. + // What drops each operand the mapping may discard, then `rt.None` where it is one. let lost = discarded.unwrap_or_default().iter().map(|&n| targ(gargs, n)); - let Some(droppers) = b.t.droppers(lost, span) else { + let Some(mut droppers) = b.t.droppers(lost, span) else { return Some(Expr::undefined()); }; + let none = match none_last(&owner, &name) { + true => sentinel_option(b.t, call).and_then(|inner| b.t.none_arg(inner)), + false => None, + }; + if let Some(none) = none { + droppers.resize(discarded.unwrap_or_default().len(), Expr::undefined()); + droppers.push(none); + } Some(match e { Expr::Call(f, mut args) if !droppers.is_empty() => { args.extend(droppers); @@ -1280,7 +1356,7 @@ pub fn default_value<'tcx>(b: &mut Body<'_, '_, 'tcx>, ty: Ty<'tcx>) -> Option return None, }, ty::Adt(adt, args) => match Std::of(tcx, adt.did())? { - Std::Option => Expr::undefined(), + Std::Option => b.t.none(args.type_at(0)), Std::Vec => match args.type_at(0).kind() { ty::Uint(ty::UintTy::U8) => Expr::New(Box::new(Expr::Rt("ByteVec".into())), Vec::new()), _ => Expr::Array(Vec::new()), diff --git a/ts/src/lower/mir/call.rs b/ts/src/lower/mir/call.rs index a2d742383..e672c0b8b 100644 --- a/ts/src/lower/mir/call.rs +++ b/ts/src/lower/mir/call.rs @@ -121,7 +121,7 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { Some(rustc_middle::mir::RETURN_PLACE) if self.next && !matches!(*fn_ty.kind(), ty::FnDef(d, _) if crate::lower::iter::is_next(tcx, d)) => { - super::done_of(value) + self.done_of(value) } _ => value, }; @@ -411,17 +411,17 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { ("mem", "take") => { let place = self.borrowed_place(&args[0].node, span, out)?; let default = library::default_value(self.b, targ(0)?)?; - done(self.swap_out(place, default, "taken", span, out), true) + done(self.swap_out(place, targ(0)?, default, "taken", span, out), true) } ("mem", "replace") => { let place = self.borrowed_place(&args[0].node, span, out)?; let value = self.operand(&args[1].node, span, out); - done(self.swap_out(place, value, "old", span, out), true) + done(self.swap_out(place, targ(0)?, value, "old", span, out), true) } ("mem", "swap") => { let a = self.borrowed_place(&args[0].node, span, out)?; let c = self.borrowed_place(&args[1].node, span, out)?; - let old = self.swap_out(a, c.0.clone(), "swapped", span, out); + let old = self.swap_out(a, targ(0)?, c.0.clone(), "swapped", span, out); self.set_borrowed(&c, old, span, out); done(Expr::undefined(), false) } @@ -465,7 +465,9 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { } ("Option", "take") => { let place = self.borrowed_place(&args[0].node, span, out)?; - done(self.swap_out(place, Expr::undefined(), "taken", span, out), true) + let none = self.b.t.none(targ(0)?); + let option = dest.ty(&self.mir.local_decls, tcx).ty; + done(self.swap_out(place, option, none, "taken", span, out), true) } // Indexing, whose result a `&mut` reads in place. ("Index" | "IndexMut", "index" | "index_mut") => self.index(&name, gargs, args, dest, span, out), @@ -629,7 +631,12 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { _ => None, }; match (self.b.t.std_of(to), result.map(|r| r.kind()), residual.kind()) { - (Some(Std::Option), ..) => done(Expr::undefined(), false), + (Some(Std::Option), ..) => { + let ty::Adt(_, to_args) = to.kind() else { + unreachable!("an `Option` is an ADT") + }; + done(self.b.t.none(to_args.type_at(0)), false) + } (_, Some(ty::Adt(_, to_args)), ty::Adt(_, from_args)) if self.b.t.std_of(residual) == Some(Std::Result) => { @@ -759,9 +766,19 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { } /// The value at `place`, after setting `place` to `value`. - fn swap_out(&mut self, place: Borrowed<'tcx>, value: Expr, base: &str, span: Span, out: &mut Vec) -> Expr { + fn swap_out( + &mut self, + place: Borrowed<'tcx>, + ty: Ty<'tcx>, + value: Expr, + base: &str, + span: Span, + out: &mut Vec, + ) -> Expr { let name = self.b.fresh(base); - out.push(StmtKind::decl(false, name.clone(), None, Some(place.0.clone())).at(None)); + // TypeScript widens `rt.None` read from a place narrowed to it into a `symbol`. + let declared = self.b.t.erases_to(ty).none.then(|| self.b.t.ty(ty, span)); + out.push(StmtKind::decl(false, name.clone(), declared, Some(place.0.clone())).at(None)); self.set_borrowed(&place, value, span, out); Expr::ident(name) } @@ -975,7 +992,10 @@ pub fn control_flow_test<'tcx>(fx: &mut Fx<'_, '_, '_, 'tcx>, scrut: &Expr, ty: false => scrut.clone().binary("===", Expr::Rt("DONE".into())), }; } - flow(fx.tcx, ty).test(scrut.clone(), continues) + let ty::Adt(_, args) = ty.kind() else { + unreachable!("checked by the caller") + }; + Flow::test(fx.b.t, args, scrut.clone(), continues) } /// A field of a `ControlFlow`: `Continue`'s value, or `Break`'s, which for `?` is the @@ -992,7 +1012,7 @@ pub fn control_flow_field<'tcx>( (Flow::Result, false) => base, (Flow::Other, false) => base.member("error"), (Flow::Option, true) => base, - (Flow::Option, false) => Expr::undefined(), + (Flow::Option, false) => fx.b.t.none(continued(ty)), } } @@ -1009,6 +1029,14 @@ pub fn control_flow<'tcx>( (Flow::Result, _) => value, (Flow::Other, _) => Expr::result(false, value), (Flow::Option, 0) => value, - (Flow::Option, _) => Expr::undefined(), + (Flow::Option, _) => fx.b.t.none(continued(ty)), + } +} + +/// What a `ControlFlow` continues with. +fn continued(ty: Ty<'_>) -> Ty<'_> { + match ty.kind() { + ty::Adt(_, args) => args.type_at(1), + _ => unreachable!("checked by the caller"), } } diff --git a/ts/src/lower/mir/mod.rs b/ts/src/lower/mir/mod.rs index d1bd3c203..6e71becc5 100644 --- a/ts/src/lower/mir/mod.rs +++ b/ts/src/lower/mir/mod.rs @@ -1225,6 +1225,22 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { } } + /// An `Option` this `Iterator::next` returns, as it returns it: the item, or + /// `rt.DONE` for `None`. + pub(super) fn done_of(&self, option: Expr) -> Expr { + let ty::Adt(_, args) = self.mir.return_ty().kind() else { + unreachable!("`next` returns an `Option`") + }; + let none = self.b.t.none(args.type_at(0)); + match option { + option if option == none => Expr::Rt("DONE".into()), + option => { + let none = self.b.t.none_arg(args.type_at(0)); + Expr::rt("iterFromOption", [option].into_iter().chain(none).collect()) + } + } + } + /// `value`, the `rvalue` assigned to `place`, as a value of its whole type where /// something tests `place`'s variant or std takes it: TypeScript narrows a variable to /// the type of what it was assigned, as a `Poll` made `Ready` to its payload's, and @@ -2256,7 +2272,7 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { { value } - (true, _) => done_of(value), + (true, _) => self.done_of(value), }; let effect = rvalue::effect(rvalue, self); // A copy shared until it folds into its argument reads its source there. @@ -3543,14 +3559,6 @@ fn redundant(msg: &mir::AssertMessage<'_>) -> bool { ) } -/// An `Option` as `Iterator::next` returns it: the item, or `rt.DONE` for `None`. -pub fn done_of(option: Expr) -> Expr { - match option { - Expr::Lit(t) if t == "undefined" => Expr::Rt("DONE".into()), - option => Expr::rt("iterFromOption", vec![option]), - } -} - /// Whether `term` is an assert of a constant that fails. fn fails(term: &mir::Terminator<'_>) -> bool { let TerminatorKind::Assert { diff --git a/ts/src/lower/mir/place.rs b/ts/src/lower/mir/place.rs index 2ce916c83..093e7d32c 100644 --- a/ts/src/lower/mir/place.rs +++ b/ts/src/lower/mir/place.rs @@ -415,7 +415,10 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { let (breaks, continues) = (args.type_at(0), args.type_at(1)); Some(match (Flow::of(tcx, args), variant.index()) { (Flow::Option, 0) => self.b.t.ty(continues, span), - (Flow::Option, _) => crate::ts::Type::Builtin("undefined"), + (Flow::Option, _) => match self.b.t.erases_to(continues).undefined { + true => crate::ts::Type::Rt("None", vec![]), + false => crate::ts::Type::Builtin("undefined"), + }, (Flow::Result | Flow::Other, 0) => result(true, self.b.t.ty(continues, span)), (Flow::Result, _) => self.b.t.ty(breaks, span), (Flow::Other, _) => result(false, self.b.t.ty(breaks, span)), @@ -844,7 +847,7 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { .field(info.state) .binary("===", Expr::lit(value.to_string())) } - ty::Adt(adt, _) if adt.is_enum() => { + ty::Adt(adt, args) if adt.is_enum() => { let Some((index, _)) = adt.discriminants(tcx).find(|(_, d)| d.val == value) else { return self.err(span, format!("no variant of `{ty}` has discriminant {value}")); }; @@ -866,8 +869,8 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { } } Some(Std::Option) => match index.index() { - 0 => scrut.clone().binary("===", Expr::undefined()), - _ => scrut.clone().binary("!==", Expr::undefined()), + 0 => scrut.clone().binary("===", self.b.t.none(args.type_at(0))), + _ => scrut.clone().binary("!==", self.b.t.none(args.type_at(0))), }, Some(Std::Poll) => match index.index() { 0 => scrut.clone().binary("!==", Expr::Rt("Pending".into())), diff --git a/ts/src/lower/mir/rvalue.rs b/ts/src/lower/mir/rvalue.rs index 1459962f4..867a3c0e3 100644 --- a/ts/src/lower/mir/rvalue.rs +++ b/ts/src/lower/mir/rvalue.rs @@ -427,7 +427,7 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { let def = adt.variant(variant); if let Some(std) = Std::of(tcx, def_id) { return match (std, variant.index()) { - (Std::Option, 0) => Expr::undefined(), + (Std::Option, 0) => self.b.t.none(args.type_at(0)), (Std::Poll, 1) => Expr::Rt("Pending".into()), (Std::Option | Std::Poll, _) => values.pop().unwrap(), // Either variant is its text. diff --git a/ts/src/lower/mod.rs b/ts/src/lower/mod.rs index 7a7c4d8ff..1ad3dd9b2 100644 --- a/ts/src/lower/mod.rs +++ b/ts/src/lower/mod.rs @@ -224,11 +224,29 @@ pub enum ObjectKind { } /// The JS values a type's own can be that `Option` and `Poll` erase to: `None` is -/// `undefined`, and `Pending` is `rt.Pending`. +/// `undefined`, or `rt.None` where `Some` can already be `undefined`, and `Pending` is +/// `rt.Pending`. #[derive(Clone, Copy, Default)] pub struct Erased { pub undefined: bool, + pub none: bool, pub pending: bool, + /// A type parameter's value, which each instance decides. + pub param: bool, +} + +impl Erased { + /// What an `Option` of a type erased so erases to: its `None` is `undefined`, or + /// `rt.None` where `Some` can already be `undefined`. + fn option(self) -> Self { + match self.undefined { + true => Self { none: true, ..self }, + false => Self { + undefined: true, + ..self + }, + } + } } impl<'a, 'tcx> Translator<'a, 'tcx> { @@ -1101,8 +1119,9 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { match library::Std::of(self.tcx, adt.did())? { library::Std::Option => { let inner = args.type_at(0); - self.erases_to(inner).undefined.then(|| { - format!("`Option<{inner}>` is not supported: its `None` and `Some` would both be `undefined`") + let erased = self.erases_to(inner); + (erased.undefined && erased.none).then(|| { + format!("`Option<{inner}>` is not supported: its `None` and `Some` would both be `rt.None`") }) } library::Std::Poll => { @@ -1112,10 +1131,9 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { .then(|| format!("`Poll<{inner}>` is not supported: it would be pending two ways with one value")) } library::Std::ControlFlow if library::Flow::of(self.tcx, args) == library::Flow::Option => { - let inner = args.type_at(1); - self.erases_to(inner) - .undefined - .then(|| format!("`{ty}` is not supported: its break and its continue would both be `undefined`")) + let erased = self.erases_to(args.type_at(1)); + (erased.undefined && erased.none) + .then(|| format!("`{ty}` is not supported: its break and its continue would both be `rt.None`")) } _ => None, } @@ -1147,11 +1165,10 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { if let Some(std) = library::Std::of(tcx, adt.did()) { return match std { library::Std::Option => { - let inner = args.type_at(0); if let Some(msg) = self.erasure_conflict(Ty::new_adt(tcx, adt, args)) { self.err(span, msg); } - Type::Union(vec![self.ty(inner, span), Type::Builtin("undefined")]) + self.option_ty(args.type_at(0), span) } // A lock's result, which is never an error: its guard. library::Std::Result if self.std_of(args.type_at(1)) == Some(library::Std::PoisonError) => { @@ -1243,7 +1260,7 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { }; Type::Rt("Result", vec![self.ty(value, span), self.ty(residual.type_at(1), span)]) } - library::Flow::Option => Type::Union(vec![self.ty(value, span), Type::Builtin("undefined")]), + library::Flow::Option => self.option_ty(value, span), library::Flow::Other => Type::Rt("Result", vec![self.ty(value, span), self.ty(residual, span)]), } } @@ -1263,10 +1280,44 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { return Type::Builtin("unknown"); } let info = self.adt(adt, span); + if let Some(msg) = self.generic_none(adt, args) { + self.err(span, msg); + } let args = args.types().map(|t| self.ty(t, span)).collect(); Type::Sym(info.sym, args) } + /// Why an instance of the crate's generic `adt` with `args` can't hold its fields' values, + /// if it can't: an `Option` over a type parameter that its definition types `T | + /// undefined`, whose `None` this instance's `T` makes `rt.None`. + fn generic_none(&self, adt: AdtDef<'tcx>, args: GenericArgsRef<'tcx>) -> Option { + let tcx = self.tcx; + if !args.types().any(|t| self.erases_to(t).undefined) { + return None; + } + adt.all_fields().find_map(|field| { + let generic = tcx.type_of(field.did).instantiate_identity().skip_norm_wip(); + generic.walk().filter_map(|arg| arg.as_type()).find_map(|part| { + let ty::Adt(option, option_args) = part.kind() else { + return None; + }; + let inner = option_args.type_at(0); + let erased = self.erases_to(inner); + if library::Std::of(tcx, option.did()) != Some(library::Std::Option) || !erased.param || erased.undefined { + return None; + } + let instance = ty::EarlyBinder::bind(tcx, inner).instantiate(tcx, args).skip_norm_wip(); + self.erases_to(instance).undefined.then(|| { + let ty = Ty::new_adt(tcx, adt, args); + format!( + "`{ty}` is not supported: its field `{}` is `Option<{inner}>`, typed `{inner} | undefined`, whose `None` would be `rt.None` as `Option<{instance}>`", + field.name + ) + }) + }) + }) + } + /// The type of an iterator's items, which every iterator has. fn item_ty(&mut self, item: Option>, span: Span) -> Type { match item { @@ -1278,31 +1329,58 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { } } + /// The TypeScript type of an `Option`: `T | undefined`, or `T | rt.None` where + /// `T` can already be `undefined`. + fn option_ty(&mut self, inner: Ty<'tcx>, span: Span) -> Type { + let none = match self.erases_to(inner).undefined { + true => Type::Rt("None", vec![]), + false => Type::Builtin("undefined"), + }; + Type::Union(vec![self.ty(inner, span), none]) + } + + /// The JS value of `None` in an `Option`, and of `Break` in a `ControlFlow` + /// that `?` on one makes: `undefined`, or `rt.None` where `inner` can already be + /// `undefined`. + pub fn none(&self, inner: Ty<'tcx>) -> ts::Expr { + self.none_arg(inner).unwrap_or_else(ts::Expr::undefined) + } + + /// `rt.None`, if it is an `Option`'s `None`, which a runtime function taking + /// one takes after its own arguments. + pub fn none_arg(&self, inner: Ty<'tcx>) -> Option { + self.erases_to(inner).undefined.then(|| ts::Expr::Rt("None".into())) + } + /// Which of the values `Option` and `Poll` erase to a `ty`'s JS value can already be, /// seen through the wrappers that erase to their contents. pub fn erases_to(&self, ty: Ty<'tcx>) -> Erased { match ty.kind() { ty::Tuple(tys) if tys.is_empty() => Erased { undefined: true, - pending: false, + ..Erased::default() + }, + ty::Param(_) => Erased { + param: true, + ..Erased::default() }, + // An `rt.Place`, which is an object. + ty::Ref(..) if self.place_pointee(ty).is_some() => Erased::default(), ty::Ref(_, inner, _) => self.erases_to(*inner), ty::Adt(adt, args) => match library::Std::of(self.tcx, adt.did()) { Some(library::Std::Box | library::Std::Pin) => self.erases_to(args.type_at(0)), - Some(library::Std::Option) => Erased { - undefined: true, - ..self.erases_to(args.type_at(0)) - }, + Some(library::Std::Option) => self.erases_to(args.type_at(0)).option(), Some(library::Std::Poll) => Erased { pending: true, ..self.erases_to(args.type_at(0)) }, Some(library::Std::ControlFlow) if library::Flow::of(self.tcx, args) == library::Flow::Option => { - Erased { - undefined: true, - ..self.erases_to(args.type_at(1)) - } + self.erases_to(args.type_at(1)).option() } + Some(library::Std::RangeFull) => Erased { + undefined: true, + ..Erased::default() + }, _ => Erased::default(), }, _ => Erased::default(), From 71f8156f5b6f0b064e2d73a7a708205197c74164 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:05:07 -0700 Subject: [PATCH 3/5] quest: finish nested-option Co-Authored-By: Claude Opus 5.5 --- quest/m2/ts-model/nested-option.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 quest/m2/ts-model/nested-option.md diff --git a/quest/m2/ts-model/nested-option.md b/quest/m2/ts-model/nested-option.md deleted file mode 100644 index d94a7c8b8..000000000 --- a/quest/m2/ts-model/nested-option.md +++ /dev/null @@ -1,19 +0,0 @@ -# [M] Options of values that can be undefined - -## Goal - -rust2-ts translates an `Option` whose `T` can already be `undefined`, such as -`Option>` and `Option<()>`, keeping `None` apart from `Some(None)`, proven by -differential tests against native Rust. - -## Plan - -Found by the [model's](/quest/m2/ts-model/README.md) census on 2026-10-27: 73 refusals -over 37 items, 33 in `resume.rs`. - -Decided with the maintainer on 2026-10-27: only where `T` can be `undefined`, the outer -`None` is a runtime sentinel, as `rt.Pending` and `rt.DONE` are. Every other `Option` -stays `T | undefined`, which keeps `?.` and `??` working for TS callers. A uniform -`rt.None` for every `Option` was considered and left out. - -Public API: the translator's output. From d823aa44345e297759fd4fd235b5cffd3c20ee6d Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:21:06 -0700 Subject: [PATCH 4/5] fix(ts): refuse collecting options of undefined-able items, and check Option first Collecting into an `Option` checks the items' payload too, which the runtime's shunt ends at when `undefined`. A generic type's instance check reads an `Option`'s argument only once it knows the field's type is an `Option`. Drop the finished quest's link. Co-Authored-By: Claude Opus 5.5 --- quest/m2/ts-model/README.md | 1 - ts/fixtures/lang/expected/nested.Tagged.ts | 16 + ts/fixtures/lang/expected/nested.ts | 4 + ts/fixtures/lang/src/nested.rs | 11 + ts/fixtures/reject/census.md | 434 ++++++++++--------- ts/fixtures/reject/expected.txt | 147 +++---- ts/fixtures/reject/src/lib.rs | 5 + ts/fixtures/reject/ts.toml | 1 + ts/rustc-ice-2026-10-27T22_10_28-1632761.txt | 65 --- ts/src/lower/iter.rs | 13 +- ts/src/lower/mod.rs | 5 +- 11 files changed, 343 insertions(+), 359 deletions(-) create mode 100644 ts/fixtures/lang/expected/nested.Tagged.ts delete mode 100644 ts/rustc-ice-2026-10-27T22_10_28-1632761.txt diff --git a/quest/m2/ts-model/README.md b/quest/m2/ts-model/README.md index db75e7f54..2e75e45d7 100644 --- a/quest/m2/ts-model/README.md +++ b/quest/m2/ts-model/README.md @@ -48,5 +48,4 @@ Public API: the translator's output for moq-net's model. - [Shared ownership](/quest/m2/ts-shared.md) - kio's waiters are `Arc`/`Weak` with observable counts, and its atomics and locks are plain values - [Translate safe dependencies with the package](/quest/m2/ts-model/crates.md) - kio, moq-clock, moq-pattern, and rangemap translate as one program with moq-net - [Std gaps the model reaches](/quest/m2/ts-model/std-more.md) - ranges, wrappers, and `Vec`'s editing methods -- [Options of values that can be undefined](/quest/m2/ts-model/nested-option.md) - `Option>` and `Option<()>` keep `None` apart from `Some(None)` - [Async in the TypeScript translator](/quest/m2/ts-async.md) - kio's producers and consumers are futures diff --git a/ts/fixtures/lang/expected/nested.Tagged.ts b/ts/fixtures/lang/expected/nested.Tagged.ts new file mode 100644 index 000000000..0c36a90b3 --- /dev/null +++ b/ts/fixtures/lang/expected/nested.Tagged.ts @@ -0,0 +1,16 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "./rt.ts"; + +/** A generic type over a `T` that can be `undefined`, beside a field of no type parameter. */ +export class Tagged { + value: T; + order: rt.Ordering; + + constructor(fields: { value: T; order: rt.Ordering }) { + this.value = fields.value; + this.order = fields.order; + } +} + +//# sourceMappingURL=nested.Tagged.ts.map diff --git a/ts/fixtures/lang/expected/nested.ts b/ts/fixtures/lang/expected/nested.ts index 291c6d56a..475bec2ce 100644 --- a/ts/fixtures/lang/expected/nested.ts +++ b/ts/fixtures/lang/expected/nested.ts @@ -4,6 +4,7 @@ import * as rt from "./rt.ts"; import { unwrapOr$Option_u8, map$Option_Option_u8_Option_u8_made_closure0, map$Option_u8_Option_u8_made_closure1_closure0, map$Option_u8_u8_made_closure0_closure0, map$Option_unit_Option_u8_made_closure3, mapOr$Option_u8_u8_iters_closure3, mapOr$Option_u8_usize_iters_closure1, mapOr$Option_unit_u8_made_closure4, andThen$Option_Option_u8_Option_u8_made_closure1, filter$Option_Option_u8_made_closure2, or$Option_Option_u8, xor$Option_Option_u8, flatten$Option_Option_u8 } from "./core/option.ts"; import * as Halves from "./nested.Halves.ts"; import type * as Slot from "./nested.Slot.ts"; +import * as Tagged from "./nested.Tagged.ts"; /** * Run case `kind % 4` over `data`, whose bytes pick each `None`, `Some(None)`, or @@ -107,6 +108,9 @@ export function made(data: rt.ByteSlice, out: rt.ByteVec): void { slot.held = b as rt.u8 | undefined | rt.None; rt.byteVecPush(out, code(old) ^ code(slot.held)); rt.byteVecPush(out, code(rt.None)); + const _106: rt.Ordering = rt.cmp(b, 128); + const tagged: Tagged.Tagged = new Tagged.Tagged({ value: u, order: _106 }); + rt.byteVecPush(out, (tagged.value !== rt.None ? 1 : 0) | ((order(tagged.order) << 1) & 0xff)); const args2: rt.Fmt[] = [(f: rt.Formatter) => rt.fmtOption(o, f, (value: rt.u8 | undefined, f: rt.Formatter) => rt.fmtOption(value, f, rt.u8Display), rt.None), (f: rt.Formatter) => rt.fmtOption(u, f, rt.fmtUnit, rt.None)]; rt.byteVecExtendFromSlice(out, rt.stringAsBytes(rt.fmtFormat([args2[0], " ", args2[1]]))); } diff --git a/ts/fixtures/lang/src/nested.rs b/ts/fixtures/lang/src/nested.rs index af717ddb2..57c6136d9 100644 --- a/ts/fixtures/lang/src/nested.rs +++ b/ts/fixtures/lang/src/nested.rs @@ -46,6 +46,12 @@ fn tried(a: Option<()>, b: Option>) -> Option> { Some(inner.map(|x| x / 2)) } +/// A generic type over a `T` that can be `undefined`, beside a field of no type parameter. +struct Tagged { + value: T, + order: Ordering, +} + struct Slot { held: Option>, flag: Option<()>, @@ -76,6 +82,11 @@ fn made(data: &[u8], out: &mut Vec) { out.push(code(replaced) ^ code(slot.held)); let default: Option> = Default::default(); out.push(code(default)); + let tagged = Tagged { + value: u, + order: b.cmp(&0x80), + }; + out.push(tagged.value.is_some() as u8 | order(tagged.order) << 1); out.extend_from_slice(format!("{o:?} {u:?}").as_bytes()); } } diff --git a/ts/fixtures/reject/census.md b/ts/fixtures/reject/census.md index a65260fdf..774e3fa30 100644 --- a/ts/fixtures/reject/census.md +++ b/ts/fixtures/reject/census.md @@ -1,7 +1,7 @@ # Census of `reject-fixture` -- Refusals: 84 -- Function instances: 73 +- Refusals: 85 +- Function instances: 74 - Generic functions no instance reached, lowered over their type parameters: 2 ## By construct @@ -9,53 +9,54 @@ | Count | Construct | First | | ---: | --- | --- | | 10 | unsupported call to `_` | fixtures/reject/src/lib.rs:28:4 | -| 5 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | fixtures/reject/src/lib.rs:56:11 | -| 4 | a variant of `_`, which is not supported: either is the same JS string | fixtures/reject/src/lib.rs:403:2 | -| 4 | an assignment through a reference to `_` | fixtures/reject/src/lib.rs:120:2 | +| 5 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | fixtures/reject/src/lib.rs:61:11 | +| 4 | a variant of `_`, which is not supported: either is the same JS string | fixtures/reject/src/lib.rs:408:2 | +| 4 | an assignment through a reference to `_` | fixtures/reject/src/lib.rs:125:2 | | 4 | unsupported type `_` | fixtures/reject/src/lib.rs:7:14 | | 3 | `_` with a mutable reference to a value JS copies, which its mapping would copy | fixtures/reject/src/lib.rs:17:2 | -| 3 | dropping `_`, which is not supported yet | fixtures/reject/src/lib.rs:56:18 | -| 3 | replacing the value behind a reference to `_` | fixtures/reject/src/lib.rs:104:2 | -| 2 | `_` is not supported: it would be pending two ways with one value | fixtures/reject/src/lib.rs:124:20 | +| 3 | dropping `_`, which is not supported yet | fixtures/reject/src/lib.rs:61:18 | +| 3 | replacing the value behind a reference to `_` | fixtures/reject/src/lib.rs:109:2 | +| 2 | `_` is not supported: it would be pending two ways with one value | fixtures/reject/src/lib.rs:129:20 | | 2 | `_` is not supported: its `None` and `Some` would both be `rt.None` | fixtures/reject/src/lib.rs:23:15 | -| 2 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | fixtures/reject/src/lib.rs:43:42 | -| 2 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | fixtures/reject/src/lib.rs:271:16 | -| 2 | a field of `_` | fixtures/reject/src/lib.rs:287:7 | -| 2 | an iterator of the crate implementing `_`, which is not supported yet | fixtures/reject/src/lib.rs:178:1 | -| 2 | constructing `_` from another crate | fixtures/reject/src/lib.rs:164:23 | -| 2 | overriding `_`, which std's adaptors call in place of `next` or beside it | fixtures/reject/src/lib.rs:158:2 | -| 1 | `Binary` formatting, as in `{:b}`, is not supported | fixtures/reject/src/lib.rs:81:3 | -| 1 | `LowerExp` formatting, as in `{:e}`, is not supported | fixtures/reject/src/lib.rs:83:3 | -| 1 | `Octal` formatting, as in `{:o}`, is not supported | fixtures/reject/src/lib.rs:82:3 | -| 1 | `Pointer` formatting, as in `{:p}`, is not supported | fixtures/reject/src/lib.rs:86:3 | -| 1 | `_` is not supported yet | fixtures/reject/src/lib.rs:414:18 | +| 2 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | fixtures/reject/src/lib.rs:48:42 | +| 2 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | fixtures/reject/src/lib.rs:276:16 | +| 2 | a field of `_` | fixtures/reject/src/lib.rs:292:7 | +| 2 | an iterator of the crate implementing `_`, which is not supported yet | fixtures/reject/src/lib.rs:183:1 | +| 2 | constructing `_` from another crate | fixtures/reject/src/lib.rs:169:23 | +| 2 | overriding `_`, which std's adaptors call in place of `next` or beside it | fixtures/reject/src/lib.rs:163:2 | +| 1 | `Binary` formatting, as in `{:b}`, is not supported | fixtures/reject/src/lib.rs:86:3 | +| 1 | `LowerExp` formatting, as in `{:e}`, is not supported | fixtures/reject/src/lib.rs:88:3 | +| 1 | `Octal` formatting, as in `{:o}`, is not supported | fixtures/reject/src/lib.rs:87:3 | +| 1 | `Pointer` formatting, as in `{:p}`, is not supported | fixtures/reject/src/lib.rs:91:3 | +| 1 | `_` is not supported yet | fixtures/reject/src/lib.rs:419:18 | | 1 | `_` is not supported: its field `_` is `_`, typed `_`, whose `None` would be `rt.None` as `_` | fixtures/reject/src/lib.rs:38:2 | -| 1 | `_` of `_` by `_`, which is not supported yet | fixtures/reject/src/lib.rs:315:6 | -| 1 | `_` of `_`, which drops `_`, which is not supported yet | fixtures/reject/src/lib.rs:62:13 | -| 1 | `_` through a held type's own, which is not supported yet | fixtures/reject/src/lib.rs:347:2 | -| 1 | `_`, which is not supported yet | fixtures/reject/src/lib.rs:323:9 | -| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | fixtures/reject/src/lib.rs:240:26 | -| 1 | a `_` cast from `_` to `_` | fixtures/reject/src/lib.rs:115:2 | -| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | fixtures/reject/src/lib.rs:245:30 | -| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | fixtures/reject/src/lib.rs:191:51 | -| 1 | a coercion to `_` | fixtures/reject/src/lib.rs:370:2 | -| 1 | a constant of type `_` | fixtures/reject/src/lib.rs:99:2 | -| 1 | a copy of a closure that changes what it captured | fixtures/reject/src/lib.rs:281:14 | -| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | fixtures/reject/src/lib.rs:250:13 | -| 1 | a mutable reference into a `Result`'s payload, passed on or kept | fixtures/reject/src/lib.rs:452:12 | -| 1 | a precision, as in `{:.2}`, is not supported | fixtures/reject/src/lib.rs:78:3 | -| 1 | a printable type must implement `Display` or `Debug` | fixtures/reject/src/lib.rs:111:1 | +| 1 | `_` of `_` by `_`, which is not supported yet | fixtures/reject/src/lib.rs:320:6 | +| 1 | `_` of `_`, which drops `_`, which is not supported yet | fixtures/reject/src/lib.rs:67:13 | +| 1 | `_` through a held type's own, which is not supported yet | fixtures/reject/src/lib.rs:352:2 | +| 1 | `_`, which is not supported yet | fixtures/reject/src/lib.rs:328:9 | +| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | fixtures/reject/src/lib.rs:245:26 | +| 1 | a `_` cast from `_` to `_` | fixtures/reject/src/lib.rs:120:2 | +| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | fixtures/reject/src/lib.rs:250:30 | +| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | fixtures/reject/src/lib.rs:196:51 | +| 1 | a coercion to `_` | fixtures/reject/src/lib.rs:375:2 | +| 1 | a constant of type `_` | fixtures/reject/src/lib.rs:104:2 | +| 1 | a copy of a closure that changes what it captured | fixtures/reject/src/lib.rs:286:14 | +| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | fixtures/reject/src/lib.rs:255:13 | +| 1 | a mutable reference into a `Result`'s payload, passed on or kept | fixtures/reject/src/lib.rs:457:12 | +| 1 | a precision, as in `{:.2}`, is not supported | fixtures/reject/src/lib.rs:83:3 | +| 1 | a printable type must implement `Display` or `Debug` | fixtures/reject/src/lib.rs:116:1 | | 1 | a scalar constant of type `_` | fixtures/reject/src/lib.rs:8:2 | -| 1 | a width or precision from an argument, as in `{:1$}`, is not supported | fixtures/reject/src/lib.rs:85:3 | -| 1 | a zero-sized constant of type `_` | fixtures/reject/src/lib.rs:71:2 | -| 1 | an iterator that owns `_`, which drops, which is not supported yet | fixtures/reject/src/lib.rs:397:13 | +| 1 | a width or precision from an argument, as in `{:1$}`, is not supported | fixtures/reject/src/lib.rs:90:3 | +| 1 | a zero-sized constant of type `_` | fixtures/reject/src/lib.rs:76:2 | +| 1 | an iterator that owns `_`, which drops, which is not supported yet | fixtures/reject/src/lib.rs:402:13 | | 1 | arithmetic on `_` | fixtures/reject/src/lib.rs:8:2 | -| 1 | comparing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:297:52 | -| 1 | constructing `_` | fixtures/reject/src/lib.rs:421:53 | -| 1 | hashing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:297:52 | -| 1 | hex `Debug`, as in `{:x?}`, is not supported | fixtures/reject/src/lib.rs:84:3 | -| 1 | the `+` flag of a format spec is not supported | fixtures/reject/src/lib.rs:79:3 | -| 1 | the `-` flag of a format spec is not supported | fixtures/reject/src/lib.rs:80:3 | +| 1 | collecting `_`, whose `None` is `rt.None`, which is not supported yet | fixtures/reject/src/lib.rs:43:43 | +| 1 | comparing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:302:52 | +| 1 | constructing `_` | fixtures/reject/src/lib.rs:426:53 | +| 1 | hashing `_` as a key, which is not supported yet | fixtures/reject/src/lib.rs:302:52 | +| 1 | hex `Debug`, as in `{:x?}`, is not supported | fixtures/reject/src/lib.rs:89:3 | +| 1 | the `+` flag of a format spec is not supported | fixtures/reject/src/lib.rs:84:3 | +| 1 | the `-` flag of a format spec is not supported | fixtures/reject/src/lib.rs:85:3 | ## By API @@ -63,121 +64,122 @@ The type or module each refused type or path belongs to. | Count | API | First | | ---: | --- | --- | -| 7 | `std::borrow::Cow` | fixtures/reject/src/lib.rs:403:2 | +| 7 | `std::borrow::Cow` | fixtures/reject/src/lib.rs:408:2 | +| 6 | `Option` | fixtures/reject/src/lib.rs:23:15 | | 6 | `f64` | fixtures/reject/src/lib.rs:7:14 | -| 5 | `Iterator` | fixtures/reject/src/lib.rs:43:42 | -| 5 | `Option` | fixtures/reject/src/lib.rs:23:15 | -| 5 | `{closure}` | fixtures/reject/src/lib.rs:56:11 | -| 3 | `std::iter::Map` | fixtures/reject/src/lib.rs:56:18 | +| 5 | `Iterator` | fixtures/reject/src/lib.rs:48:42 | +| 5 | `{closure}` | fixtures/reject/src/lib.rs:61:11 | +| 3 | `std::iter::Map` | fixtures/reject/src/lib.rs:61:18 | | 3 | `std::slice` | fixtures/reject/src/lib.rs:28:4 | -| 3 | `std::sync::Arc` | fixtures/reject/src/lib.rs:120:2 | -| 2 | `HashMap` | fixtures/reject/src/lib.rs:292:6 | -| 2 | `Meters` | fixtures/reject/src/lib.rs:104:2 | -| 2 | `Noisy` | fixtures/reject/src/lib.rs:62:13 | -| 2 | `Poll` | fixtures/reject/src/lib.rs:124:20 | -| 2 | `std::collections::HashMap` | fixtures/reject/src/lib.rs:62:13 | -| 2 | `std::iter::Iterator` | fixtures/reject/src/lib.rs:271:16 | -| 2 | `std::iter::Take` | fixtures/reject/src/lib.rs:395:79 | -| 2 | `std::ops::Range` | fixtures/reject/src/lib.rs:199:8 | -| 2 | `std::pin::Pin` | fixtures/reject/src/lib.rs:135:2 | -| 2 | `std::vec::Vec` | fixtures/reject/src/lib.rs:297:52 | -| 2 | `u8` | fixtures/reject/src/lib.rs:99:2 | -| 1 | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:178:1 | -| 1 | `Entry` | fixtures/reject/src/lib.rs:386:13 | -| 1 | `FusedIterator` | fixtures/reject/src/lib.rs:232:1 | -| 1 | `Hasher` | fixtures/reject/src/lib.rs:323:9 | -| 1 | `IntToFloat` | fixtures/reject/src/lib.rs:115:2 | +| 3 | `std::sync::Arc` | fixtures/reject/src/lib.rs:125:2 | +| 2 | `HashMap` | fixtures/reject/src/lib.rs:297:6 | +| 2 | `Meters` | fixtures/reject/src/lib.rs:109:2 | +| 2 | `Noisy` | fixtures/reject/src/lib.rs:67:13 | +| 2 | `Poll` | fixtures/reject/src/lib.rs:129:20 | +| 2 | `std::collections::HashMap` | fixtures/reject/src/lib.rs:67:13 | +| 2 | `std::iter::Iterator` | fixtures/reject/src/lib.rs:276:16 | +| 2 | `std::iter::Take` | fixtures/reject/src/lib.rs:400:79 | +| 2 | `std::ops::Range` | fixtures/reject/src/lib.rs:204:8 | +| 2 | `std::pin::Pin` | fixtures/reject/src/lib.rs:140:2 | +| 2 | `std::vec::Vec` | fixtures/reject/src/lib.rs:302:52 | +| 2 | `u8` | fixtures/reject/src/lib.rs:104:2 | +| 1 | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:183:1 | +| 1 | `Entry` | fixtures/reject/src/lib.rs:391:13 | +| 1 | `FusedIterator` | fixtures/reject/src/lib.rs:237:1 | +| 1 | `Hasher` | fixtures/reject/src/lib.rs:328:9 | +| 1 | `IntToFloat` | fixtures/reject/src/lib.rs:120:2 | | 1 | `Maybe` | fixtures/reject/src/lib.rs:38:2 | | 1 | `T \| undefined` | fixtures/reject/src/lib.rs:38:2 | -| 1 | `[u16; 1]` | fixtures/reject/src/lib.rs:264:22 | +| 1 | `[u16; 1]` | fixtures/reject/src/lib.rs:269:22 | | 1 | `dyn std::ops::Fn(u8) -> u8` | fixtures/reject/src/lib.rs:11:16 | -| 1 | `from_fn` | fixtures/reject/src/lib.rs:396:13 | -| 1 | `into_keys` | fixtures/reject/src/lib.rs:62:13 | -| 1 | `std::collections::hash_map::Entry` | fixtures/reject/src/lib.rs:442:15 | -| 1 | `std::iter::Chain` | fixtures/reject/src/lib.rs:191:51 | -| 1 | `std::iter::Flatten` | fixtures/reject/src/lib.rs:240:26 | +| 1 | `from_fn` | fixtures/reject/src/lib.rs:401:13 | +| 1 | `into_keys` | fixtures/reject/src/lib.rs:67:13 | +| 1 | `std::collections::hash_map::Entry` | fixtures/reject/src/lib.rs:447:15 | +| 1 | `std::iter::Chain` | fixtures/reject/src/lib.rs:196:51 | +| 1 | `std::iter::Flatten` | fixtures/reject/src/lib.rs:245:26 | | 1 | `std::iter::IntoIterator` | fixtures/reject/src/lib.rs:17:2 | -| 1 | `std::iter::Rev` | fixtures/reject/src/lib.rs:185:14 | -| 1 | `std::mem` | fixtures/reject/src/lib.rs:55:29 | -| 1 | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:287:48 | -| 1 | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:287:7 | -| 1 | `std::option::Option` | fixtures/reject/src/lib.rs:459:2 | -| 1 | `std::slice::Iter` | fixtures/reject/src/lib.rs:145:11 | -| 1 | `std::str` | fixtures/reject/src/lib.rs:376:4 | -| 1 | `std::string::String` | fixtures/reject/src/lib.rs:93:10 | -| 1 | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:140:2 | -| 1 | `std::time::Duration` | fixtures/reject/src/lib.rs:429:2 | -| 1 | `successors` | fixtures/reject/src/lib.rs:395:15 | -| 1 | `u32` | fixtures/reject/src/lib.rs:250:13 | -| 1 | `u64` | fixtures/reject/src/lib.rs:115:2 | +| 1 | `std::iter::Rev` | fixtures/reject/src/lib.rs:190:14 | +| 1 | `std::mem` | fixtures/reject/src/lib.rs:60:29 | +| 1 | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:292:48 | +| 1 | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:292:7 | +| 1 | `std::option::Option` | fixtures/reject/src/lib.rs:464:2 | +| 1 | `std::slice::Iter` | fixtures/reject/src/lib.rs:150:11 | +| 1 | `std::str` | fixtures/reject/src/lib.rs:381:4 | +| 1 | `std::string::String` | fixtures/reject/src/lib.rs:98:10 | +| 1 | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:145:2 | +| 1 | `std::time::Duration` | fixtures/reject/src/lib.rs:434:2 | +| 1 | `successors` | fixtures/reject/src/lib.rs:400:15 | +| 1 | `u32` | fixtures/reject/src/lib.rs:255:13 | +| 1 | `u64` | fixtures/reject/src/lib.rs:120:2 | | 1 | `value` | fixtures/reject/src/lib.rs:38:2 | -| 1 | `{async closure}` | fixtures/reject/src/lib.rs:71:2 | +| 1 | `{async closure}` | fixtures/reject/src/lib.rs:76:2 | ## By type or path | Count | Construct | Type or path | First | | ---: | --- | --- | --- | -| 4 | a variant of `_`, which is not supported: either is the same JS string | `std::borrow::Cow` | fixtures/reject/src/lib.rs:403:2 | +| 4 | a variant of `_`, which is not supported: either is the same JS string | `std::borrow::Cow` | fixtures/reject/src/lib.rs:408:2 | | 3 | unsupported type `_` | `f64` | fixtures/reject/src/lib.rs:7:14 | -| 2 | `_` is not supported: it would be pending two ways with one value | `Poll` | fixtures/reject/src/lib.rs:124:20 | +| 2 | `_` is not supported: it would be pending two ways with one value | `Poll` | fixtures/reject/src/lib.rs:129:20 | | 2 | `_` is not supported: its `None` and `Some` would both be `rt.None` | `Option` | fixtures/reject/src/lib.rs:23:15 | -| 2 | an assignment through a reference to `_` | `std::pin::Pin` | fixtures/reject/src/lib.rs:135:2 | -| 2 | dropping `_`, which is not supported yet | `std::iter::Take` | fixtures/reject/src/lib.rs:395:79 | -| 2 | replacing the value behind a reference to `_` | `Meters` | fixtures/reject/src/lib.rs:104:2 | -| 1 | `_` is not supported yet | `std::borrow::Cow` | fixtures/reject/src/lib.rs:414:18 | +| 2 | an assignment through a reference to `_` | `std::pin::Pin` | fixtures/reject/src/lib.rs:140:2 | +| 2 | dropping `_`, which is not supported yet | `std::iter::Take` | fixtures/reject/src/lib.rs:400:79 | +| 2 | replacing the value behind a reference to `_` | `Meters` | fixtures/reject/src/lib.rs:109:2 | +| 1 | `_` is not supported yet | `std::borrow::Cow` | fixtures/reject/src/lib.rs:419:18 | | 1 | `_` is not supported: its field `_` is `_`, typed `_`, whose `None` would be `rt.None` as `_` | `Maybe`, `value`, `Option`, `T \| undefined`, `Option` | fixtures/reject/src/lib.rs:38:2 | -| 1 | `_` of `_` by `_`, which is not supported yet | `HashMap::contains_key`, `std::collections::HashMap`, `u8` | fixtures/reject/src/lib.rs:315:6 | -| 1 | `_` of `_`, which drops `_`, which is not supported yet | `into_keys`, `std::collections::HashMap`, `Noisy` | fixtures/reject/src/lib.rs:62:13 | -| 1 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | `HashMap::get`, `Option` | fixtures/reject/src/lib.rs:292:6 | -| 1 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | `Iterator::find`, `Option` | fixtures/reject/src/lib.rs:43:42 | -| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::count` | fixtures/reject/src/lib.rs:271:38 | -| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::filter` | fixtures/reject/src/lib.rs:271:16 | -| 1 | `_` through a held type's own, which is not supported yet | `::ne` | fixtures/reject/src/lib.rs:347:2 | -| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::collections::hash_map::Entry::and_modify` | fixtures/reject/src/lib.rs:442:15 | +| 1 | `_` of `_` by `_`, which is not supported yet | `HashMap::contains_key`, `std::collections::HashMap`, `u8` | fixtures/reject/src/lib.rs:320:6 | +| 1 | `_` of `_`, which drops `_`, which is not supported yet | `into_keys`, `std::collections::HashMap`, `Noisy` | fixtures/reject/src/lib.rs:67:13 | +| 1 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | `HashMap::get`, `Option` | fixtures/reject/src/lib.rs:297:6 | +| 1 | `_` of `_`, whose `None` is `rt.None`, which is not supported yet | `Iterator::find`, `Option` | fixtures/reject/src/lib.rs:48:42 | +| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::count` | fixtures/reject/src/lib.rs:276:38 | +| 1 | `_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it | `std::iter::Iterator::filter` | fixtures/reject/src/lib.rs:276:16 | +| 1 | `_` through a held type's own, which is not supported yet | `::ne` | fixtures/reject/src/lib.rs:352:2 | +| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::collections::hash_map::Entry::and_modify` | fixtures/reject/src/lib.rs:447:15 | | 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::iter::IntoIterator::into_iter` | fixtures/reject/src/lib.rs:17:2 | -| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::slice::last_mut` | fixtures/reject/src/lib.rs:435:21 | -| 1 | `_`, which is not supported yet | `Hasher::write` | fixtures/reject/src/lib.rs:323:9 | -| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | `std::iter::Flatten` | fixtures/reject/src/lib.rs:240:26 | -| 1 | a `_` cast from `_` to `_` | `IntToFloat`, `u64`, `f64` | fixtures/reject/src/lib.rs:115:2 | -| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | `std::iter::Map`, `std::ops::Range` | fixtures/reject/src/lib.rs:245:30 | -| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | `std::iter::Chain` | fixtures/reject/src/lib.rs:191:51 | -| 1 | a coercion to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:370:2 | -| 1 | a constant of type `_` | `&u8` | fixtures/reject/src/lib.rs:99:2 | -| 1 | a field of `_` | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:287:48 | -| 1 | a field of `_` | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:287:7 | -| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | `u32` | fixtures/reject/src/lib.rs:250:13 | +| 1 | `_` with a mutable reference to a value JS copies, which its mapping would copy | `std::slice::last_mut` | fixtures/reject/src/lib.rs:440:21 | +| 1 | `_`, which is not supported yet | `Hasher::write` | fixtures/reject/src/lib.rs:328:9 | +| 1 | `fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet | `std::iter::Flatten` | fixtures/reject/src/lib.rs:245:26 | +| 1 | a `_` cast from `_` to `_` | `IntToFloat`, `u64`, `f64` | fixtures/reject/src/lib.rs:120:2 | +| 1 | a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet | `std::iter::Map`, `std::ops::Range` | fixtures/reject/src/lib.rs:250:30 | +| 1 | a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` | `std::iter::Chain` | fixtures/reject/src/lib.rs:196:51 | +| 1 | a coercion to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:375:2 | +| 1 | a constant of type `_` | `&u8` | fixtures/reject/src/lib.rs:104:2 | +| 1 | a field of `_` | `std::ops::RangeFrom` | fixtures/reject/src/lib.rs:292:48 | +| 1 | a field of `_` | `std::ops::RangeTo` | fixtures/reject/src/lib.rs:292:7 | +| 1 | a mutable borrow of a subslice of `_`, which JS would copy, having no views | `u32` | fixtures/reject/src/lib.rs:255:13 | | 1 | a scalar constant of type `_` | `f64` | fixtures/reject/src/lib.rs:8:2 | -| 1 | a zero-sized constant of type `_` | `{async closure}` | fixtures/reject/src/lib.rs:71:2 | -| 1 | an assignment through a reference to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:120:2 | -| 1 | an assignment through a reference to `_` | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:140:2 | -| 1 | an iterator of the crate implementing `_`, which is not supported yet | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:178:1 | -| 1 | an iterator of the crate implementing `_`, which is not supported yet | `FusedIterator` | fixtures/reject/src/lib.rs:232:1 | -| 1 | an iterator that owns `_`, which drops, which is not supported yet | `Noisy` | fixtures/reject/src/lib.rs:397:13 | +| 1 | a zero-sized constant of type `_` | `{async closure}` | fixtures/reject/src/lib.rs:76:2 | +| 1 | an assignment through a reference to `_` | `std::sync::Arc` | fixtures/reject/src/lib.rs:125:2 | +| 1 | an assignment through a reference to `_` | `std::sync::MutexGuard` | fixtures/reject/src/lib.rs:145:2 | +| 1 | an iterator of the crate implementing `_`, which is not supported yet | `DoubleEndedIterator` | fixtures/reject/src/lib.rs:183:1 | +| 1 | an iterator of the crate implementing `_`, which is not supported yet | `FusedIterator` | fixtures/reject/src/lib.rs:237:1 | +| 1 | an iterator that owns `_`, which drops, which is not supported yet | `Noisy` | fixtures/reject/src/lib.rs:402:13 | | 1 | arithmetic on `_` | `f64` | fixtures/reject/src/lib.rs:8:2 | -| 1 | comparing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:297:52 | -| 1 | constructing `_` | `std::borrow::Cow` | fixtures/reject/src/lib.rs:421:53 | -| 1 | constructing `_` from another crate | `std::iter::Map` | fixtures/reject/src/lib.rs:164:23 | -| 1 | constructing `_` from another crate | `std::iter::Rev` | fixtures/reject/src/lib.rs:185:14 | -| 1 | dropping `_`, which is not supported yet | `std::iter::Map` | fixtures/reject/src/lib.rs:56:18 | -| 1 | hashing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:297:52 | -| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::fold` | fixtures/reject/src/lib.rs:158:2 | -| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::size_hint` | fixtures/reject/src/lib.rs:212:2 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Entry::or_insert_with` | fixtures/reject/src/lib.rs:386:13 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::any` | fixtures/reject/src/lib.rs:387:11 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::map` | fixtures/reject/src/lib.rs:56:11 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `from_fn::from_fn` | fixtures/reject/src/lib.rs:396:13 | -| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `successors::successors` | fixtures/reject/src/lib.rs:395:15 | -| 1 | replacing the value behind a reference to `_` | `[u16; 1]` | fixtures/reject/src/lib.rs:264:22 | -| 1 | unsupported call to `_` | `::deref` | fixtures/reject/src/lib.rs:415:2 | -| 1 | unsupported call to `_` | `::eq` | fixtures/reject/src/lib.rs:459:2 | -| 1 | unsupported call to `_` | `::cycle` | fixtures/reject/src/lib.rs:145:11 | -| 1 | unsupported call to `_` | `::write_fmt` | fixtures/reject/src/lib.rs:93:10 | -| 1 | unsupported call to `_` | `::add_assign` | fixtures/reject/src/lib.rs:429:2 | -| 1 | unsupported call to `_` | `std::mem::size_of_val` | fixtures/reject/src/lib.rs:55:29 | -| 1 | unsupported call to `_` | `std::ops::Range::contains` | fixtures/reject/src/lib.rs:199:8 | -| 1 | unsupported call to `_` | `std::slice::copy_within` | fixtures/reject/src/lib.rs:365:4 | +| 1 | collecting `_`, whose `None` is `rt.None`, which is not supported yet | `Option` | fixtures/reject/src/lib.rs:43:43 | +| 1 | comparing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:302:52 | +| 1 | constructing `_` | `std::borrow::Cow` | fixtures/reject/src/lib.rs:426:53 | +| 1 | constructing `_` from another crate | `std::iter::Map` | fixtures/reject/src/lib.rs:169:23 | +| 1 | constructing `_` from another crate | `std::iter::Rev` | fixtures/reject/src/lib.rs:190:14 | +| 1 | dropping `_`, which is not supported yet | `std::iter::Map` | fixtures/reject/src/lib.rs:61:18 | +| 1 | hashing `_` as a key, which is not supported yet | `std::vec::Vec` | fixtures/reject/src/lib.rs:302:52 | +| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::fold` | fixtures/reject/src/lib.rs:163:2 | +| 1 | overriding `_`, which std's adaptors call in place of `next` or beside it | `Iterator::size_hint` | fixtures/reject/src/lib.rs:217:2 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Entry::or_insert_with` | fixtures/reject/src/lib.rs:391:13 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::any` | fixtures/reject/src/lib.rs:392:11 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `Iterator::map` | fixtures/reject/src/lib.rs:61:11 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `from_fn::from_fn` | fixtures/reject/src/lib.rs:401:13 | +| 1 | passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet | `{closure}`, `successors::successors` | fixtures/reject/src/lib.rs:400:15 | +| 1 | replacing the value behind a reference to `_` | `[u16; 1]` | fixtures/reject/src/lib.rs:269:22 | +| 1 | unsupported call to `_` | `::deref` | fixtures/reject/src/lib.rs:420:2 | +| 1 | unsupported call to `_` | `::eq` | fixtures/reject/src/lib.rs:464:2 | +| 1 | unsupported call to `_` | `::cycle` | fixtures/reject/src/lib.rs:150:11 | +| 1 | unsupported call to `_` | `::write_fmt` | fixtures/reject/src/lib.rs:98:10 | +| 1 | unsupported call to `_` | `::add_assign` | fixtures/reject/src/lib.rs:434:2 | +| 1 | unsupported call to `_` | `std::mem::size_of_val` | fixtures/reject/src/lib.rs:60:29 | +| 1 | unsupported call to `_` | `std::ops::Range::contains` | fixtures/reject/src/lib.rs:204:8 | +| 1 | unsupported call to `_` | `std::slice::copy_within` | fixtures/reject/src/lib.rs:370:4 | | 1 | unsupported call to `_` | `std::slice::sort` | fixtures/reject/src/lib.rs:28:4 | -| 1 | unsupported call to `_` | `std::str::split` | fixtures/reject/src/lib.rs:376:4 | +| 1 | unsupported call to `_` | `std::str::split` | fixtures/reject/src/lib.rs:381:4 | | 1 | unsupported type `_` | `dyn std::ops::Fn(u8) -> u8` | fixtures/reject/src/lib.rs:11:16 | ## Spans @@ -185,43 +187,43 @@ The type or module each refused type or path belongs to.
unsupported call to `_` (10) - fixtures/reject/src/lib.rs:28:4: unsupported call to `std::slice::::sort` -- fixtures/reject/src/lib.rs:55:29: unsupported call to `std::mem::size_of_val::` -- fixtures/reject/src/lib.rs:93:10: unsupported call to `::write_fmt` -- fixtures/reject/src/lib.rs:145:11: unsupported call to ` as std::iter::Iterator>::cycle` -- fixtures/reject/src/lib.rs:199:8: unsupported call to `std::ops::Range::::contains::` -- fixtures/reject/src/lib.rs:365:4: unsupported call to `core::slice::::copy_within::>` -- fixtures/reject/src/lib.rs:376:4: unsupported call to `core::str::::split::<[char; 2]>` -- fixtures/reject/src/lib.rs:415:2: unsupported call to ` as std::ops::Deref>::deref` -- fixtures/reject/src/lib.rs:429:2: unsupported call to `::add_assign` -- fixtures/reject/src/lib.rs:459:2: unsupported call to ` as std::cmp::PartialEq>::eq` +- fixtures/reject/src/lib.rs:60:29: unsupported call to `std::mem::size_of_val::` +- fixtures/reject/src/lib.rs:98:10: unsupported call to `::write_fmt` +- fixtures/reject/src/lib.rs:150:11: unsupported call to ` as std::iter::Iterator>::cycle` +- fixtures/reject/src/lib.rs:204:8: unsupported call to `std::ops::Range::::contains::` +- fixtures/reject/src/lib.rs:370:4: unsupported call to `core::slice::::copy_within::>` +- fixtures/reject/src/lib.rs:381:4: unsupported call to `core::str::::split::<[char; 2]>` +- fixtures/reject/src/lib.rs:420:2: unsupported call to ` as std::ops::Deref>::deref` +- fixtures/reject/src/lib.rs:434:2: unsupported call to `::add_assign` +- fixtures/reject/src/lib.rs:464:2: unsupported call to ` as std::cmp::PartialEq>::eq`
passing `_`, a closure that owns a value that drops, to `_`, which is not supported yet (5) -- fixtures/reject/src/lib.rs:56:11: passing `{closure@fixtures/reject/src/lib.rs:55:10: 55:23}`, a closure that owns a value that drops, to `Iterator::map`, which is not supported yet -- fixtures/reject/src/lib.rs:386:13: passing `{closure@fixtures/reject/src/lib.rs:386:28: 386:35}`, a closure that owns a value that drops, to `Entry::or_insert_with`, which is not supported yet -- fixtures/reject/src/lib.rs:387:11: passing `{closure@fixtures/reject/src/lib.rs:387:15: 387:24}`, a closure that owns a value that drops, to `Iterator::any`, which is not supported yet -- fixtures/reject/src/lib.rs:395:15: passing `{closure@fixtures/reject/src/lib.rs:395:48: 395:56}`, a closure that owns a value that drops, to `successors::successors`, which is not supported yet -- fixtures/reject/src/lib.rs:396:13: passing `{closure@fixtures/reject/src/lib.rs:396:32: 396:39}`, a closure that owns a value that drops, to `from_fn::from_fn`, which is not supported yet +- fixtures/reject/src/lib.rs:61:11: passing `{closure@fixtures/reject/src/lib.rs:60:10: 60:23}`, a closure that owns a value that drops, to `Iterator::map`, which is not supported yet +- fixtures/reject/src/lib.rs:391:13: passing `{closure@fixtures/reject/src/lib.rs:391:28: 391:35}`, a closure that owns a value that drops, to `Entry::or_insert_with`, which is not supported yet +- fixtures/reject/src/lib.rs:392:11: passing `{closure@fixtures/reject/src/lib.rs:392:15: 392:24}`, a closure that owns a value that drops, to `Iterator::any`, which is not supported yet +- fixtures/reject/src/lib.rs:400:15: passing `{closure@fixtures/reject/src/lib.rs:400:48: 400:56}`, a closure that owns a value that drops, to `successors::successors`, which is not supported yet +- fixtures/reject/src/lib.rs:401:13: passing `{closure@fixtures/reject/src/lib.rs:401:32: 401:39}`, a closure that owns a value that drops, to `from_fn::from_fn`, which is not supported yet
a variant of `_`, which is not supported: either is the same JS string (4) -- fixtures/reject/src/lib.rs:403:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string -- fixtures/reject/src/lib.rs:404:30: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string -- fixtures/reject/src/lib.rs:405:27: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string -- fixtures/reject/src/lib.rs:410:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:408:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:409:30: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:410:27: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string +- fixtures/reject/src/lib.rs:415:2: a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string
an assignment through a reference to `_` (4) -- fixtures/reject/src/lib.rs:120:2: an assignment through a reference to `std::sync::Arc` -- fixtures/reject/src/lib.rs:135:2: an assignment through a reference to `std::pin::Pin>` -- fixtures/reject/src/lib.rs:140:2: an assignment through a reference to `std::sync::MutexGuard<'_, u8>` -- fixtures/reject/src/lib.rs:258:2: an assignment through a reference to `std::pin::Pin<&mut Noisy>` +- fixtures/reject/src/lib.rs:125:2: an assignment through a reference to `std::sync::Arc` +- fixtures/reject/src/lib.rs:140:2: an assignment through a reference to `std::pin::Pin>` +- fixtures/reject/src/lib.rs:145:2: an assignment through a reference to `std::sync::MutexGuard<'_, u8>` +- fixtures/reject/src/lib.rs:263:2: an assignment through a reference to `std::pin::Pin<&mut Noisy>`
@@ -230,38 +232,38 @@ The type or module each refused type or path belongs to. - fixtures/reject/src/lib.rs:7:14: unsupported type `f64` - fixtures/reject/src/lib.rs:7:25: unsupported type `f64` - fixtures/reject/src/lib.rs:11:16: unsupported type `dyn std::ops::Fn(u8) -> u8` -- fixtures/reject/src/lib.rs:113:51: unsupported type `f64` +- fixtures/reject/src/lib.rs:118:51: unsupported type `f64`
`_` with a mutable reference to a value JS copies, which its mapping would copy (3) - fixtures/reject/src/lib.rs:17:2: `std::iter::IntoIterator::into_iter` with a mutable reference to a value JS copies, which its mapping would copy -- fixtures/reject/src/lib.rs:435:21: `core::slice::::last_mut` with a mutable reference to a value JS copies, which its mapping would copy -- fixtures/reject/src/lib.rs:442:15: `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 +- fixtures/reject/src/lib.rs:440:21: `core::slice::::last_mut` with a mutable reference to a value JS copies, which its mapping would copy +- fixtures/reject/src/lib.rs:447:15: `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
dropping `_`, which is not supported yet (3) -- fixtures/reject/src/lib.rs:56:18: dropping `std::iter::Map, {closure@fixtures/reject/src/lib.rs:55:10: 55:23}>`, which is not supported yet -- fixtures/reject/src/lib.rs:395:79: dropping `std::iter::Take>`, which is not supported yet -- fixtures/reject/src/lib.rs:396:62: dropping `std::iter::Take>`, which is not supported yet +- fixtures/reject/src/lib.rs:61:18: dropping `std::iter::Map, {closure@fixtures/reject/src/lib.rs:60:10: 60:23}>`, which is not supported yet +- fixtures/reject/src/lib.rs:400:79: dropping `std::iter::Take>`, which is not supported yet +- fixtures/reject/src/lib.rs:401:62: dropping `std::iter::Take>`, which is not supported yet
replacing the value behind a reference to `_` (3) -- fixtures/reject/src/lib.rs:104:2: replacing the value behind a reference to `Meters` -- fixtures/reject/src/lib.rs:108:2: replacing the value behind a reference to `Meters` -- fixtures/reject/src/lib.rs:264:22: replacing the value behind a reference to `[u16; 1]` +- fixtures/reject/src/lib.rs:109:2: replacing the value behind a reference to `Meters` +- fixtures/reject/src/lib.rs:113:2: replacing the value behind a reference to `Meters` +- fixtures/reject/src/lib.rs:269:22: replacing the value behind a reference to `[u16; 1]`
`_` is not supported: it would be pending two ways with one value (2) -- fixtures/reject/src/lib.rs:124:20: `Poll>>` is not supported: it would be pending two ways with one value -- fixtures/reject/src/lib.rs:129:54: `Poll>` is not supported: it would be pending two ways with one value +- fixtures/reject/src/lib.rs:129:20: `Poll>>` is not supported: it would be pending two ways with one value +- fixtures/reject/src/lib.rs:134:54: `Poll>` is not supported: it would be pending two ways with one value
@@ -274,73 +276,73 @@ The type or module each refused type or path belongs to.
`_` of `_`, whose `None` is `rt.None`, which is not supported yet (2) -- fixtures/reject/src/lib.rs:43:42: `Iterator::find` of `Option>`, whose `None` is `rt.None`, which is not supported yet -- fixtures/reject/src/lib.rs:292:6: `HashMap::get` of `Option<&std::option::Option>`, whose `None` is `rt.None`, which is not supported yet +- fixtures/reject/src/lib.rs:48:42: `Iterator::find` of `Option>`, whose `None` is `rt.None`, which is not supported yet +- fixtures/reject/src/lib.rs:297:6: `HashMap::get` of `Option<&std::option::Option>`, whose `None` is `rt.None`, which is not supported yet
`_` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it (2) -- fixtures/reject/src/lib.rs:271:16: `std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it -- fixtures/reject/src/lib.rs:271:38: `std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it +- fixtures/reject/src/lib.rs:276:16: `std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it +- fixtures/reject/src/lib.rs:276:38: `std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it
a field of `_` (2) -- fixtures/reject/src/lib.rs:287:7: a field of `std::ops::RangeTo` -- fixtures/reject/src/lib.rs:287:48: a field of `std::ops::RangeFrom` +- fixtures/reject/src/lib.rs:292:7: a field of `std::ops::RangeTo` +- fixtures/reject/src/lib.rs:292:48: a field of `std::ops::RangeFrom`
an iterator of the crate implementing `_`, which is not supported yet (2) -- fixtures/reject/src/lib.rs:178:1: an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet -- fixtures/reject/src/lib.rs:232:1: an iterator of the crate implementing `FusedIterator`, which is not supported yet +- fixtures/reject/src/lib.rs:183:1: an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet +- fixtures/reject/src/lib.rs:237:1: an iterator of the crate implementing `FusedIterator`, which is not supported yet
constructing `_` from another crate (2) -- fixtures/reject/src/lib.rs:164:23: constructing `std::iter::Map` from another crate -- fixtures/reject/src/lib.rs:185:14: constructing `std::iter::Rev` from another crate +- fixtures/reject/src/lib.rs:169:23: constructing `std::iter::Map` from another crate +- fixtures/reject/src/lib.rs:190:14: constructing `std::iter::Rev` from another crate
overriding `_`, which std's adaptors call in place of `next` or beside it (2) -- fixtures/reject/src/lib.rs:158:2: overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it -- fixtures/reject/src/lib.rs:212:2: overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it +- fixtures/reject/src/lib.rs:163:2: overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it +- fixtures/reject/src/lib.rs:217:2: overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it
`Binary` formatting, as in `{:b}`, is not supported (1) -- fixtures/reject/src/lib.rs:81:3: `Binary` formatting, as in `{:b}`, is not supported +- fixtures/reject/src/lib.rs:86:3: `Binary` formatting, as in `{:b}`, is not supported
`LowerExp` formatting, as in `{:e}`, is not supported (1) -- fixtures/reject/src/lib.rs:83:3: `LowerExp` formatting, as in `{:e}`, is not supported +- fixtures/reject/src/lib.rs:88:3: `LowerExp` formatting, as in `{:e}`, is not supported
`Octal` formatting, as in `{:o}`, is not supported (1) -- fixtures/reject/src/lib.rs:82:3: `Octal` formatting, as in `{:o}`, is not supported +- fixtures/reject/src/lib.rs:87:3: `Octal` formatting, as in `{:o}`, is not supported
`Pointer` formatting, as in `{:p}`, is not supported (1) -- fixtures/reject/src/lib.rs:86:3: `Pointer` formatting, as in `{:p}`, is not supported +- fixtures/reject/src/lib.rs:91:3: `Pointer` formatting, as in `{:p}`, is not supported
`_` is not supported yet (1) -- fixtures/reject/src/lib.rs:414:18: `std::borrow::Cow<'_, [u8]>` is not supported yet +- fixtures/reject/src/lib.rs:419:18: `std::borrow::Cow<'_, [u8]>` is not supported yet
@@ -352,91 +354,91 @@ The type or module each refused type or path belongs to.
`_` of `_` by `_`, which is not supported yet (1) -- fixtures/reject/src/lib.rs:315:6: `HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet +- fixtures/reject/src/lib.rs:320:6: `HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet
`_` of `_`, which drops `_`, which is not supported yet (1) -- fixtures/reject/src/lib.rs:62:13: `into_keys` of `std::collections::HashMap`, which drops `Noisy`, which is not supported yet +- fixtures/reject/src/lib.rs:67:13: `into_keys` of `std::collections::HashMap`, which drops `Noisy`, which is not supported yet
`_` through a held type's own, which is not supported yet (1) -- fixtures/reject/src/lib.rs:347:2: ` as PartialEq>::ne` through a held type's own, which is not supported yet +- fixtures/reject/src/lib.rs:352:2: ` as PartialEq>::ne` through a held type's own, which is not supported yet
`_`, which is not supported yet (1) -- fixtures/reject/src/lib.rs:323:9: `Hasher::write`, which is not supported yet +- fixtures/reject/src/lib.rs:328:9: `Hasher::write`, which is not supported yet
`fold` of `_`, which folds a `flatten` whose source and iterators both drop, which is not supported yet (1) -- fixtures/reject/src/lib.rs:240:26: `fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet +- fixtures/reject/src/lib.rs:245:26: `fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet
a `_` cast from `_` to `_` (1) -- fixtures/reject/src/lib.rs:115:2: a `IntToFloat` cast from `u64` to `f64` +- fixtures/reject/src/lib.rs:120:2: a `IntToFloat` cast from `u64` to `f64`
a `zip` of `_` and `_`, which std reads by index, of items that drop, which is not supported yet (1) -- fixtures/reject/src/lib.rs:245:30: a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:245:15: 245:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet +- fixtures/reject/src/lib.rs:250:30: a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:250:15: 250:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet
a `zip` of `_`, whose closures std calls one item further through `next` than through `fold` (1) -- fixtures/reject/src/lib.rs:191:51: a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:191:15: 191:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold` +- fixtures/reject/src/lib.rs:196:51: a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:196:15: 196:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold`
a coercion to `_` (1) -- fixtures/reject/src/lib.rs:370:2: a coercion to `std::sync::Arc<[u8]>` +- fixtures/reject/src/lib.rs:375:2: a coercion to `std::sync::Arc<[u8]>`
a constant of type `_` (1) -- fixtures/reject/src/lib.rs:99:2: a constant of type `&u8` +- fixtures/reject/src/lib.rs:104:2: a constant of type `&u8`
a copy of a closure that changes what it captured (1) -- fixtures/reject/src/lib.rs:281:14: a copy of a closure that changes what it captured +- fixtures/reject/src/lib.rs:286:14: a copy of a closure that changes what it captured
a mutable borrow of a subslice of `_`, which JS would copy, having no views (1) -- fixtures/reject/src/lib.rs:250:13: a mutable borrow of a subslice of `u32`, which JS would copy, having no views +- fixtures/reject/src/lib.rs:255:13: a mutable borrow of a subslice of `u32`, which JS would copy, having no views
a mutable reference into a `Result`'s payload, passed on or kept (1) -- fixtures/reject/src/lib.rs:452:12: a mutable reference into a `Result`'s payload, passed on or kept +- fixtures/reject/src/lib.rs:457:12: a mutable reference into a `Result`'s payload, passed on or kept
a precision, as in `{:.2}`, is not supported (1) -- fixtures/reject/src/lib.rs:78:3: a precision, as in `{:.2}`, is not supported +- fixtures/reject/src/lib.rs:83:3: a precision, as in `{:.2}`, is not supported
a printable type must implement `Display` or `Debug` (1) -- fixtures/reject/src/lib.rs:111:1: a printable type must implement `Display` or `Debug` +- fixtures/reject/src/lib.rs:116:1: a printable type must implement `Display` or `Debug`
@@ -448,19 +450,19 @@ The type or module each refused type or path belongs to.
a width or precision from an argument, as in `{:1$}`, is not supported (1) -- fixtures/reject/src/lib.rs:85:3: a width or precision from an argument, as in `{:1$}`, is not supported +- fixtures/reject/src/lib.rs:90:3: a width or precision from an argument, as in `{:1$}`, is not supported
a zero-sized constant of type `_` (1) -- fixtures/reject/src/lib.rs:71:2: a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:70:10: 70:18}` +- fixtures/reject/src/lib.rs:76:2: a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:75:10: 75:18}`
an iterator that owns `_`, which drops, which is not supported yet (1) -- fixtures/reject/src/lib.rs:397:13: an iterator that owns `Noisy`, which drops, which is not supported yet +- fixtures/reject/src/lib.rs:402:13: an iterator that owns `Noisy`, which drops, which is not supported yet
@@ -470,38 +472,44 @@ The type or module each refused type or path belongs to.
+
collecting `_`, whose `None` is `rt.None`, which is not supported yet (1) + +- fixtures/reject/src/lib.rs:43:43: collecting `Option<()>`, whose `None` is `rt.None`, which is not supported yet + +
+
comparing `_` as a key, which is not supported yet (1) -- fixtures/reject/src/lib.rs:297:52: comparing `std::vec::Vec` as a key, which is not supported yet +- fixtures/reject/src/lib.rs:302:52: comparing `std::vec::Vec` as a key, which is not supported yet
constructing `_` (1) -- fixtures/reject/src/lib.rs:421:53: constructing `std::borrow::Cow<'_, std::sync::Arc>` +- fixtures/reject/src/lib.rs:426:53: constructing `std::borrow::Cow<'_, std::sync::Arc>`
hashing `_` as a key, which is not supported yet (1) -- fixtures/reject/src/lib.rs:297:52: hashing `std::vec::Vec` as a key, which is not supported yet +- fixtures/reject/src/lib.rs:302:52: hashing `std::vec::Vec` as a key, which is not supported yet
hex `Debug`, as in `{:x?}`, is not supported (1) -- fixtures/reject/src/lib.rs:84:3: hex `Debug`, as in `{:x?}`, is not supported +- fixtures/reject/src/lib.rs:89:3: hex `Debug`, as in `{:x?}`, is not supported
the `+` flag of a format spec is not supported (1) -- fixtures/reject/src/lib.rs:79:3: the `+` flag of a format spec is not supported +- fixtures/reject/src/lib.rs:84:3: the `+` flag of a format spec is not supported
the `-` flag of a format spec is not supported (1) -- fixtures/reject/src/lib.rs:80:3: the `-` flag of a format spec is not supported +- fixtures/reject/src/lib.rs:85:3: the `-` flag of a format spec is not supported
diff --git a/ts/fixtures/reject/expected.txt b/ts/fixtures/reject/expected.txt index f79b29254..913c17d96 100644 --- a/ts/fixtures/reject/expected.txt +++ b/ts/fixtures/reject/expected.txt @@ -1,6 +1,6 @@ -a root must not be generic at fixtures/reject/src/lib.rs:113:1 +a root must not be generic at fixtures/reject/src/lib.rs:118:1 no item `missing` in the crate -a printable type must implement `Display` or `Debug` at fixtures/reject/src/lib.rs:111:1 +a printable type must implement `Display` or `Debug` at fixtures/reject/src/lib.rs:116:1 unsupported type `f64` at fixtures/reject/src/lib.rs:7:14 a scalar constant of type `f64` at fixtures/reject/src/lib.rs:8:2 arithmetic on `f64` at fixtures/reject/src/lib.rs:8:2 @@ -10,75 +10,76 @@ unsupported type `dyn std::ops::Fn(u8) -> u8` at fixtures/reject/src/lib.rs:11:1 `Option>>` is not supported: its `None` and `Some` would both be `rt.None` at fixtures/reject/src/lib.rs:24:2 `Option>>` is not supported: its `None` and `Some` would both be `rt.None` at fixtures/reject/src/lib.rs:23:15 unsupported call to `std::slice::::sort` at fixtures/reject/src/lib.rs:28:4 -`Iterator::find` of `Option>`, whose `None` is `rt.None`, which is not supported yet at fixtures/reject/src/lib.rs:43:42 +`Iterator::find` of `Option>`, whose `None` is `rt.None`, which is not supported yet at fixtures/reject/src/lib.rs:48:42 `Maybe<()>` is not supported: its field `value` is `Option`, typed `T | undefined`, whose `None` would be `rt.None` as `Option<()>` at fixtures/reject/src/lib.rs:38:2 -unsupported call to `std::mem::size_of_val::` at fixtures/reject/src/lib.rs:55:29 -passing `{closure@fixtures/reject/src/lib.rs:55:10: 55:23}`, a closure that owns a value that drops, to `Iterator::map`, which is not supported yet at fixtures/reject/src/lib.rs:56:11 -dropping `std::iter::Map, {closure@fixtures/reject/src/lib.rs:55:10: 55:23}>`, which is not supported yet at fixtures/reject/src/lib.rs:56:18 -`into_keys` of `std::collections::HashMap`, which drops `Noisy`, which is not supported yet at fixtures/reject/src/lib.rs:62:13 -a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:70:10: 70:18}` at fixtures/reject/src/lib.rs:71:2 -a precision, as in `{:.2}`, is not supported at fixtures/reject/src/lib.rs:78:3 -the `+` flag of a format spec is not supported at fixtures/reject/src/lib.rs:79:3 -the `-` flag of a format spec is not supported at fixtures/reject/src/lib.rs:80:3 -`Binary` formatting, as in `{:b}`, is not supported at fixtures/reject/src/lib.rs:81:12 -`Octal` formatting, as in `{:o}`, is not supported at fixtures/reject/src/lib.rs:82:12 -`LowerExp` formatting, as in `{:e}`, is not supported at fixtures/reject/src/lib.rs:83:12 -hex `Debug`, as in `{:x?}`, is not supported at fixtures/reject/src/lib.rs:84:3 -a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:85:15 -a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:85:3 -`Pointer` formatting, as in `{:p}`, is not supported at fixtures/reject/src/lib.rs:86:12 -unsupported call to `::write_fmt` at fixtures/reject/src/lib.rs:93:10 -a constant of type `&u8` at fixtures/reject/src/lib.rs:99:2 -replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:104:2 -replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:108:2 -an assignment through a reference to `std::sync::Arc` at fixtures/reject/src/lib.rs:120:2 -`Poll>>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:124:20 -`Poll>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:129:54 -an assignment through a reference to `std::pin::Pin>` at fixtures/reject/src/lib.rs:135:2 -an assignment through a reference to `std::sync::MutexGuard<'_, u8>` at fixtures/reject/src/lib.rs:140:2 -unsupported call to ` as std::iter::Iterator>::cycle` at fixtures/reject/src/lib.rs:145:11 -constructing `std::iter::Map` from another crate at fixtures/reject/src/lib.rs:164:23 -constructing `std::iter::Rev` from another crate at fixtures/reject/src/lib.rs:185:14 -a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:191:15: 191:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold` at fixtures/reject/src/lib.rs:191:51 -unsupported call to `std::ops::Range::::contains::` at fixtures/reject/src/lib.rs:199:8 -`fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet at fixtures/reject/src/lib.rs:240:26 -a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:245:15: 245:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet at fixtures/reject/src/lib.rs:245:30 -a mutable borrow of a subslice of `u32`, which JS would copy, having no views at fixtures/reject/src/lib.rs:250:13 -an assignment through a reference to `std::pin::Pin<&mut Noisy>` at fixtures/reject/src/lib.rs:258:2 -replacing the value behind a reference to `[u16; 1]` at fixtures/reject/src/lib.rs:264:22 -`std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:271:16 -`std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:271:38 -a copy of a closure that changes what it captured at fixtures/reject/src/lib.rs:281:14 -a field of `std::ops::RangeTo` at fixtures/reject/src/lib.rs:287:7 -a field of `std::ops::RangeFrom` at fixtures/reject/src/lib.rs:287:48 -`HashMap::get` of `Option<&std::option::Option>`, whose `None` is `rt.None`, which is not supported yet at fixtures/reject/src/lib.rs:292:6 -hashing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:297:52 -comparing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:297:52 -`HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet at fixtures/reject/src/lib.rs:315:6 -unsupported call to `core::slice::::copy_within::>` at fixtures/reject/src/lib.rs:365:4 -a coercion to `std::sync::Arc<[u8]>` at fixtures/reject/src/lib.rs:370:2 -a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:403:2 -a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:405:27 -a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:404:30 -a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:410:2 -`std::borrow::Cow<'_, [u8]>` is not supported yet at fixtures/reject/src/lib.rs:414:18 -unsupported call to ` as std::ops::Deref>::deref` at fixtures/reject/src/lib.rs:415:2 -constructing `std::borrow::Cow<'_, std::sync::Arc>` at fixtures/reject/src/lib.rs:421:53 -unsupported call to `core::str::::split::<[char; 2]>` at fixtures/reject/src/lib.rs:376:4 -passing `{closure@fixtures/reject/src/lib.rs:386:28: 386: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:386:13 -passing `{closure@fixtures/reject/src/lib.rs:387:15: 387:24}`, a closure that owns a value that drops, to `Iterator::any`, which is not supported yet at fixtures/reject/src/lib.rs:387:11 -passing `{closure@fixtures/reject/src/lib.rs:395:48: 395:56}`, a closure that owns a value that drops, to `successors::successors`, which is not supported yet at fixtures/reject/src/lib.rs:395:15 -dropping `std::iter::Take>`, which is not supported yet at fixtures/reject/src/lib.rs:395:79 -passing `{closure@fixtures/reject/src/lib.rs:396:32: 396: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:396:13 -dropping `std::iter::Take>`, which is not supported yet at fixtures/reject/src/lib.rs:396:62 -an iterator that owns `Noisy`, which drops, which is not supported yet at fixtures/reject/src/lib.rs:397:13 -unsupported call to `::add_assign` at fixtures/reject/src/lib.rs:429:2 -`core::slice::::last_mut` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:435: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:442:15 -a mutable reference into a `Result`'s payload, passed on or kept at fixtures/reject/src/lib.rs:452:12 -unsupported call to ` as std::cmp::PartialEq>::eq` at fixtures/reject/src/lib.rs:459:2 -overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:158:2 -an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:178:1 -overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:212:2 -an iterator of the crate implementing `FusedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:232:1 -`Hasher::write`, which is not supported yet at fixtures/reject/src/lib.rs:323:9 +collecting `Option<()>`, whose `None` is `rt.None`, which is not supported yet at fixtures/reject/src/lib.rs:43:43 +unsupported call to `std::mem::size_of_val::` at fixtures/reject/src/lib.rs:60:29 +passing `{closure@fixtures/reject/src/lib.rs:60:10: 60:23}`, a closure that owns a value that drops, to `Iterator::map`, which is not supported yet at fixtures/reject/src/lib.rs:61:11 +dropping `std::iter::Map, {closure@fixtures/reject/src/lib.rs:60:10: 60:23}>`, which is not supported yet at fixtures/reject/src/lib.rs:61:18 +`into_keys` of `std::collections::HashMap`, which drops `Noisy`, which is not supported yet at fixtures/reject/src/lib.rs:67:13 +a zero-sized constant of type `{async closure@fixtures/reject/src/lib.rs:75:10: 75:18}` at fixtures/reject/src/lib.rs:76:2 +a precision, as in `{:.2}`, is not supported at fixtures/reject/src/lib.rs:83:3 +the `+` flag of a format spec is not supported at fixtures/reject/src/lib.rs:84:3 +the `-` flag of a format spec is not supported at fixtures/reject/src/lib.rs:85:3 +`Binary` formatting, as in `{:b}`, is not supported at fixtures/reject/src/lib.rs:86:12 +`Octal` formatting, as in `{:o}`, is not supported at fixtures/reject/src/lib.rs:87:12 +`LowerExp` formatting, as in `{:e}`, is not supported at fixtures/reject/src/lib.rs:88:12 +hex `Debug`, as in `{:x?}`, is not supported at fixtures/reject/src/lib.rs:89:3 +a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:90:15 +a width or precision from an argument, as in `{:1$}`, is not supported at fixtures/reject/src/lib.rs:90:3 +`Pointer` formatting, as in `{:p}`, is not supported at fixtures/reject/src/lib.rs:91:12 +unsupported call to `::write_fmt` at fixtures/reject/src/lib.rs:98:10 +a constant of type `&u8` at fixtures/reject/src/lib.rs:104:2 +replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:109:2 +replacing the value behind a reference to `Meters` at fixtures/reject/src/lib.rs:113:2 +an assignment through a reference to `std::sync::Arc` at fixtures/reject/src/lib.rs:125:2 +`Poll>>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:129:20 +`Poll>` is not supported: it would be pending two ways with one value at fixtures/reject/src/lib.rs:134:54 +an assignment through a reference to `std::pin::Pin>` at fixtures/reject/src/lib.rs:140:2 +an assignment through a reference to `std::sync::MutexGuard<'_, u8>` at fixtures/reject/src/lib.rs:145:2 +unsupported call to ` as std::iter::Iterator>::cycle` at fixtures/reject/src/lib.rs:150:11 +constructing `std::iter::Map` from another crate at fixtures/reject/src/lib.rs:169:23 +constructing `std::iter::Rev` from another crate at fixtures/reject/src/lib.rs:190:14 +a `zip` of `std::iter::Chain, {closure@fixtures/reject/src/lib.rs:196:15: 196:18}>, std::iter::Copied>>`, whose closures std calls one item further through `next` than through `fold` at fixtures/reject/src/lib.rs:196:51 +unsupported call to `std::ops::Range::::contains::` at fixtures/reject/src/lib.rs:204:8 +`fold` of `std::iter::Flatten>>`, which folds a `flatten` whose source and iterators both drop, which is not supported yet at fixtures/reject/src/lib.rs:245:26 +a `zip` of `std::iter::Map, {closure@fixtures/reject/src/lib.rs:250:15: 250:19}>` and `std::ops::Range`, which std reads by index, of items that drop, which is not supported yet at fixtures/reject/src/lib.rs:250:30 +a mutable borrow of a subslice of `u32`, which JS would copy, having no views at fixtures/reject/src/lib.rs:255:13 +an assignment through a reference to `std::pin::Pin<&mut Noisy>` at fixtures/reject/src/lib.rs:263:2 +replacing the value behind a reference to `[u16; 1]` at fixtures/reject/src/lib.rs:269:22 +`std::iter::Iterator::filter` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:276:16 +`std::iter::Iterator::count` of a reference to an array of bytes it is generic over, which its mapping would take as the array, not as a slice of it at fixtures/reject/src/lib.rs:276:38 +a copy of a closure that changes what it captured at fixtures/reject/src/lib.rs:286:14 +a field of `std::ops::RangeTo` at fixtures/reject/src/lib.rs:292:7 +a field of `std::ops::RangeFrom` at fixtures/reject/src/lib.rs:292:48 +`HashMap::get` of `Option<&std::option::Option>`, whose `None` is `rt.None`, which is not supported yet at fixtures/reject/src/lib.rs:297:6 +hashing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:302:52 +comparing `std::vec::Vec` as a key, which is not supported yet at fixtures/reject/src/lib.rs:302:52 +`HashMap::contains_key` of `std::collections::HashMap` by `u8`, which is not supported yet at fixtures/reject/src/lib.rs:320:6 +unsupported call to `core::slice::::copy_within::>` at fixtures/reject/src/lib.rs:370:4 +a coercion to `std::sync::Arc<[u8]>` at fixtures/reject/src/lib.rs:375:2 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:408:2 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:410:27 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:409:30 +a variant of `std::borrow::Cow<'_, str>`, which is not supported: either is the same JS string at fixtures/reject/src/lib.rs:415:2 +`std::borrow::Cow<'_, [u8]>` is not supported yet at fixtures/reject/src/lib.rs:419:18 +unsupported call to ` as std::ops::Deref>::deref` at fixtures/reject/src/lib.rs:420:2 +constructing `std::borrow::Cow<'_, std::sync::Arc>` at fixtures/reject/src/lib.rs:426:53 +unsupported call to `core::str::::split::<[char; 2]>` at fixtures/reject/src/lib.rs:381:4 +passing `{closure@fixtures/reject/src/lib.rs:391:28: 391: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:391:13 +passing `{closure@fixtures/reject/src/lib.rs:392:15: 392:24}`, a closure that owns a value that drops, to `Iterator::any`, which is not supported yet at fixtures/reject/src/lib.rs:392:11 +passing `{closure@fixtures/reject/src/lib.rs:400:48: 400:56}`, a closure that owns a value that drops, to `successors::successors`, which is not supported yet at fixtures/reject/src/lib.rs:400:15 +dropping `std::iter::Take>`, which is not supported yet at fixtures/reject/src/lib.rs:400:79 +passing `{closure@fixtures/reject/src/lib.rs:401:32: 401: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:401:13 +dropping `std::iter::Take>`, which is not supported yet at fixtures/reject/src/lib.rs:401:62 +an iterator that owns `Noisy`, which drops, which is not supported yet at fixtures/reject/src/lib.rs:402:13 +unsupported call to `::add_assign` at fixtures/reject/src/lib.rs:434:2 +`core::slice::::last_mut` with a mutable reference to a value JS copies, which its mapping would copy at fixtures/reject/src/lib.rs:440: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:447:15 +a mutable reference into a `Result`'s payload, passed on or kept at fixtures/reject/src/lib.rs:457:12 +unsupported call to ` as std::cmp::PartialEq>::eq` at fixtures/reject/src/lib.rs:464:2 +overriding `Iterator::fold`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:163:2 +an iterator of the crate implementing `DoubleEndedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:183:1 +overriding `Iterator::size_hint`, which std's adaptors call in place of `next` or beside it at fixtures/reject/src/lib.rs:217:2 +an iterator of the crate implementing `FusedIterator`, which is not supported yet at fixtures/reject/src/lib.rs:237:1 +`Hasher::write`, which is not supported yet at fixtures/reject/src/lib.rs:328:9 diff --git a/ts/fixtures/reject/src/lib.rs b/ts/fixtures/reject/src/lib.rs index 626481eb8..e5d68f4f7 100644 --- a/ts/fixtures/reject/src/lib.rs +++ b/ts/fixtures/reject/src/lib.rs @@ -38,6 +38,11 @@ pub fn generic_unit(value: Option<()>) -> bool { Maybe { value }.value.is_some() } +/// The runtime's collecting into an `Option` ends at the first `undefined`, which `Some(())` is. +pub fn collected(v: &[u8]) -> Option> { + v.iter().map(|&b| (b > 1).then_some(())).collect() +} + /// The runtime's `find` takes `None` to be `undefined`, which `Some(None)` is. pub fn iterators(v: &[u8]) -> bool { v.iter().map(|&b| (b > 1).then_some(b)).find(Option::is_none).is_some() diff --git a/ts/fixtures/reject/ts.toml b/ts/fixtures/reject/ts.toml index d9c2edc1a..f3219717d 100644 --- a/ts/fixtures/reject/ts.toml +++ b/ts/fixtures/reject/ts.toml @@ -7,6 +7,7 @@ roots = [ "sorted", "iterators", "generic_unit", + "collected", "Noisy", "owning_closure", "keys", diff --git a/ts/rustc-ice-2026-10-27T22_10_28-1632761.txt b/ts/rustc-ice-2026-10-27T22_10_28-1632761.txt deleted file mode 100644 index 9785cad6d..000000000 --- a/ts/rustc-ice-2026-10-27T22_10_28-1632761.txt +++ /dev/null @@ -1,65 +0,0 @@ -thread 'rustc' panicked at src/lower/mir/scalar.rs:1205:32: -internal error: entered unreachable code: checked by find_scalars -stack backtrace: - 0: 0x7d3225c28975 - ::create - 1: 0x7d3225c288c5 - ::force_capture - 2: 0x7d32249df9ea - std[76053f7ab5f7f410]::panicking::update_hook::>::{closure#0} - 3: 0x7d3225c3ea82 - std[76053f7ab5f7f410]::panicking::panic_with_hook - 4: 0x7d3225c1c264 - std[76053f7ab5f7f410]::panicking::panic_handler::{closure#0} - 5: 0x7d3225c128d9 - std[76053f7ab5f7f410]::sys::backtrace::__rust_end_short_backtrace:: - 6: 0x7d3225c1df5d - __rustc[f82961561223361d]::rust_begin_unwind - 7: 0x7d3221a4d1ec - core[68f4be281c81bf45]::panicking::panic_fmt - 8: 0x595d60df85b8 - ::take_apart - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/scalar.rs:1205:23 - 9: 0x595d60dff676 - ::scalar_source - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/scalar.rs:1173:8 - 10: 0x595d60e00390 - ::scalar_operand - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/scalar.rs:1147:48 - 11: 0x595d60dfbc6a - ::scalar_call - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/scalar.rs:1107:20 - 12: 0x595d60dc61b7 - ::call - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/call.rs:34:9 - 13: 0x595d60da53e1 - ::terminator - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/mod.rs:2340:10 - 14: 0x595d60db0929 - ::block - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/mod.rs:2070:8 - 15: 0x595d60e151ff - ::node - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/mod.rs:2637:8 - 16: 0x595d60ffe6fe - >::within - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/cfg.rs:314:20 - 17: 0x595d60ffda05 - >::tree - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/cfg.rs:266:18 - 18: 0x595d60ffe656 - >::branch - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/cfg.rs:341:9 - 19: 0x595d60ffe7e5 - >::within - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/cfg.rs:315:31 - 20: 0x595d60ffda05 - >::tree - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/cfg.rs:266:18 - 21: 0x595d60fd744e - rust2_ts[b900de6eacbf0c1]::lower::mir::cfg::structure:: - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/cfg.rs:224:6 - 22: 0x595d60db14fa - ::lower - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/mod.rs:1387:14 - 23: 0x595d60e12f34 - rust2_ts[b900de6eacbf0c1]::lower::mir::function - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mir/mod.rs:53:16 - 24: 0x595d6113f83e - ::function - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mod.rs:1197:28 - 25: 0x595d61135908 - ::drain - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mod.rs:256:10 - 26: 0x595d6116640c - rust2_ts[b900de6eacbf0c1]::lower::translate - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/lower/mod.rs:44:4 - 27: 0x595d610bd0df - ::after_expansion - at /home/kixelated/work/rust2/.claude/worktrees/ts-byte-views-locals/ts/src/driver.rs:80:30 - 28: 0x7d32275067e6 - rustc_interface[428b96e9abb7cc47]::interface::run_compiler::<(), rustc_driver_impl[ab3368f39572c260]::compiler_entrypoint::{closure#0}>::{closure#2} - 29: 0x7d3227530764 - std[76053f7ab5f7f410]::sys::backtrace::__rust_begin_short_backtrace::::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> - 30: 0x7d32275304ff - ::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[68f4be281c81bf45]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} - 31: 0x7d322752d81b - ::new::thread_start - 32: 0x7d322049f751 - start_thread - 33: 0x7d322052ba4c - __clone3 - 34: 0x0 - - - -rustc version: 1.101.0-nightly (7df81381d 2026-10-14) -platform: x86_64-unknown-linux-gnu - -query stack during panic: -end of query stack diff --git a/ts/src/lower/iter.rs b/ts/src/lower/iter.rs index 5551b8b8e..cbcc767cb 100644 --- a/ts/src/lower/iter.rs +++ b/ts/src/lower/iter.rs @@ -719,12 +719,13 @@ fn collect<'tcx>( return None; }; let value = item_args.type_at(0); - // The runtime ends at the first `undefined`. - if std == Std::Option && b.t.erases_to(args.type_at(0)).undefined { - let msg = format!( - "collecting `Option<{}>`, whose `None` is `rt.None`, which is not supported yet", - args.type_at(0) - ); + // The runtime ends at the first `undefined` item, and returns `undefined` for `None`. + if std == Std::Option + && let Some(some) = [value, args.type_at(0)] + .into_iter() + .find(|&t| b.t.erases_to(t).undefined) + { + let msg = format!("collecting `Option<{some}>`, whose `None` is `rt.None`, which is not supported yet"); b.t.err(span, msg); } let value_ty = b.t.ty(value, span); diff --git a/ts/src/lower/mod.rs b/ts/src/lower/mod.rs index 1ad3dd9b2..3980fe5f9 100644 --- a/ts/src/lower/mod.rs +++ b/ts/src/lower/mod.rs @@ -1301,9 +1301,12 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { let ty::Adt(option, option_args) = part.kind() else { return None; }; + if library::Std::of(tcx, option.did()) != Some(library::Std::Option) { + return None; + } let inner = option_args.type_at(0); let erased = self.erases_to(inner); - if library::Std::of(tcx, option.did()) != Some(library::Std::Option) || !erased.param || erased.undefined { + if !erased.param || erased.undefined { return None; } let instance = ty::EarlyBinder::bind(tcx, inner).instantiate(tcx, args).skip_norm_wip(); From c40dd65c4aa3f5b8072f4db4c052941cc72cb8ce Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:08:00 -0700 Subject: [PATCH 5/5] fix(ts): read a ControlFlow's Option residual as its own None The `Break` of `?` on an `Option` holds an `Option`, whose `None` is `undefined`, not the `rt.None` of the `Option` it was applied to. Co-Authored-By: Claude Opus 5.5 --- ts/src/lower/mir/call.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/src/lower/mir/call.rs b/ts/src/lower/mir/call.rs index e672c0b8b..50eee6b99 100644 --- a/ts/src/lower/mir/call.rs +++ b/ts/src/lower/mir/call.rs @@ -1012,7 +1012,7 @@ pub fn control_flow_field<'tcx>( (Flow::Result, false) => base, (Flow::Other, false) => base.member("error"), (Flow::Option, true) => base, - (Flow::Option, false) => fx.b.t.none(continued(ty)), + (Flow::Option, false) => Expr::undefined(), } }