diff --git a/quest/m3/README.md b/quest/m3/README.md index 73adb9533..fafe64a88 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -22,7 +22,6 @@ generic std gap is planned here even when moq never calls it. - [Writes through iter_mut without a Place per item](/quest/m3/ts-iter-mut-places.md) - a loop over `iter_mut()` of copy values writes the slice's array by index - [Throw only where Rust panics](/quest/m3/ts-runtime-throws.md) - no runtime `rust2-ts:` error where native Rust goes on: an exact slower path, or a refusal at translation - [rust2-ts with no ts.toml](/quest/m3/ts-configless.md) - a crate's whole `pub` API translates with no config and no bound items -- [std's panic messages hold std's capacity](/quest/m3/ts-panic-payload-capacity.md) - a hook reads native's `String` capacity from std's own formatted panics - [Browser APIs through wasm-bindgen](/quest/m3/ts-wasm-bindgen/README.md) - web-sys and js-sys imports become direct JS calls, so idiomatic crates such as web-rs's web-codecs translate as stock crates - [BufMut on a byte slice](/quest/m3/ts-bufmut-slices.md) - `bytes`' `BufMut` for `&mut [u8]` and `&mut [MaybeUninit]` translates - [Fields typed by an associated type](/quest/m3/ts-assoc-type-fields.md) - a generic struct's field of `::Item` translates at each instance diff --git a/quest/m3/ts-panic-payload-capacity.md b/quest/m3/ts-panic-payload-capacity.md deleted file mode 100644 index e8be00bf3..000000000 --- a/quest/m3/ts-panic-payload-capacity.md +++ /dev/null @@ -1,16 +0,0 @@ -# [M] std's panic messages hold std's capacity - -## Goal - -A panic hook in code [rust2-ts](/ts/README.md) generates reads the same `String` capacity -from std's own formatted panic messages (such as `slice index starts at {} but ends at -{}`) as native Rust, proven by the panics fixture's hook against native Rust. - -## Plan - -Found in #574, which gives `String` its capacity: the runtime passes std's formatted messages as one string, so their -capacity differs from std's, which builds them piece by piece (37 against 44 for that -message). About 64 runtime sites pass such a message. Build each as std's `format!` does, -without slowing the paths that never panic. - -Public API: the runtime's panic sites, not their messages. diff --git a/ts/fixtures/lang/panics/hook/expected/core/option.ts b/ts/fixtures/lang/panics/hook/expected/core/option.ts index 77c48304e..6f168ecb0 100644 --- a/ts/fixtures/lang/panics/hook/expected/core/option.ts +++ b/ts/fixtures/lang/panics/hook/expected/core/option.ts @@ -16,13 +16,6 @@ export function map$18ftgyp(self: rs.char | undefined, _: (a0: rs.char) => rs.u3 return self as rs.u32; } -export function map$0ded99z(self: rs.String | undefined, _: (a0: rs.String) => rs.usize): rs.usize | undefined { - if (self === undefined) { - return undefined; - } - return self.cap; -} - export function map$04ry0e1(self: rs.u32 | undefined, f: (a0: rs.u32) => rs.u8): rs.u8 | undefined { if (self === undefined) { return undefined; diff --git a/ts/fixtures/lang/panics/hook/expected/harness.ts b/ts/fixtures/lang/panics/hook/expected/harness.ts index c05c59358..85e42d25b 100644 --- a/ts/fixtures/lang/panics/hook/expected/harness.ts +++ b/ts/fixtures/lang/panics/hook/expected/harness.ts @@ -47,7 +47,7 @@ export function text(data: rs.ByteSlice): rs.String { } const _13: rs.usize = rs.u8Rem(_5, 16, { file: "fixtures/lang/panics/src/../../harness.rs", line: 62, col: 25 }) as rs.usize; if (!(_13 < 16)) { - rs.panic("index out of bounds: the len is " + 16 + " but the index is " + _13, { file: "fixtures/lang/panics/src/../../harness.rs", line: 62, col: 16 }, true); + rs.panicSizes(["index out of bounds: the len is ", 16, " but the index is ", _13], { file: "fixtures/lang/panics/src/../../harness.rs", line: 62, col: 16 }); } rs.stringPush(s, [47, 92, 97, 48, 57, 127, 128, 233, 2047, 2048, 55295, 57344, 65535, 65536, 128512, 1114111][_13]); } diff --git a/ts/fixtures/lang/panics/hook/expected/hooked.Failing.ts b/ts/fixtures/lang/panics/hook/expected/hooked.Failing.ts new file mode 100644 index 000000000..18df2edaa --- /dev/null +++ b/ts/fixtures/lang/panics/hook/expected/hooked.Failing.ts @@ -0,0 +1,16 @@ +// Generated by rust2-ts. Do not edit. + +import * as rs from "./rs.ts"; + +/** + * A `Display` that fails though the writer did not, which `format!` and `to_string` + * panic on. + */ +export interface Failing { +} + +export function fmt$fmt_Display(_self: Failing, _2: rs.Formatter): rs.Result { + return rs.Err(new rs.FmtError()); +} + +//# sourceMappingURL=hooked.Failing.ts.map diff --git a/ts/fixtures/lang/panics/hook/expected/hooked.Shown.ts b/ts/fixtures/lang/panics/hook/expected/hooked.Shown.ts index 9ae318145..e978a30c0 100644 --- a/ts/fixtures/lang/panics/hook/expected/hooked.Shown.ts +++ b/ts/fixtures/lang/panics/hook/expected/hooked.Shown.ts @@ -20,7 +20,7 @@ export function fmt$fmt_Display(self: Shown, f: rs.Formatter): rs.Result")) { - if (!(payload instanceof of$String)) { - const _12: rs.u32 | undefined = payload instanceof of$u32 ? payload.v : payload instanceof ofPlace$u32 ? payload.v.v : undefined; - if (_12 !== undefined) { - kind = rs.fmtFormat(["u32 ", (f: rs.Formatter) => rs.u32Display(_12, f)]); + const _10: rs.String | undefined = payload instanceof of$String ? payload.v : undefined; + if (_10 !== undefined) { + kind = rs.fmtFormat(["String ", (f: rs.Formatter) => rs.usizeDisplay(_10.cap, f)]); + } else { + const _22: rs.u32 | undefined = payload instanceof of$u32 ? payload.v : payload instanceof ofPlace$u32 ? payload.v.v : undefined; + if (_22 !== undefined) { + kind = rs.fmtFormat(["u32 ", (f: rs.Formatter) => rs.u32Display(_22, f)]); } else { - const _23: rs.u8 | undefined = payload instanceof of$u8 ? payload.v : payload instanceof ofPlace$u8 ? payload.v.v : undefined; - if (_23 !== undefined) { - kind = rs.fmtFormat(["u8 ", (f: rs.Formatter) => rs.u8Display(_23, f)]); + const _33: rs.u8 | undefined = payload instanceof of$u8 ? payload.v : payload instanceof ofPlace$u8 ? payload.v.v : undefined; + if (_33 !== undefined) { + kind = rs.fmtFormat(["u8 ", (f: rs.Formatter) => rs.u8Display(_33, f)]); } else { kind = rs.stringFrom("other"); } } - } else { - kind = rs.stringFrom("String"); } } else { kind = rs.stringFrom("&str"); } const at: rs.Location = rs.optionUnwrap(info.location, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 42, col: 30 }); - const _42: rs.String = rs.strReplace(rs.fmtToString((f: rs.Formatter) => rs.fmtPanicHookInfoDisplay(info, f)).v, at.file, stdNamed(at.file).v, true); - const _52: string | undefined = info.text; - const _54: rs.String = stdNamed(at.file); - const _57: rs.u32 = at.line; - const _59: rs.u32 = at.col; - const _61: boolean = rs.panicking(); - const args9 = [(f: rs.Formatter) => rs.fmtPad(f, _42.v), (f: rs.Formatter) => rs.fmtPad(f, kind.v), (f: rs.Formatter) => rs.fmtOption(_52, f, rs.fmtStr), (f: rs.Formatter) => rs.fmtPad(f, _54.v), (f: rs.Formatter) => rs.u32Display(_57, f), (f: rs.Formatter) => rs.u32Display(_59, f), (f: rs.Formatter) => rs.fmtBool(_61, f)]; - const line: rs.String = rs.fmtFormat([args9[0], "\n", args9[1], " ", args9[2], " ", args9[3], " ", args9[4], " ", args9[5], " ", args9[6], "\n"]); + const _52: rs.String = rs.strReplace(rs.fmtToString((f: rs.Formatter) => rs.fmtPanicHookInfoDisplay(info, f)).v, at.file, stdNamed(at.file).v, true); + const _62: string | undefined = info.text; + const _64: rs.String = stdNamed(at.file); + const _67: rs.u32 = at.line; + const _69: rs.u32 = at.col; + const _71: boolean = rs.panicking(); + const args12 = [(f: rs.Formatter) => rs.fmtPad(f, _52.v), (f: rs.Formatter) => rs.fmtPad(f, kind.v), (f: rs.Formatter) => rs.fmtOption(_62, f, rs.fmtStr), (f: rs.Formatter) => rs.fmtPad(f, _64.v), (f: rs.Formatter) => rs.u32Display(_67, f), (f: rs.Formatter) => rs.u32Display(_69, f), (f: rs.Formatter) => rs.fmtBool(_71, f)]; + const line: rs.String = rs.fmtFormat([args12[0], "\n", args12[1], " ", args12[2], " ", args12[3], " ", args12[4], " ", args12[5], " ", args12[6], "\n"]); rs.localKeyWithBorrowMut(NOTE, (note: rs.String): undefined => { rs.stringPushStr(note, line.v); }, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/thread/local.rs", line: 721, col: 38 }); @@ -86,26 +88,6 @@ export function hook(): void { }), { capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/raw_vec/mod.rs", line: 29, col: 5 }, trusted_capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/spec_from_iter_nested.rs", line: 57, col: 18 }, swap_remove: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2178, col: 13 }, vec_set_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2138, col: 9 }, into_flattened: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3667, col: 36 }, rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3902, col: 9 }, rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3948, col: 9 }, ord_violation: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/sort/shared/smallsort.rs", line: 854, col: 5 }, ord_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cmp.rs", line: 1166, col: 9 }, f32_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f32.rs", line: 1665, col: 9 }, f64_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f64.rs", line: 1643, col: 9 }, encode_utf8: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2507, col: 9 }, encode_utf16: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2601, col: 13 }, format: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/fmt.rs", line: 657, col: 14 }, to_string: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/string.rs", line: 2997, col: 14 }, debug_struct_fields: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/fmt/mod.rs", line: 2572, col: 9 }, exact_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/exact_size.rs", line: 122, col: 9 }, join_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/str.rs", line: 177, col: 10 }, int_sum: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/accum.rs", line: 206, col: 1 }, int_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 554, col: 1 }, char_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 119, col: 45 }, hash_capacity: { file: "/cargo/registry/25cdd57fae9f0462/hashbrown-0.17.1/src/raw.rs", line: 36, col: 40 }, btree_range_equal_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 110, col: 21 }, btree_range_equal_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 112, col: 21 }, btree_range_order_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 119, col: 21 }, btree_range_order_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 121, col: 21 }, deque_insert: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2612, col: 9 }, deque_swap_i: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1062, col: 9 }, deque_swap_j: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1063, col: 9 }, deque_rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3198, col: 9 }, deque_rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3243, col: 9 }, deque_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2724, col: 9 }, list_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/linked_list.rs", line: 1015, col: 9 }, mutex_lock: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sys/sync/mutex/no_threads.rs", line: 28, col: 9 }, once_force: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sync/once.rs", line: 227, col: 20 }, reentrant_init: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/once.rs", line: 325, col: 66 }, lazy_poisoned: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/lazy.rs", line: 386, col: 5 }, ready_poll: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 23, col: 35 }, ready_into_inner: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 46, col: 16 }, duration_new: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 281, col: 18 }, duration_from_mins: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 540, col: 13 }, duration_from_hours: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 510, col: 13 }, duration_add: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1345, col: 31 }, duration_sub: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1365, col: 31 }, duration_mul: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1385, col: 31 }, bytes_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 207, col: 5 }, bytes_does_not_fit: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 215, col: 5 }, bytes_slice: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 374, col: 28 }, bytes_slice_ref_start: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 426, col: 9 }, bytes_slice_ref_end: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 432, col: 9 }, bytes_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 481, col: 9 }, bytes_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 533, col: 9 }, bytes_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 694, col: 9 }, bytes_mut_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 329, col: 9 }, bytes_mut_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 408, col: 9 }, bytes_mut_set_len: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 545, col: 9 }, bytes_mut_overflow: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 700, col: 21 }, bytes_mut_overflow_offset: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 720, col: 29 }, bytes_mut_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 1246, col: 9 } }); } -/** - * Have the hook also write a `String` payload's capacity, which `panic!` formats into one - * from empty and `panic_any` keeps. - */ -export function sized(): void { - const captured = rs.takeHook(); - rs.setHook(rs.closure((info: rs.PanicHookInfo): undefined => { - const _52: Any.Any = rs.hookPayload(info, of$ref_str, of$String); - const capacity: rs.usize | undefined = option_map$0ded99z(_52 instanceof of$String ? _52.v : undefined, (a0: rs.String): rs.usize => { - return a0.cap; - }); - rs.localKeyWithBorrowMut(NOTE, (note: rs.String): undefined => { - rs.stringPushStr(note, rs.fmtFormat(["capacity ", (f: rs.Formatter) => rs.fmtOption(capacity, f, rs.usizeDebug), "\n"]).v); - }, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/thread/local.rs", line: 721, col: 38 }); - captured(info); - }, (): void => { - rs.drop(captured); - }), { capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/raw_vec/mod.rs", line: 29, col: 5 }, trusted_capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/spec_from_iter_nested.rs", line: 57, col: 18 }, swap_remove: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2178, col: 13 }, vec_set_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2138, col: 9 }, into_flattened: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3667, col: 36 }, rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3902, col: 9 }, rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3948, col: 9 }, ord_violation: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/sort/shared/smallsort.rs", line: 854, col: 5 }, ord_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cmp.rs", line: 1166, col: 9 }, f32_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f32.rs", line: 1665, col: 9 }, f64_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f64.rs", line: 1643, col: 9 }, encode_utf8: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2507, col: 9 }, encode_utf16: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2601, col: 13 }, format: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/fmt.rs", line: 657, col: 14 }, to_string: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/string.rs", line: 2997, col: 14 }, debug_struct_fields: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/fmt/mod.rs", line: 2572, col: 9 }, exact_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/exact_size.rs", line: 122, col: 9 }, join_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/str.rs", line: 177, col: 10 }, int_sum: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/accum.rs", line: 206, col: 1 }, int_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 554, col: 1 }, char_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 119, col: 45 }, hash_capacity: { file: "/cargo/registry/25cdd57fae9f0462/hashbrown-0.17.1/src/raw.rs", line: 36, col: 40 }, btree_range_equal_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 110, col: 21 }, btree_range_equal_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 112, col: 21 }, btree_range_order_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 119, col: 21 }, btree_range_order_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 121, col: 21 }, deque_insert: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2612, col: 9 }, deque_swap_i: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1062, col: 9 }, deque_swap_j: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1063, col: 9 }, deque_rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3198, col: 9 }, deque_rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3243, col: 9 }, deque_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2724, col: 9 }, list_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/linked_list.rs", line: 1015, col: 9 }, mutex_lock: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sys/sync/mutex/no_threads.rs", line: 28, col: 9 }, once_force: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sync/once.rs", line: 227, col: 20 }, reentrant_init: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/once.rs", line: 325, col: 66 }, lazy_poisoned: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/lazy.rs", line: 386, col: 5 }, ready_poll: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 23, col: 35 }, ready_into_inner: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 46, col: 16 }, duration_new: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 281, col: 18 }, duration_from_mins: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 540, col: 13 }, duration_from_hours: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 510, col: 13 }, duration_add: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1345, col: 31 }, duration_sub: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1365, col: 31 }, duration_mul: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1385, col: 31 }, bytes_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 207, col: 5 }, bytes_does_not_fit: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 215, col: 5 }, bytes_slice: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 374, col: 28 }, bytes_slice_ref_start: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 426, col: 9 }, bytes_slice_ref_end: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 432, col: 9 }, bytes_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 481, col: 9 }, bytes_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 533, col: 9 }, bytes_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 694, col: 9 }, bytes_mut_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 329, col: 9 }, bytes_mut_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 408, col: 9 }, bytes_mut_set_len: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 545, col: 9 }, bytes_mut_overflow: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 700, col: 21 }, bytes_mut_overflow_offset: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 720, col: 29 }, bytes_mut_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 1246, col: 9 } }); -} - export function tracked(n: rs.u8, caller: rs.Location): rs.u8 { rs.panicFmt(["tracked ", (f: rs.Formatter) => rs.u8Display(n, f)], caller); } @@ -115,94 +97,92 @@ export function panicked(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void const n: rs.u8 = option_unwrapOr$1fr498u(rs.byteSliceFirst(data), 0); hook(); const v: rs.ByteVec = rs.byteVecFrom(Uint8Array.of(n, n)); - const _10: rs.u8 = rs.u8Rem(kind, 32, { file: "fixtures/lang/panics/src/hooked.rs", line: 98, col: 11 }); + const _10: rs.u8 = rs.u8Rem(kind, 32, { file: "fixtures/lang/panics/src/hooked.rs", line: 87, col: 11 }); if (_10 === 0) { - rs.panicFmt(["literal"], { file: "fixtures/lang/panics/src/hooked.rs", line: 99, col: 14 }); + rs.panicFmt(["literal"], { file: "fixtures/lang/panics/src/hooked.rs", line: 88, col: 14 }); } else if (_10 === 1) { - sized(); - rs.panicFmt(["formatted ", (f: rs.Formatter) => rs.u8Display(n, f)], { file: "fixtures/lang/panics/src/hooked.rs", line: 102, col: 13 }); + rs.panicFmt(["formatted ", (f: rs.Formatter) => rs.u8Display(n, f)], { file: "fixtures/lang/panics/src/hooked.rs", line: 89, col: 14 }); } else if (_10 === 2) { - rs.byteVecPush(out, v.data[rs.idx(v, rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 104, col: 25 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 104, col: 24 })]); + rs.byteVecPush(out, v.data[rs.idx(v, rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 90, col: 25 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 90, col: 24 })]); } else if (_10 === 3) { - rs.byteVecPush(out, rs.u8Add(rs.max(n, 200), rs.max(n, 100), { file: "fixtures/lang/panics/src/hooked.rs", line: 105, col: 23 })); + rs.byteVecPush(out, rs.u8Add(rs.max(n, 200), rs.max(n, 100), { file: "fixtures/lang/panics/src/hooked.rs", line: 91, col: 23 })); } else if (_10 === 4) { - rs.byteVecPush(out, rs.optionUnwrap(filter$0hq86nl(n, (_25: rs.u8): boolean => { + rs.byteVecPush(out, rs.optionUnwrap(filter$0hq86nl(n, (_24: rs.u8): boolean => { return false; - }), undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 106, col: 49 })); + }), undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 92, col: 49 })); } else if (_10 === 5) { - rs.byteVecPush(out, rs.resultUnwrap(rs.Err(n), rs.u8Debug, { file: "fixtures/lang/panics/src/hooked.rs", line: 107, col: 40 })); + rs.byteVecPush(out, rs.resultUnwrap(rs.Err(n), rs.u8Debug, { file: "fixtures/lang/panics/src/hooked.rs", line: 93, col: 40 })); } else if (_10 === 6) { rs.byteVecPush(out, rs.optionExpect(filter$0hq86nl(n, (_2: rs.u8): boolean => { return false; - }), "expected", undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 108, col: 49 })); + }), "expected", undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 94, col: 49 })); } else if (_10 === 7) { - const part2 = rs.usizeAdd(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 109, col: 51 }) as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 109, col: 39 }); - rs.byteVecExtendFromSlice(out, rs.byteSliceRange(rs.byteVecSlice(v), part2, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 109, col: 38 })); + const part2 = rs.usizeAdd(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 95, col: 51 }) as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 95, col: 39 }); + rs.byteVecExtendFromSlice(out, rs.byteSliceRange(rs.byteVecSlice(v), part2, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 95, col: 38 })); } else if (_10 === 8) { const cell: rs.RefCell = new rs.RefCell(n); - const _held: rs.RefCell = rs.refCellBorrowMut(cell, { file: "fixtures/lang/panics/src/hooked.rs", line: 112, col: 30 }); - const _57: rs.RefCell = rs.refCellBorrowMut(cell, { file: "fixtures/lang/panics/src/hooked.rs", line: 113, col: 28 }); - rs.byteVecPush(out, _57.value); - rs.refMutRelease(_57); + const _held: rs.RefCell = rs.refCellBorrowMut(cell, { file: "fixtures/lang/panics/src/hooked.rs", line: 98, col: 30 }); + const _56: rs.RefCell = rs.refCellBorrowMut(cell, { file: "fixtures/lang/panics/src/hooked.rs", line: 99, col: 28 }); + rs.byteVecPush(out, _56.value); + rs.refMutRelease(_56); rs.refMutRelease(_held); } else if (_10 === 9) { rs.byteVecPush(out, rs.intPow(rs.max(n, 2), 9, 8, false, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/mod.rs", line: 590, col: 5 })); } else if (_10 === 10) { - rs.byteVecPush(out, rs.u8Div(100, rs.u8WrappingMul(n, 0), { file: "fixtures/lang/panics/src/hooked.rs", line: 116, col: 24 })); + rs.byteVecPush(out, rs.u8Div(100, rs.u8WrappingMul(n, 0), { file: "fixtures/lang/panics/src/hooked.rs", line: 102, col: 24 })); } else if (_10 === 11) { - rs.byteVecPush(out, rs.byteVecRemove(rs.byteVecFrom(rs.byteVecView(v)), rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 117, col: 41 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 117, col: 34 })); + rs.byteVecPush(out, rs.byteVecRemove(rs.byteVecFrom(rs.byteVecView(v)), rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 103, col: 41 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 103, col: 34 })); } else if (_10 === 12) { - rs.byteVecPush(out, rs.byteVecSwapRemove(rs.byteVecFrom(rs.byteVecView(v)), rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 118, col: 46 }))); + rs.byteVecPush(out, rs.byteVecSwapRemove(rs.byteVecFrom(rs.byteVecView(v)), rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 104, col: 46 }))); } else if (_10 === 13) { - rs.byteSliceRotateLeft(rs.byteVecSlice(rs.byteVecFrom(rs.byteVecView(v))), rs.usizeAdd(n as rs.usize, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 119, col: 37 })); + rs.byteSliceRotateLeft(rs.byteVecSlice(rs.byteVecFrom(rs.byteVecView(v))), rs.usizeAdd(n as rs.usize, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 105, col: 37 })); } else if (_10 === 14) { - rs.byteVecPush(out, rs.hashIndex(rs.hashNew() as rs.HashMap, n, { file: "fixtures/lang/panics/src/hooked.rs", line: 120, col: 48 })); + rs.byteVecPush(out, rs.hashIndex(rs.hashNew() as rs.HashMap, n, { file: "fixtures/lang/panics/src/hooked.rs", line: 106, col: 48 })); } else if (_10 === 15) { - rs.panicAny(new of$u32(n as rs.u32), { file: "fixtures/lang/panics/src/hooked.rs", line: 121, col: 15 }); + rs.panicAny(new of$u32(n as rs.u32), { file: "fixtures/lang/panics/src/hooked.rs", line: 107, col: 15 }); } else if (_10 === 16) { - sized(); - const _94: rs.String = rs.fmtFormat(["any ", (f: rs.Formatter) => rs.u8Display(n, f)]); - rs.panic(_94.v, { file: "fixtures/lang/panics/src/hooked.rs", line: 124, col: 13 }, _94); + const _92: rs.String = rs.fmtFormat(["any ", (f: rs.Formatter) => rs.u8Display(n, f)]); + rs.panic(_92.v, { file: "fixtures/lang/panics/src/hooked.rs", line: 108, col: 15 }, _92); } else if (_10 === 17) { - const _106: rs.u8 = rs.u8WrappingAdd(n, 1); - if (!(n === _106)) { - rs.assertFailed("==", (f: rs.Formatter) => rs.u8Debug(n, f), (f: rs.Formatter) => rs.u8Debug(_106, f), ["differ"], { file: "fixtures/lang/panics/src/hooked.rs", line: 126, col: 15 }); + const _104: rs.u8 = rs.u8WrappingAdd(n, 1); + if (!(n === _104)) { + rs.assertFailed("==", (f: rs.Formatter) => rs.u8Debug(n, f), (f: rs.Formatter) => rs.u8Debug(_104, f), ["differ"], { file: "fixtures/lang/panics/src/hooked.rs", line: 109, col: 15 }); } } else if (_10 === 18) { - rs.byteVecPush(out, tracked(n, { file: "fixtures/lang/panics/src/hooked.rs", line: 127, col: 24 })); + rs.byteVecPush(out, tracked(n, { file: "fixtures/lang/panics/src/hooked.rs", line: 110, col: 24 })); } else if (_10 === 19) { - rs.byteVecPush(out, rs.dequeIndex(rs.dequeFromVec(rs.byteVecToVec(rs.byteVecFrom(rs.byteVecView(v))), 1, true) as rs.VecDeque, rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 128, col: 50 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 128, col: 49 })); + rs.byteVecPush(out, rs.dequeIndex(rs.dequeFromVec(rs.byteVecToVec(rs.byteVecFrom(rs.byteVecView(v))), 1, true) as rs.VecDeque, rs.usizeAdd(n as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 111, col: 50 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 111, col: 49 })); } else if (_10 === 20) { rs.byteVecPush(out, result_unwrapOr$1tftpn5(rs.u8TryFrom(rs.durationAsSecs(rs.durationAdd({ secs: { hi: 0xffffffff, lo: 0xffffffff } as rs.u64, nanos: 999999999 }, rs.durationFromSecs(rs.max(n, 1) as rs.u64)))), 0)); } else if (_10 === 21) { - rs.byteVecExtendFromSlice(out, rs.stringAsBytes(rs.strSlice("éé", 0, rs.usizeAdd(rs.usizeMul(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 130, col: 56 }) as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 130, col: 44 }), 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 130, col: 44 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 130, col: 41 }))); + rs.byteVecExtendFromSlice(out, rs.stringAsBytes(rs.strSlice("éé", 0, rs.usizeAdd(rs.usizeMul(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 113, col: 56 }) as rs.usize, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 113, col: 44 }), 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 113, col: 44 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 113, col: 41 }))); } else if (_10 === 22) { - rs.iterExtendBytes(out, rs.iterStepBy(new rs.Range(0, n), rs.usizeMul(n as rs.usize, 0, { file: "fixtures/lang/panics/src/hooked.rs", line: 131, col: 41 }), undefined, 255, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/adapters/step_by.rs", line: 36, col: 9 }), undefined, true); + rs.iterExtendBytes(out, rs.iterStepBy(new rs.Range(0, n), rs.usizeMul(n as rs.usize, 0, { file: "fixtures/lang/panics/src/hooked.rs", line: 114, col: 41 }), undefined, 255, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/adapters/step_by.rs", line: 36, col: 9 }), undefined, true); } else if (_10 === 23) { - const _152: rs.ByteVec = rs.byteVecFrom(rs.byteVecView(v)); - const _154: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(n as rs.usize, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 132, col: 42 }), rs.usizeStep); - rs.iterExtendBytes(out, rs.byteVecDrain(_152, _154, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3007, col: 36 }), "fold", true); + const _150: rs.ByteVec = rs.byteVecFrom(rs.byteVecView(v)); + const _152: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(n as rs.usize, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 115, col: 42 }), rs.usizeStep); + rs.iterExtendBytes(out, rs.byteVecDrain(_150, _152, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3007, col: 36 }), "fold", true); } else if (_10 === 24) { - rs.panic("any", { file: "fixtures/lang/panics/src/hooked.rs", line: 133, col: 15 }); + rs.panic("any", { file: "fixtures/lang/panics/src/hooked.rs", line: 116, col: 15 }); } else if (_10 === 25) { - rs.iterExtendBytes(out, rs.iterStepBy(rs.iterSlice(rs.byteSliceView(rs.byteVecSlice(v))), rs.usizeMul(n as rs.usize, 0, { file: "fixtures/lang/panics/src/hooked.rs", line: 134, col: 43 }), undefined, undefined, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/adapters/step_by.rs", line: 36, col: 9 }), undefined, true); + rs.iterExtendBytes(out, rs.iterStepBy(rs.iterSlice(rs.byteSliceView(rs.byteVecSlice(v))), rs.usizeMul(n as rs.usize, 0, { file: "fixtures/lang/panics/src/hooked.rs", line: 117, col: 43 }), undefined, undefined, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/adapters/step_by.rs", line: 36, col: 9 }), undefined, true); } else if (_10 === 26) { - const _167: rs.u8 = rs.u8WrappingAdd(n, 1); - if (!(n === _167)) { - rs.panic("assertion failed: n == n.wrapping_add(1)", { file: "fixtures/lang/panics/src/hooked.rs", line: 135, col: 15 }); + const _165: rs.u8 = rs.u8WrappingAdd(n, 1); + if (!(n === _165)) { + rs.panic("assertion failed: n == n.wrapping_add(1)", { file: "fixtures/lang/panics/src/hooked.rs", line: 118, col: 15 }); } } else if (_10 === 27) { - rs.panic("explicit panic", { file: "fixtures/lang/panics/src/hooked.rs", line: 136, col: 15 }); + rs.panic("explicit panic", { file: "fixtures/lang/panics/src/hooked.rs", line: 119, col: 15 }); } else if (_10 === 28) { - rs.panic("internal error: entered unreachable code", { file: "fixtures/lang/panics/src/hooked.rs", line: 137, col: 15 }); + rs.panic("internal error: entered unreachable code", { file: "fixtures/lang/panics/src/hooked.rs", line: 120, col: 15 }); } else if (_10 === 29) { - rs.panic("not yet implemented", { file: "fixtures/lang/panics/src/hooked.rs", line: 138, col: 15 }); + rs.panic("not yet implemented", { file: "fixtures/lang/panics/src/hooked.rs", line: 121, col: 15 }); } else if (_10 === 30) { if (n === n) { - rs.assertFailed("!=", (f: rs.Formatter) => rs.u8Debug(n, f), (f: rs.Formatter) => rs.u8Debug(n, f), undefined as rs.Arguments | undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 139, col: 15 }); + rs.assertFailed("!=", (f: rs.Formatter) => rs.u8Debug(n, f), (f: rs.Formatter) => rs.u8Debug(n, f), undefined as rs.Arguments | undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 122, col: 15 }); } } else if (_10 === 31) { - rs.panicFmt(["not implemented: not ", (f: rs.Formatter) => rs.u8Display(n, f)], { file: "fixtures/lang/panics/src/hooked.rs", line: 140, col: 15 }); + rs.panicFmt(["not implemented: not ", (f: rs.Formatter) => rs.u8Display(n, f)], { file: "fixtures/lang/panics/src/hooked.rs", line: 123, col: 15 }); } else { rs.byteVecPush(out, rs.hashLen(rs.hashWithCapacity(4294967295, 469762048) as rs.HashMap) & 0xff); } @@ -219,9 +199,9 @@ export function aborted(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void const captured2 = prev; rs.setHook(rs.closure((info: rs.PanicHookInfo): undefined => { record(info); - const _4: rs.u8 = rs.u8Rem(captured, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 172, col: 15 }); + const _4: rs.u8 = rs.u8Rem(captured, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 155, col: 15 }); if (_4 === 0) { - rs.panicFmt(["again"], { file: "fixtures/lang/panics/src/hooked.rs", line: 173, col: 18 }); + rs.panicFmt(["again"], { file: "fixtures/lang/panics/src/hooked.rs", line: 156, col: 18 }); } else if (_4 === 1) { rs.drop(rs.takeHook()); } else { @@ -231,13 +211,13 @@ export function aborted(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void rs.drop(captured2); }), { capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/raw_vec/mod.rs", line: 29, col: 5 }, trusted_capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/spec_from_iter_nested.rs", line: 57, col: 18 }, swap_remove: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2178, col: 13 }, vec_set_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2138, col: 9 }, into_flattened: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3667, col: 36 }, rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3902, col: 9 }, rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3948, col: 9 }, ord_violation: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/sort/shared/smallsort.rs", line: 854, col: 5 }, ord_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cmp.rs", line: 1166, col: 9 }, f32_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f32.rs", line: 1665, col: 9 }, f64_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f64.rs", line: 1643, col: 9 }, encode_utf8: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2507, col: 9 }, encode_utf16: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2601, col: 13 }, format: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/fmt.rs", line: 657, col: 14 }, to_string: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/string.rs", line: 2997, col: 14 }, debug_struct_fields: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/fmt/mod.rs", line: 2572, col: 9 }, exact_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/exact_size.rs", line: 122, col: 9 }, join_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/str.rs", line: 177, col: 10 }, int_sum: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/accum.rs", line: 206, col: 1 }, int_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 554, col: 1 }, char_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 119, col: 45 }, hash_capacity: { file: "/cargo/registry/25cdd57fae9f0462/hashbrown-0.17.1/src/raw.rs", line: 36, col: 40 }, btree_range_equal_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 110, col: 21 }, btree_range_equal_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 112, col: 21 }, btree_range_order_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 119, col: 21 }, btree_range_order_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 121, col: 21 }, deque_insert: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2612, col: 9 }, deque_swap_i: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1062, col: 9 }, deque_swap_j: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1063, col: 9 }, deque_rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3198, col: 9 }, deque_rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3243, col: 9 }, deque_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2724, col: 9 }, list_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/linked_list.rs", line: 1015, col: 9 }, mutex_lock: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sys/sync/mutex/no_threads.rs", line: 28, col: 9 }, once_force: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sync/once.rs", line: 227, col: 20 }, reentrant_init: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/once.rs", line: 325, col: 66 }, lazy_poisoned: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/lazy.rs", line: 386, col: 5 }, ready_poll: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 23, col: 35 }, ready_into_inner: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 46, col: 16 }, duration_new: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 281, col: 18 }, duration_from_mins: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 540, col: 13 }, duration_from_hours: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 510, col: 13 }, duration_add: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1345, col: 31 }, duration_sub: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1365, col: 31 }, duration_mul: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1385, col: 31 }, bytes_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 207, col: 5 }, bytes_does_not_fit: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 215, col: 5 }, bytes_slice: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 374, col: 28 }, bytes_slice_ref_start: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 426, col: 9 }, bytes_slice_ref_end: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 432, col: 9 }, bytes_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 481, col: 9 }, bytes_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 533, col: 9 }, bytes_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 694, col: 9 }, bytes_mut_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 329, col: 9 }, bytes_mut_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 408, col: 9 }, bytes_mut_set_len: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 545, col: 9 }, bytes_mut_overflow: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 700, col: 21 }, bytes_mut_overflow_offset: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 720, col: 29 }, bytes_mut_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 1246, col: 9 } }); rs.byteVecPush(out, n); - const _13: rs.u8 = rs.u8Rem(kind, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 179, col: 11 }); + const _13: rs.u8 = rs.u8Rem(kind, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 162, col: 11 }); if (_13 === 3 || _13 === 4) { - const _19: Shown.Shown = { again: rs.u8Rem(kind, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 180, col: 56 }) === 4 }; + const _19: Shown.Shown = { again: rs.u8Rem(kind, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 163, col: 56 }) === 4 }; const args6 = [(f: rs.Formatter) => rs.u8Display(n, f), (f: rs.Formatter) => Shown.fmt$fmt_Display(_19, f)]; - rs.panicFmt(["first ", args6[0], " ", args6[1]], { file: "fixtures/lang/panics/src/hooked.rs", line: 180, col: 18 }); + rs.panicFmt(["first ", args6[0], " ", args6[1]], { file: "fixtures/lang/panics/src/hooked.rs", line: 163, col: 18 }); } else { - rs.panicFmt(["first ", (f: rs.Formatter) => rs.u8Display(n, f)], { file: "fixtures/lang/panics/src/hooked.rs", line: 181, col: 14 }); + rs.panicFmt(["first ", (f: rs.Formatter) => rs.u8Display(n, f)], { file: "fixtures/lang/panics/src/hooked.rs", line: 164, col: 14 }); } } @@ -268,13 +248,13 @@ export function sited(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { const _19: rs.u16[] = [n as rs.u16]; const set: rs.BTreeSet = rs.btreeExtendKeys(rs.btreeNew(rs.cmp) as rs.BTreeSet, rs.iterSlice(_19), true, undefined, undefined, 2, true); b0: { - const k: rs.u8 = rs.u8Rem(kind, 75, { file: "fixtures/lang/panics/src/hooked.rs", line: 203, col: 11 }); + const k: rs.u8 = rs.u8Rem(kind, 86, { file: "fixtures/lang/panics/src/hooked.rs", line: 186, col: 11 }); if (k === 0) { - rs.byteVecPush(out, rs.byteVecWithCapacity(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 204, col: 48 })).length & 0xff); + rs.byteVecPush(out, rs.byteVecWithCapacity(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 187, col: 48 })).length & 0xff); } else if (k === 1) { - rs.byteSliceRotateRight(rs.byteVecSlice(rs.byteVecFrom(rs.byteVecView(v))), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 205, col: 37 })); + rs.byteSliceRotateRight(rs.byteVecSlice(rs.byteVecFrom(rs.byteVecView(v))), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 188, col: 37 })); } else if (k === 2) { - rs.byteVecPush(out, rs.clamp(n, rs.max(n, 1), rs.u8Sub(rs.max(n, 1), 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 206, col: 41 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 206, col: 25 })); + rs.byteVecPush(out, rs.clamp(n, rs.max(n, 1), rs.u8Sub(rs.max(n, 1), 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 189, col: 41 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 189, col: 25 })); } else if (k === 3) { rs.byteVecPush(out, rs.u8FromF64(rs.f64Clamp(n as rs.f64, 1.0, 0.0))); } else if (k === 4) { @@ -282,48 +262,48 @@ export function sited(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { } else if (k === 5) { rs.byteVecExtendFromSlice(out, rs.stringAsBytes(rs.charEncodeUtf8(rs.max(n, 128) as rs.char, rs.byteSliceFrom(Uint8Array.of(0))).v)); } else if (k === 6) { - const _62: rs.char = rs.optionUnwrap(rs.charFromU32(rs.u32Add(128512, n as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 211, col: 28 })), undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 212, col: 18 }); + const _62: rs.char = rs.optionUnwrap(rs.charFromU32(rs.u32Add(128512, n as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 194, col: 28 })), undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 195, col: 18 }); const _69: rs.u16[] = [0]; rs.byteVecPush(out, rs.charEncodeUtf16(_62, rs.sliceFrom(_69)).length & 0xff); } else if (k === 7) { const _73: [rs.RangeBound, rs.RangeBound] = [{ tag: "Excluded", _0: n as rs.u16 } as rs.RangeBound, { tag: "Excluded", _0: n as rs.u16 } as rs.RangeBound]; - rs.iterExtendBytes(out, rs.iterMap(rs.btreeRange(map, _73), (_239: [rs.u16, rs.u8]): rs.u8 => { - return _239[1]; + rs.iterExtendBytes(out, rs.iterMap(rs.btreeRange(map, _73), (_244: [rs.u16, rs.u8]): rs.u8 => { + return _244[1]; }), "next"); } else if (k === 8) { - const _81: rs.Range = new rs.Range(rs.u16Add(n as rs.u16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 220, col: 35 }), n as rs.u16); - rs.iterExtendBytes(out, rs.iterMap(rs.btreeRange(map, _81), (_237: [rs.u16, rs.u8]): rs.u8 => { - return _237[1]; + const _81: rs.Range = new rs.Range(rs.u16Add(n as rs.u16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 203, col: 35 }), n as rs.u16); + rs.iterExtendBytes(out, rs.iterMap(rs.btreeRange(map, _81), (_239: [rs.u16, rs.u8]): rs.u8 => { + return _239[1]; }), "next"); } else if (k === 9) { const _89: [rs.RangeBound, rs.RangeBound] = [{ tag: "Excluded", _0: n as rs.u16 } as rs.RangeBound, { tag: "Excluded", _0: n as rs.u16 } as rs.RangeBound]; - rs.iterExtendBytes(out, rs.iterMap(rs.btreeRangeKeys(set, _89), (_232: rs.u16): rs.u8 => { - return _232 & 0xff; + rs.iterExtendBytes(out, rs.iterMap(rs.btreeRangeKeys(set, _89), (_237: rs.u16): rs.u8 => { + return _237 & 0xff; }), "next"); } else if (k === 10) { - const _97: rs.Range = new rs.Range(rs.u16Add(n as rs.u16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 225, col: 36 }), n as rs.u16); - rs.iterExtendBytes(out, rs.iterMap(rs.btreeRangeKeys(set, _97), (_230: rs.u16): rs.u8 => { - return _230 & 0xff; + const _97: rs.Range = new rs.Range(rs.u16Add(n as rs.u16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 208, col: 36 }), n as rs.u16); + rs.iterExtendBytes(out, rs.iterMap(rs.btreeRangeKeys(set, _97), (_232: rs.u16): rs.u8 => { + return _232 & 0xff; }), "next"); } else if (k === 11) { - rs.dequeInsert(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 226, col: 36 }), n); + rs.dequeInsert(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 209, col: 36 }), n); } else if (k === 12) { - rs.dequeSwap(rs.dequeClone(deque), rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 227, col: 34 }), 0); + rs.dequeSwap(rs.dequeClone(deque), rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 210, col: 34 }), 0); } else if (k === 13) { - rs.dequeSwap(rs.dequeClone(deque), 0, rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 228, col: 37 })); + rs.dequeSwap(rs.dequeClone(deque), 0, rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 211, col: 37 })); } else if (k === 14) { - rs.dequeRotate(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 229, col: 41 })); + rs.dequeRotate(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 212, col: 41 })); } else if (k === 15) { - rs.dequeRotate(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 230, col: 42 }), true); + rs.dequeRotate(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 213, col: 42 }), true); } else if (k === 16) { - rs.iterExtendBytes(out, rs.dequeIntoIter(rs.dequeSplitOff(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 231, col: 50 }))), undefined, true); + rs.iterExtendBytes(out, rs.dequeIntoIter(rs.dequeSplitOff(rs.dequeClone(deque), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 214, col: 50 }))), undefined, true); } else if (k === 17) { const _136: Uint8Array = Uint8Array.of(n); - rs.iterExtendBytes(out, rs.listIter(rs.listSplitOff(rs.listExtend(rs.listNew() as rs.LinkedList, rs.iterSlice(_136)), rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 232, col: 58 }))), undefined, true); + rs.iterExtendBytes(out, rs.listIter(rs.listSplitOff(rs.listExtend(rs.listNew() as rs.LinkedList, rs.iterSlice(_136)), rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 215, col: 58 }))), undefined, true); } else if (k === 18) { const mutex: rs.Mutex = new rs.Mutex(n); const _held: rs.Result, rs.Mutex> = rs.Ok(rs.mutexLock(mutex)); - const _146: rs.Mutex = rs.resultUnwrap(rs.Ok(rs.mutexLock(mutex)), rs.fmtPoisonErrorDebug, { file: "fixtures/lang/panics/src/hooked.rs", line: 236, col: 36 }); + const _146: rs.Mutex = rs.resultUnwrap(rs.Ok(rs.mutexLock(mutex)), rs.fmtPoisonErrorDebug, { file: "fixtures/lang/panics/src/hooked.rs", line: 219, col: 36 }); rs.byteVecPush(out, _146.value); rs.mutexUnlock(_146); drop$Result_sync_MutexGuard_u8_sync_PoisonError_sync_MutexGuard_u8(_held); @@ -365,40 +345,40 @@ export function sited(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { } rs.byteVecPush(out, ready2.intoInner()); } else if (k === 23) { - rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationNew({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, rs.u32Add(1000000000, n as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 263, col: 48 }))) & 0xff); + rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationNew({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, rs.u32Add(1000000000, n as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 246, col: 48 }))) & 0xff); } else if (k === 24) { - rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationFromMins(rs.u64Sub({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, n as rs.u64, { file: "fixtures/lang/panics/src/hooked.rs", line: 264, col: 44 }))) & 0xff); + rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationFromMins(rs.u64Sub({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, n as rs.u64, { file: "fixtures/lang/panics/src/hooked.rs", line: 247, col: 44 }))) & 0xff); } else if (k === 25) { - rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationFromHours(rs.u64Sub({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, n as rs.u64, { file: "fixtures/lang/panics/src/hooked.rs", line: 265, col: 45 }))) & 0xff); + rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationFromHours(rs.u64Sub({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, n as rs.u64, { file: "fixtures/lang/panics/src/hooked.rs", line: 248, col: 45 }))) & 0xff); } else if (k === 26) { - rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationSub({ secs: 0, nanos: 0 }, rs.durationFromSecs(rs.u64Add(n as rs.u64, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 266, col: 62 })))) & 0xff); + rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationSub({ secs: 0, nanos: 0 }, rs.durationFromSecs(rs.u64Add(n as rs.u64, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 249, col: 62 })))) & 0xff); } else if (k === 27) { - rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationMul({ secs: { hi: 0xffffffff, lo: 0xffffffff } as rs.u64, nanos: 999999999 }, rs.u32Add(n as rs.u32, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 267, col: 41 }))) & 0xff); + rs.byteVecPush(out, rs.durationSubsecNanos(rs.durationMul({ secs: { hi: 0xffffffff, lo: 0xffffffff } as rs.u64, nanos: 999999999 }, rs.u32Add(n as rs.u32, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 250, col: 41 }))) & 0xff); } else if (k === 28) { const _231: rs.ByteVec = rs.byteVecFrom(rs.byteVecView(v)); - const _233: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 268, col: 44 }), rs.usizeStep); + const _233: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 251, col: 44 }), rs.usizeStep); rs.byteVecExtendFromWithin(_231, _233, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3614, col: 21 }); } else if (k === 29) { const _238: rs.VecDeque = rs.dequeClone(deque); - const _240: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 269, col: 46 }), rs.usizeStep); + const _240: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 252, col: 46 }), rs.usizeStep); rs.iterExtendBytes(out, rs.dequeDrain(_238, _240, undefined, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1998, col: 36 }), "next"); } else if (k === 30) { - const _245: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 270, col: 38 }), rs.usizeStep); + const _245: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 253, col: 38 }), rs.usizeStep); rs.iterExtendBytes(out, rs.dequeRange(deque, _245, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1845, col: 36 }), undefined, true); } else if (k === 31) { const _251: rs.VecDeque = rs.dequeClone(deque); - const _253: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 271, col: 50 }), rs.usizeStep); + const _253: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 254, col: 50 }), rs.usizeStep); rs.iterExtendBytes(out, rs.iterMap(rs.dequeRangeMut(_251, _253, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1845, col: 36 }), (v6: rs.Place): rs.u8 => { return v6.v; }), undefined, true); } else if (k === 32) { const cell2: rs.RefCell = new rs.RefCell(rs.byteVecFrom(Uint8Array.of(n))); - const _held2: rs.RefCell = rs.refCellBorrow(cell2, { file: "fixtures/lang/panics/src/hooked.rs", line: 274, col: 30 }); + const _held2: rs.RefCell = rs.refCellBorrow(cell2, { file: "fixtures/lang/panics/src/hooked.rs", line: 257, col: 30 }); rs.iterExtendBytes(out, rs.byteVecIntoIter(rs.refCellReplace(cell2, new rs.ByteVec(), { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell.rs", line: 1434, col: 14 })), undefined, true); rs.refRelease(_held2); } else if (k === 33) { ((cell4: rs.RefCell): undefined => { - rs.refCellBorrow(cell4, { file: "fixtures/lang/panics/src/hooked.rs", line: 278, col: 54 }); + rs.refCellBorrow(cell4, { file: "fixtures/lang/panics/src/hooked.rs", line: 261, col: 54 }); })(SHARED.get()); rs.localKeyWithBorrowMutPlace(SHARED, (v5: rs.Place): undefined => { v5.v = n; @@ -409,30 +389,30 @@ export function sited(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { undefined; })); })(EXCLUSIVE.get()); - withBorrow$097wfl1(EXCLUSIVE, (_210: rs.u8): undefined => { - rs.byteVecPush(out, _210); + withBorrow$097wfl1(EXCLUSIVE, (_217: rs.u8): undefined => { + rs.byteVecPush(out, _217); }); } else if (k === 35) { const _277: rs.ByteVec = rs.byteVecFrom(rs.byteVecView(v)); - const _279: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 285, col: 43 }), rs.usizeStep); + const _279: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 268, col: 43 }), rs.usizeStep); const _282: Uint8Array = Uint8Array.of(n); rs.iterExtendBytes(out, rs.spliceFrom(rs.byteVecSplice(_277, _279, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3007, col: 36 }), rs.iterSlice(_282), true), "next"); } else if (k === 36) { - rs.iterExtendBytes(out, rs.iterOption(option_map$04ry0e1(option_map$18ftgyp(rs.charFromDigit(n as rs.u32, rs.u32Add(37, n as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 287, col: 44 }), { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/convert.rs", line: 332, col: 9 }), (a02: rs.char): rs.u32 => { + rs.iterExtendBytes(out, rs.iterOption(option_map$04ry0e1(option_map$18ftgyp(rs.charFromDigit(n as rs.u32, rs.u32Add(37, n as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 270, col: 44 }), { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/convert.rs", line: 332, col: 9 }), (a02: rs.char): rs.u32 => { return a02 as rs.u32; }), (c2: rs.u32): rs.u8 => { return c2 & 0xff; })), undefined, true); } else if (k === 37) { - const _294: rs.usize = rs.usizeDiv(at, 256, { file: "fixtures/lang/panics/src/hooked.rs", line: 291, col: 59 }); + const _294: rs.usize = rs.usizeDiv(at, 256, { file: "fixtures/lang/panics/src/hooked.rs", line: 274, col: 59 }); if (!(_294 < 2)) { - rs.panic("index out of bounds: the len is " + 2 + " but the index is " + _294, { file: "fixtures/lang/panics/src/hooked.rs", line: 291, col: 21 }, true); + rs.panicSizes(["index out of bounds: the len is ", 2, " but the index is ", _294], { file: "fixtures/lang/panics/src/hooked.rs", line: 274, col: 21 }); } rs.fence([0, 4][_294], { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/sync/atomic.rs", line: 4822, col: 24 }); } else if (k === 38) { - const _301: rs.usize = rs.usizeDiv(at, 256, { file: "fixtures/lang/panics/src/hooked.rs", line: 292, col: 68 }); + const _301: rs.usize = rs.usizeDiv(at, 256, { file: "fixtures/lang/panics/src/hooked.rs", line: 275, col: 68 }); if (!(_301 < 2)) { - rs.panic("index out of bounds: the len is " + 2 + " but the index is " + _301, { file: "fixtures/lang/panics/src/hooked.rs", line: 292, col: 30 }, true); + rs.panicSizes(["index out of bounds: the len is ", 2, " but the index is ", _301], { file: "fixtures/lang/panics/src/hooked.rs", line: 275, col: 30 }); } rs.fence([0, 4][_301], { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/sync/atomic.rs", line: 4907, col: 24 }); } else if (k === 39) { @@ -450,79 +430,107 @@ export function sited(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { } else if (k === 45) { rs.byteVecPush(out, rs.u64Low(rs.durationAsSecs(rs.durationSum(rs.iterSlice([{ secs: { hi: 0xffffffff, lo: 0xffffffff } as rs.u64, nanos: 999999999 }, rs.durationFromSecs(rs.max(n, 1) as rs.u64)]), undefined, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1461, col: 9 }))) & 0xff); } else if (k === 46) { - rs.byteVecPush(out, rs.u64Low(rs.durationAsSecs(rs.durationSum(rs.iterSlice([{ secs: { hi: 0xffffffff, lo: 0xffffffff } as rs.u64, nanos: 999999999 }, rs.durationNew(rs.u64Add(n as rs.u64, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 306, col: 43 }), 0)]), undefined, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1468, col: 9 }))) & 0xff); + rs.byteVecPush(out, rs.u64Low(rs.durationAsSecs(rs.durationSum(rs.iterSlice([{ secs: { hi: 0xffffffff, lo: 0xffffffff } as rs.u64, nanos: 999999999 }, rs.durationNew(rs.u64Add(n as rs.u64, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 289, col: 43 }), 0)]), undefined, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1468, col: 9 }))) & 0xff); } else if (k === 47) { const _365: rs.ByteVec = rs.byteVecFrom(rs.byteVecView(v)); - const _367: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 311, col: 47 }), rs.usizeStep); - rs.iterExtendBytes(out, rs.byteVecExtractIf(_365, _367, (_29: rs.Place): boolean => { + const _367: rs.RangeFrom = new rs.RangeFrom(rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 294, col: 47 }), rs.usizeStep); + rs.iterExtendBytes(out, rs.byteVecExtractIf(_365, _367, (_210: rs.Place): boolean => { return true; }, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/extract_if.rs", line: 43, col: 36 }), "next"); } else if (k === 48) { const _374: rs.Vec = rs.vecFrom([n as rs.u16]); - const _377: { end: rs.usize } = { end: rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 312, col: 56 }) }; - rs.byteVecPush(out, rs.ownedCount(rs.vecExtractIfMut(_374, _377, (_2: rs.Place): boolean => { + const _377: { end: rs.usize } = { end: rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 295, col: 56 }) }; + rs.byteVecPush(out, rs.ownedCount(rs.vecExtractIfMut(_374, _377, (_29: rs.Place): boolean => { return true; }, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/extract_if.rs", line: 43, col: 36 }), undefined, undefined) & 0xff); } else if (k === 49) { - rs.iterExtendBytes(out, rs.iterTake(new rs.RangeFrom(rs.u8Sub(255, rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 313, col: 37 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 313, col: 27 }), rs.u8Step), 3), undefined, true); + rs.iterExtendBytes(out, rs.iterTake(new rs.RangeFrom(rs.u8Sub(255, rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 296, col: 37 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 296, col: 27 }), rs.u8Step), 3), undefined, true); } else if (k === 50) { - rs.iterExtendBytes(out, rs.iterOption(rs.iterNth(new rs.RangeFrom(rs.u8Sub(255, rs.u8Rem(n, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 314, col: 37 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 314, col: 27 }), rs.u8Step), rs.usizeAdd(rs.u8Rem(n, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 314, col: 62 }) as rs.usize, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 314, col: 50 }))), undefined, true); + rs.iterExtendBytes(out, rs.iterOption(rs.iterNth(new rs.RangeFrom(rs.u8Sub(255, rs.u8Rem(n, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 297, col: 37 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 297, col: 27 }), rs.u8Step), rs.usizeAdd(rs.u8Rem(n, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 297, col: 62 }) as rs.usize, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 297, col: 50 }))), undefined, true); } else if (k === 51) { - rs.iterExtendBytes(out, rs.iterMap(rs.iterTake(new rs.RangeFrom(rs.u64Sub({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 315, col: 48 }) as rs.u64, { file: "fixtures/lang/panics/src/hooked.rs", line: 315, col: 27 }), rs.u64Step), 3), (x: rs.u64): rs.u8 => { + rs.iterExtendBytes(out, rs.iterMap(rs.iterTake(new rs.RangeFrom(rs.u64Sub({ hi: 0xffffffff, lo: 0xffffffff } as rs.u64, rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 298, col: 48 }) as rs.u64, { file: "fixtures/lang/panics/src/hooked.rs", line: 298, col: 27 }), rs.u64Step), 3), (x: rs.u64): rs.u8 => { return rs.u64Low(x) & 0xff; }), undefined, true); } else if (k === 52) { - rs.iterExtendBytes(out, rs.iterMap(rs.iterTake(new rs.RangeFrom(rs.optionUnwrap(rs.charFromU32(rs.u32Sub(1114111, rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 317, col: 51 }) as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 317, col: 29 })), undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 317, col: 59 }), rs.charStep), 3), (c: rs.char): rs.u8 => { + rs.iterExtendBytes(out, rs.iterMap(rs.iterTake(new rs.RangeFrom(rs.optionUnwrap(rs.charFromU32(rs.u32Sub(1114111, rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 300, col: 51 }) as rs.u32, { file: "fixtures/lang/panics/src/hooked.rs", line: 300, col: 29 })), undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 300, col: 59 }), rs.charStep), 3), (c: rs.char): rs.u8 => { return c & 0xff; }), undefined, true); } else if (k === 68) { - if (!(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 323, col: 15 }) === 0)) { - const v3: rs.Vec = rs.vecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 330, col: 51 }), 4); - const _442: rs.usize = rs.usizeAdd(rs.vecCapacity(v3, 4), 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 332, col: 32 }); + if (!(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 306, col: 15 }) === 0)) { + const v3: rs.Vec = rs.vecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 313, col: 51 }), 4); + const _442: rs.usize = rs.usizeAdd(rs.vecCapacity(v3, 4), 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 315, col: 32 }); rs.vecSetLen(v3, _442, 4, (): rs.u32 => { return (undefined as unknown) as rs.u32; }); rs.byteVecPush(out, v3.items.length & 0xff); } else { - const v2: rs.ByteVec = rs.byteVecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 324, col: 50 })); - rs.byteVecSetLen(v2, rs.usizeAdd(v2.data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 326, col: 32 })); + const v2: rs.ByteVec = rs.byteVecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 307, col: 50 })); + rs.byteVecSetLen(v2, rs.usizeAdd(v2.data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 309, col: 32 })); rs.byteVecPush(out, v2.length & 0xff); } } else if (k === 69) { const _451: rs.ByteSlice = rs.byteSliceFrom(rs.bytes(2).fill((0 as unknown) as rs.u8)); - const part2 = rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 335, col: 81 }); - rs.byteSliceCopyFromSlice(_451, rs.byteSliceRange(rs.byteVecSlice(v), 0, part2, { file: "fixtures/lang/panics/src/hooked.rs", line: 335, col: 78 }), { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/mem/maybe_uninit.rs", line: 1170, col: 14 }); + const part2 = rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 318, col: 81 }); + rs.byteSliceCopyFromSlice(_451, rs.byteSliceRange(rs.byteVecSlice(v), 0, part2, { file: "fixtures/lang/panics/src/hooked.rs", line: 318, col: 78 }), { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/mem/maybe_uninit.rs", line: 1170, col: 14 }); } else if (k === 70) { rs.sliceWriteCloneOfSlice(rs.sliceFrom(Array.from({ length: 2 }, (): rs.String => { return (undefined as unknown) as rs.String; - })), rs.sliceRange(rs.sliceFrom([rs.stringNew()]), 0, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 336, col: 106 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 336, col: 103 }), (a0: rs.String): rs.String => { + })), rs.sliceRange(rs.sliceFrom([rs.stringNew()]), 0, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 319, col: 106 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 319, col: 103 }), (a0: rs.String): rs.String => { return rs.stringClone(a0); }, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/mem/maybe_uninit.rs", line: 1230, col: 9 }); } else if (k === 71) { - rs.byteVecPush(out, rs.sliceNewUninit(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 337, col: 55 }), 2, (): rs.u16 => { + rs.byteVecPush(out, rs.sliceNewUninit(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 320, col: 55 }), 2, (): rs.u16 => { return (undefined as unknown) as rs.u16; }).length & 0xff); } else if (k === 72) { let lent: rs.ByteSlice = rs.byteVecSlice(v); - const _482: rs.usize = rs.usizeAdd(rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 340, col: 26 }), 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 340, col: 26 }); + const _482: rs.usize = rs.usizeAdd(rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 323, col: 26 }), 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 323, col: 26 }); rs.ioSliceAdvance(rs.place(() => lent, (value2) => lent = value2), _482, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/io/io_slice/repr_generic.rs", line: 14, col: 25 }); rs.byteVecExtendFromSlice(out, lent); } else if (k === 73) { const lent2: rs.ByteSlice[] = [rs.byteVecSlice(v)]; let left: rs.Slice = rs.sliceFrom(lent2); - const _498: rs.usize = rs.usizeAdd(rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 346, col: 57 }), 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 346, col: 57 }); + const _498: rs.usize = rs.usizeAdd(rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 329, col: 57 }), 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 329, col: 57 }); rs.ioSliceAdvanceSlices(rs.place(() => left, (value) => left = value), _498, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/io/io_slice.rs", line: 304, col: 13 }); rs.byteVecPush(out, left.length & 0xff); + } else if (k === 74) { + rs.byteVecInsert(rs.byteVecFrom(rs.byteVecView(v)), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 332, col: 32 }), n, { file: "fixtures/lang/panics/src/hooked.rs", line: 332, col: 25 }); + } else if (k === 75) { + rs.iterExtendBytes(out, rs.byteVecIntoIter(rs.byteVecSplitOff(rs.byteVecFrom(rs.byteVecView(v)), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 333, col: 46 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 333, col: 36 })), undefined, true); + } else if (k === 76) { + rs.byteVecPush(out, rs.vecRemove(rs.vecFrom([n as rs.u16]), rs.usizeAdd(at, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 334, col: 50 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 334, col: 43 }) & 0xff); + } else if (k === 77) { + rs.byteVecPush(out, rs.vecSwapRemove(rs.vecFrom([n as rs.u16]), rs.usizeAdd(at, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 335, col: 55 })) & 0xff); + } else if (k === 78) { + rs.vecInsert(rs.vecFrom([n as rs.u16]), rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 336, col: 41 }), 0, { file: "fixtures/lang/panics/src/hooked.rs", line: 336, col: 34 }); + } else if (k === 79) { + rs.iterExtendBytes(out, rs.iterMap(rs.iterSlice(rs.vecSplitOff(rs.vecFrom([n as rs.u16]), rs.usizeAdd(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 337, col: 55 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 337, col: 45 }).items), (_2: rs.u16): rs.u8 => { + return _2 & 0xff; + }), undefined, true); + } else if (k === 80) { + const _550: rs.ByteSlice = rs.byteVecSlice(rs.byteVecFrom(rs.byteVecView(v))); + const _554: rs.Range = new rs.Range(rs.usizeAdd(at, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 338, col: 37 }), rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 338, col: 45 })); + rs.byteSliceCopyWithin(_550, _554.start, _554.end, 0, { file: "fixtures/lang/panics/src/hooked.rs", line: 338, col: 25 }); + } else if (k === 81) { + rs.byteVecPush(out, rs.u64Low(rs.u64Clamp(n as rs.u64, rs.u64Add(n as rs.u64, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 339, col: 43 }), n as rs.u64, { file: "fixtures/lang/panics/src/hooked.rs", line: 339, col: 37 })) & 0xff); + } else if (k === 82) { + rs.byteVecPush(out, rs.clamp(rs.i32Neg(n as rs.i32, { file: "fixtures/lang/panics/src/hooked.rs", line: 340, col: 24 }), 0, -1, { file: "fixtures/lang/panics/src/hooked.rs", line: 340, col: 40 }) & 0xff); + } else if (k === 83) { + const arg = {}; + rs.byteVecExtendFromSlice(out, rs.stringAsBytes(rs.fmtFormat([(f: rs.Formatter) => Failing.fmt$fmt_Display(arg, f)]).v)); + } else if (k === 84) { + const _585: Failing.Failing = {}; + rs.byteVecExtendFromSlice(out, rs.stringAsBytes(rs.fmtToString((f: rs.Formatter) => Failing.fmt$fmt_Display(_585, f)).v)); } else { if (53 <= k) { if (k <= 56) { - joined(rs.u8Sub(k, 53, { file: "fixtures/lang/panics/src/hooked.rs", line: 321, col: 31 }), n, out); + joined(rs.u8Sub(k, 53, { file: "fixtures/lang/panics/src/hooked.rs", line: 304, col: 31 }), n, out); break b0; } } if (57 <= k) { if (k <= 67) { - rs.byteVecPush(out, compared(rs.u8Sub(k, 57, { file: "fixtures/lang/panics/src/hooked.rs", line: 322, col: 42 }), n)); + rs.byteVecPush(out, compared(rs.u8Sub(k, 57, { file: "fixtures/lang/panics/src/hooked.rs", line: 305, col: 42 }), n)); break b0; } } @@ -540,16 +548,16 @@ export function joined(kind: rs.u8, n: rs.u8, out: rs.ByteVec): void { let joined!: rs.ByteVec; const big: rs.ByteVec = rs.byteVecOf(n, 1 << 16); const refs: (a0: rs.usize) => rs.Vec = (count: rs.usize): rs.Vec => { - return rs.vecFromElem(rs.byteSliceRange(rs.byteVecSlice(big), 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 357, col: 40 }), count, undefined); + return rs.vecFromElem(rs.byteSliceRange(rs.byteVecSlice(big), 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 361, col: 40 }), count, undefined); }; if (kind === 0) { - joined = rs.byteSlicesJoin(rs.sliceFrom(refs(rs.usizeAdd(1 << 16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 359, col: 19 })).items)); + joined = rs.byteSlicesJoin(rs.sliceFrom(refs(rs.usizeAdd(1 << 16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 363, col: 19 })).items)); } else if (kind === 1) { - joined = rs.byteSlicesJoin(rs.sliceFrom(refs(rs.usizeAdd(1 << 16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 360, col: 19 })).items), rs.byteSliceFrom(Uint8Array.of(n))); + joined = rs.byteSlicesJoin(rs.sliceFrom(refs(rs.usizeAdd(1 << 16, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 364, col: 19 })).items), rs.byteSliceFrom(Uint8Array.of(n))); } else if (kind === 2) { - joined = rs.byteSlicesJoin(rs.sliceFrom(refs(rs.usizeAdd(1 << 15, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 361, col: 19 })).items)); + joined = rs.byteSlicesJoin(rs.sliceFrom(refs(rs.usizeAdd(1 << 15, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 365, col: 19 })).items)); } else { - joined = rs.iterToByteVec(rs.iterMap(rs.iterSlice(rs.slicesJoin(rs.sliceFrom(rs.vecFromElem(rs.sliceFrom(rs.vecFromElem(n as rs.u16, 1 << 16, undefined).items), rs.usizeAdd(1 << 14, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 364, col: 42 }), undefined).items), 2, rs.sliceFrom([1])).items), (_2: rs.u16): rs.u8 => { + joined = rs.iterToByteVec(rs.iterMap(rs.iterSlice(rs.slicesJoin(rs.sliceFrom(rs.vecFromElem(rs.sliceFrom(rs.vecFromElem(n as rs.u16, 1 << 16, undefined).items), rs.usizeAdd(1 << 14, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 368, col: 42 }), undefined).items), 2, rs.sliceFrom([1])).items), (_2: rs.u16): rs.u8 => { return _2 & 0xff; }), undefined, true); } @@ -572,10 +580,10 @@ export function compared(kind: rs.u8, n: rs.u8): rs.u8 { const _5: [rs.RefCell, rs.RefCell] = [new rs.RefCell(n), new rs.RefCell(rs.u8WrappingAdd(n, 1))]; const a: rs.RefCell = _5[0]; const b: rs.RefCell = _5[1]; - if (!(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 376, col: 20 }) === 0)) { - _held = rs.refCellBorrowMut(b, { file: "fixtures/lang/panics/src/hooked.rs", line: 376, col: 59 }); + if (!(rs.u8Rem(n, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 380, col: 20 }) === 0)) { + _held = rs.refCellBorrowMut(b, { file: "fixtures/lang/panics/src/hooked.rs", line: 380, col: 59 }); } else { - _held = rs.refCellBorrowMut(a, { file: "fixtures/lang/panics/src/hooked.rs", line: 376, col: 35 }); + _held = rs.refCellBorrowMut(a, { file: "fixtures/lang/panics/src/hooked.rs", line: 380, col: 35 }); } if (kind === 0) { _0 = rs.refCellBy(rs.same, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell.rs", line: 1482, col: 15 }, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell.rs", line: 1482, col: 34 })(a, b) ? 1 : 0; @@ -622,11 +630,11 @@ export function stock(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { const at: rs.usize = n as rs.usize; const whole: rs.ByteSlice = rs.bytesFromVec(rs.byteVecOf(n, 4)); b0: { - const k: rs.u8 = rs.u8Rem(kind, 33, { file: "fixtures/lang/panics/src/hooked.rs", line: 418, col: 24 }); + const k: rs.u8 = rs.u8Rem(kind, 33, { file: "fixtures/lang/panics/src/hooked.rs", line: 422, col: 24 }); if (0 <= k) { if (k <= 1) { rs.setHook((info: rs.PanicHookInfo): undefined => { - const at2: rs.Location = rs.optionUnwrap(info.location, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 420, col: 38 }); + const at2: rs.Location = rs.optionUnwrap(info.location, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 424, col: 38 }); const _10: string = at2.file; const _126: rs.u32 = at2.line; const _14: rs.u32 = at2.col; @@ -635,16 +643,16 @@ export function stock(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { rs.localKeyWithBorrowMut(NOTE, (note: rs.String): undefined => { rs.stringPushStr(note, line.v); }, { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/thread/local.rs", line: 721, col: 38 }); - rs.panicFmt(["unread"], { file: "fixtures/lang/panics/src/hooked.rs", line: 423, col: 13 }); + rs.panicFmt(["unread"], { file: "fixtures/lang/panics/src/hooked.rs", line: 427, col: 13 }); }, { capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/raw_vec/mod.rs", line: 29, col: 5 }, trusted_capacity: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/spec_from_iter_nested.rs", line: 57, col: 18 }, swap_remove: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2178, col: 13 }, vec_set_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 2138, col: 9 }, into_flattened: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/vec/mod.rs", line: 3667, col: 36 }, rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3902, col: 9 }, rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/mod.rs", line: 3948, col: 9 }, ord_violation: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/slice/sort/shared/smallsort.rs", line: 854, col: 5 }, ord_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cmp.rs", line: 1166, col: 9 }, f32_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f32.rs", line: 1665, col: 9 }, f64_clamp: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/num/f64.rs", line: 1643, col: 9 }, encode_utf8: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2507, col: 9 }, encode_utf16: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/char/methods.rs", line: 2601, col: 13 }, format: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/fmt.rs", line: 657, col: 14 }, to_string: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/string.rs", line: 2997, col: 14 }, debug_struct_fields: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/fmt/mod.rs", line: 2572, col: 9 }, exact_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/exact_size.rs", line: 122, col: 9 }, join_len: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/str.rs", line: 177, col: 10 }, int_sum: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/traits/accum.rs", line: 206, col: 1 }, int_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 554, col: 1 }, char_forward: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/iter/range.rs", line: 119, col: 45 }, hash_capacity: { file: "/cargo/registry/25cdd57fae9f0462/hashbrown-0.17.1/src/raw.rs", line: 36, col: 40 }, btree_range_equal_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 110, col: 21 }, btree_range_equal_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 112, col: 21 }, btree_range_order_BTreeSet: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 119, col: 21 }, btree_range_order_BTreeMap: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/btree/search.rs", line: 121, col: 21 }, deque_insert: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2612, col: 9 }, deque_swap_i: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1062, col: 9 }, deque_swap_j: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 1063, col: 9 }, deque_rotate_left: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3198, col: 9 }, deque_rotate_right: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 3243, col: 9 }, deque_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/vec_deque/mod.rs", line: 2724, col: 9 }, list_split_off: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/alloc/src/collections/linked_list.rs", line: 1015, col: 9 }, mutex_lock: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sys/sync/mutex/no_threads.rs", line: 28, col: 9 }, once_force: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/std/src/sync/once.rs", line: 227, col: 20 }, reentrant_init: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/once.rs", line: 325, col: 66 }, lazy_poisoned: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/cell/lazy.rs", line: 386, col: 5 }, ready_poll: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 23, col: 35 }, ready_into_inner: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/future/ready.rs", line: 46, col: 16 }, duration_new: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 281, col: 18 }, duration_from_mins: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 540, col: 13 }, duration_from_hours: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 510, col: 13 }, duration_add: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1345, col: 31 }, duration_sub: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1365, col: 31 }, duration_mul: { file: "/rustc/7df81381d027710708209f36b98d11b1c88f8d2e/library/core/src/time.rs", line: 1385, col: 31 }, bytes_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 207, col: 5 }, bytes_does_not_fit: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/lib.rs", line: 215, col: 5 }, bytes_slice: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 374, col: 28 }, bytes_slice_ref_start: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 426, col: 9 }, bytes_slice_ref_end: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 432, col: 9 }, bytes_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 481, col: 9 }, bytes_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 533, col: 9 }, bytes_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes.rs", line: 694, col: 9 }, bytes_mut_split_off: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 329, col: 9 }, bytes_mut_split_to: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 408, col: 9 }, bytes_mut_set_len: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 545, col: 9 }, bytes_mut_overflow: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 700, col: 21 }, bytes_mut_overflow_offset: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 720, col: 29 }, bytes_mut_buf_advance: { file: "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bytes-1.12.1/src/bytes_mut.rs", line: 1246, col: 9 } }); const subset: rs.ByteSlice = rs.bytesSlice(whole, 0, 1); if (k === 0) { - const _22: rs.ByteSlice = rs.bytesSlice(whole, rs.usizeAdd(1, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 427, col: 34 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 427, col: 30 })); + const _22: rs.ByteSlice = rs.bytesSlice(whole, rs.usizeAdd(1, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 431, col: 34 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 431, col: 30 })); held = rs.bytesSliceRef(_22, subset); rs.bytesDrop(_22); } else { const _32: rs.ByteSlice = rs.bytesSlice(whole, 0, 1); - const _35: rs.ByteSlice = rs.byteSliceRange(whole, 0, rs.usizeAdd(2, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 428, col: 58 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 428, col: 54 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 428, col: 51 }); + const _35: rs.ByteSlice = rs.byteSliceRange(whole, 0, rs.usizeAdd(2, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 432, col: 58 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 432, col: 54 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 432, col: 51 }); held = rs.bytesSliceRef(_32, _35); rs.bytesDrop(_32); } @@ -656,38 +664,38 @@ export function stock(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { } } hook(); - const shared: rs.BytesMut = rs.bytesMutFrom(rs.byteSliceRange(rs.byteSliceFrom(rs.bytes(8).fill(n)), 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 434, col: 44 })); - const _52: rs.u8 = rs.u8Rem(kind, 33, { file: "fixtures/lang/panics/src/hooked.rs", line: 435, col: 11 }); + const shared: rs.BytesMut = rs.bytesMutFrom(rs.byteSliceRange(rs.byteSliceFrom(rs.bytes(8).fill(n)), 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 438, col: 44 })); + const _52: rs.u8 = rs.u8Rem(kind, 33, { file: "fixtures/lang/panics/src/hooked.rs", line: 439, col: 11 }); if (_52 === 2) { - const _56: rs.ByteSlice = rs.bytesSlice(whole, rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 436, col: 49 }), 2); + const _56: rs.ByteSlice = rs.bytesSlice(whole, rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 440, col: 49 }), 2); rs.byteVecExtendFromSlice(out, _56); rs.bytesDrop(_56); } else if (_52 === 3) { - const _63: rs.ByteSlice = rs.bytesSlice(whole, 0, rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 437, col: 51 })); + const _63: rs.ByteSlice = rs.bytesSlice(whole, 0, rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 441, col: 51 })); rs.byteVecExtendFromSlice(out, _63); rs.bytesDrop(_63); } else if (_52 === 4) { - const _72: rs.RangeInclusive = new rs.RangeInclusive(rs.usizeSub(4294967295, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 438, col: 62 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 438, col: 49 }), 4294967295, rs.usizeStep); + const _72: rs.RangeInclusive = new rs.RangeInclusive(rs.usizeSub(4294967295, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 442, col: 62 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 442, col: 49 }), 4294967295, rs.usizeStep); const _70: rs.ByteSlice = rs.bytesSliceInclusive(whole, _72); rs.byteVecExtendFromSlice(out, _70); rs.bytesDrop(_70); } else if (_52 === 5) { let _81: rs.ByteSlice = rs.bytesClone(whole); - const _83: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 439, col: 60 }); + const _83: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 443, col: 60 }); const _79: rs.ByteSlice = rs.bytesSplitTo(rs.place(() => _81, (value9) => _81 = value9), _83); rs.byteVecExtendFromSlice(out, _79); rs.bytesDrop(_79); rs.bytesDrop(_81); } else if (_52 === 6) { let _89: rs.ByteSlice = rs.bytesClone(whole); - const _91: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 440, col: 61 }); + const _91: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 444, col: 61 }); const _87: rs.ByteSlice = rs.bytesSplitOff(rs.place(() => _89, (value8) => _89 = value8), _91); rs.byteVecExtendFromSlice(out, _87); rs.bytesDrop(_87); rs.bytesDrop(_89); } else if (_52 === 7) { let _94: rs.ByteSlice = rs.bytesClone(whole); - const _96: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 441, col: 36 }); + const _96: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 445, col: 36 }); rs.bytesAdvance(rs.place(() => _94, (value7) => _94 = value7), _96); rs.bytesDrop(_94); } else if (_52 === 8) { @@ -696,12 +704,12 @@ export function stock(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { rs.bytesDrop(_101); } else if (_52 === 9) { let _107: rs.ByteSlice = rs.bytesClone(whole); - const _109: rs.usize = rs.usizeAdd(9, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 443, col: 50 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 443, col: 46 }); + const _109: rs.usize = rs.usizeAdd(9, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 447, col: 50 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 447, col: 46 }); rs.byteVecPush(out, rs.u64Low(rs.u64FromBeBytes(rs.bytesReadInt(rs.place(() => _107, (value5) => _107 = value5), 8, _109, false, false))) & 0xff); rs.bytesDrop(_107); } else if (_52 === 10) { - let _114: rs.ByteSlice = rs.byteSliceRange(data, 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 444, col: 21 }); - const _116: rs.usize = rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 444, col: 35 }); + let _114: rs.ByteSlice = rs.byteSliceRange(data, 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 448, col: 21 }); + const _116: rs.usize = rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 448, col: 35 }); rs.byteSliceAdvance(rs.place(() => _114, (value4) => _114 = value4), _116); } else if (_52 === 11) { let _120: rs.ByteSlice = rs.bytesClone(whole); @@ -710,75 +718,75 @@ export function stock(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { rs.bytesDrop(_120); } else if (_52 === 12) { let _129: rs.ByteSlice = rs.bytesClone(whole); - const _131: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 446, col: 66 }); + const _131: rs.usize = rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 450, col: 66 }); const _127: rs.ByteSlice = rs.bytesSplitTo(rs.place(() => _129, (value2) => _129 = value2), _131); rs.byteVecExtendFromSlice(out, _127); rs.bytesDrop(_127); rs.bytesDrop(_129); } else if (_52 === 13) { - let _137: rs.ByteSlice = rs.byteSliceRange(data, 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 447, col: 44 }); - const _139: rs.usize = rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 447, col: 64 }); + let _137: rs.ByteSlice = rs.byteSliceRange(data, 0, undefined, { file: "fixtures/lang/panics/src/hooked.rs", line: 451, col: 44 }); + const _139: rs.usize = rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 451, col: 64 }); const _135: rs.ByteSlice = rs.byteSliceCopyToBytes(rs.place(() => _137, (value) => _137 = value), _139); rs.byteVecExtendFromSlice(out, _135); rs.bytesDrop(_135); } else if (_52 === 14) { const _146: rs.BytesMut = rs.bytesMutFrom(data); - const _144: rs.BytesMut = rs.bytesMutSplitTo(_146, rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 448, col: 68 })); + const _144: rs.BytesMut = rs.bytesMutSplitTo(_146, rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 452, col: 68 })); rs.byteVecExtendFromSlice(out, rs.bytesMutView(_144)); _144[Symbol.dispose](); _146[Symbol.dispose](); } else if (_52 === 15) { const _154: rs.BytesMut = rs.bytesMutWithCapacity(4); - const _152: rs.BytesMut = rs.bytesMutSplitOff(_154, rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 449, col: 75 })); + const _152: rs.BytesMut = rs.bytesMutSplitOff(_154, rs.usizeAdd(at, 5, { file: "fixtures/lang/panics/src/hooked.rs", line: 453, col: 75 })); rs.byteVecExtendFromSlice(out, rs.bytesMutView(_152)); _152[Symbol.dispose](); _154[Symbol.dispose](); } else if (_52 === 16) { - const b: rs.BytesMut = rs.bytesMutWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 451, col: 49 })); - rs.bytesMutSetLen(b, rs.usizeAdd(b.cap, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 453, col: 32 })); + const b: rs.BytesMut = rs.bytesMutWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 455, col: 49 })); + rs.bytesMutSetLen(b, rs.usizeAdd(b.cap, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 457, col: 32 })); rs.byteVecPush(out, b.length & 0xff); b[Symbol.dispose](); } else if (_52 === 17) { - const b2: rs.BytesMut = rs.bytesMutWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 457, col: 49 })); - rs.bytesMutAdvanceMut(b2, rs.usizeAdd(b2.cap, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 459, col: 36 })); + const b2: rs.BytesMut = rs.bytesMutWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 461, col: 49 })); + rs.bytesMutAdvanceMut(b2, rs.usizeAdd(b2.cap, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 463, col: 36 })); rs.byteVecPush(out, b2.length & 0xff); b2[Symbol.dispose](); } else if (_52 === 18) { - const v: rs.ByteVec = rs.byteVecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 463, col: 50 })); - rs.byteVecAdvanceMut(v, rs.usizeAdd(v.data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 465, col: 36 })); + const v: rs.ByteVec = rs.byteVecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 467, col: 50 })); + rs.byteVecAdvanceMut(v, rs.usizeAdd(v.data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 469, col: 36 })); rs.byteVecPush(out, v.length & 0xff); } else if (_52 === 19) { const _197: rs.BytesMut = rs.bytesMutFrom(data); - rs.bytesMutAdvance(_197, rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 468, col: 44 })); + rs.bytesMutAdvance(_197, rs.usizeAdd(data.length, 1, { file: "fixtures/lang/panics/src/hooked.rs", line: 472, col: 44 })); _197[Symbol.dispose](); } else if (_52 === 20) { - const _204: rs.BytesMut = rs.bytesMutFrom(rs.byteSliceRange(data, 0, rs.min(data.length, 3), { file: "fixtures/lang/panics/src/hooked.rs", line: 469, col: 44 })); + const _204: rs.BytesMut = rs.bytesMutFrom(rs.byteSliceRange(data, 0, rs.min(data.length, 3), { file: "fixtures/lang/panics/src/hooked.rs", line: 473, col: 44 })); rs.byteVecPush(out, (rs.bytesMutReadWord(_204, 4, false) as rs.u32) & 0xff); _204[Symbol.dispose](); } else if (_52 === 21) { - const _212: rs.BytesMut = rs.bytesMutWithCapacity(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 470, col: 48 })); + const _212: rs.BytesMut = rs.bytesMutWithCapacity(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 474, col: 48 })); rs.byteVecPush(out, _212.cap & 0xff); _212[Symbol.dispose](); } else if (_52 === 22) { const _tail: rs.BytesMut = rs.bytesMutSplitOff(shared, 4); - rs.bytesMutReserve(shared, rs.usizeSub(4294967295, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 474, col: 41 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 474, col: 28 })); + rs.bytesMutReserve(shared, rs.usizeSub(4294967295, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 478, col: 41 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 478, col: 28 })); _tail[Symbol.dispose](); } else if (_52 === 23) { rs.bytesMutSplitTo(shared, 4)[Symbol.dispose](); - rs.bytesMutReserve(shared, rs.usizeSub(4294967295 - 4, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 479, col: 45 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 479, col: 28 })); + rs.bytesMutReserve(shared, rs.usizeSub(4294967295 - 4, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 483, col: 45 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 483, col: 28 })); } else if (_52 === 24) { const _235: rs.u64 = n as rs.u64; - const _236: rs.usize = rs.usizeAdd(9, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 481, col: 49 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 481, col: 45 }); + const _236: rs.usize = rs.usizeAdd(9, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 485, col: 49 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 485, col: 45 }); rs.bytesMutPutInt(shared, rs.u64ToBeBytes(_235), _236, false); } else if (_52 === 25) { const _240: rs.i64 = n as rs.i64; - const _241: rs.usize = rs.usizeAdd(9, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 482, col: 45 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 482, col: 41 }); + const _241: rs.usize = rs.usizeAdd(9, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 486, col: 45 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 486, col: 41 }); rs.byteVecPutInt(out, rs.i64ToBeBytes(_240), _241, false); } else if (_52 === 26) { - rs.byteVecPutFill(out, n, rs.usizeSub(4294967295, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 483, col: 53 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 483, col: 40 })); + rs.byteVecPutFill(out, n, rs.usizeSub(4294967295, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 487, col: 53 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 487, col: 40 })); } else if (_52 === 27) { const _253: Take.Take = buf_impl_take$bytes_Buf_bytes_Bytes(rs.bytesClone(whole), 2); - const _251: rs.ByteSlice = Take.copyToBytes$bytes_Buf_bytes_Bytes(_253, rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 484, col: 74 })); + const _251: rs.ByteSlice = Take.copyToBytes$bytes_Buf_bytes_Bytes(_253, rs.usizeAdd(at, 3, { file: "fixtures/lang/panics/src/hooked.rs", line: 488, col: 74 })); rs.byteVecExtendFromSlice(out, _251); rs.bytesDrop(_251); drop$bytes_buf_Take_bytes_Bytes(_253); @@ -788,15 +796,15 @@ export function stock(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { drop$bytes_buf_Take_bytes_Bytes(_261); } else if (_52 === 29) { const chunk: rs.ByteSlice = rs.bytesMutChunkMut(shared); - UninitSlice.writeByte(chunk, rs.usizeAdd(UninitSlice.len(chunk), rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 489, col: 44 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 489, col: 30 }), n); + UninitSlice.writeByte(chunk, rs.usizeAdd(UninitSlice.len(chunk), rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 493, col: 44 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 493, col: 30 }), n); } else if (_52 === 30) { - UninitSlice.writeByte(UninitSlice.indexMut$ops_IndexMut_ops_RangeFrom_usize(rs.byteVecChunkMut(rs.byteVecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 491, col: 40 }))), new rs.RangeFrom(rs.usizeAdd(65, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 491, col: 65 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 491, col: 60 }), rs.usizeStep), { file: "fixtures/lang/panics/src/hooked.rs", line: 491, col: 59 }), 0, n); + UninitSlice.writeByte(UninitSlice.indexMut$ops_IndexMut_ops_RangeFrom_usize(rs.byteVecChunkMut(rs.byteVecWithCapacity(rs.usizeRem(at, 4, { file: "fixtures/lang/panics/src/hooked.rs", line: 495, col: 40 }))), new rs.RangeFrom(rs.usizeAdd(65, rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 495, col: 65 }), { file: "fixtures/lang/panics/src/hooked.rs", line: 495, col: 60 }), rs.usizeStep), { file: "fixtures/lang/panics/src/hooked.rs", line: 495, col: 59 }), 0, n); } else if (_52 === 31) { const _287: rs.BytesMut = rs.bytesMutWithCapacity(0); - UninitSlice.copyFromSlice(UninitSlice.indexMut$ops_IndexMut_ops_RangeTo_usize(rs.bytesMutChunkMut(_287), { end: rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 492, col: 45 }) }, { file: "fixtures/lang/panics/src/hooked.rs", line: 492, col: 42 }), rs.byteSliceFrom(rs.bytes(3).fill(n))); + UninitSlice.copyFromSlice(UninitSlice.indexMut$ops_IndexMut_ops_RangeTo_usize(rs.bytesMutChunkMut(_287), { end: rs.usizeRem(at, 2, { file: "fixtures/lang/panics/src/hooked.rs", line: 496, col: 45 }) }, { file: "fixtures/lang/panics/src/hooked.rs", line: 496, col: 42 }), rs.byteSliceFrom(rs.bytes(3).fill(n))); _287[Symbol.dispose](); } else { - const _297: rs.BytesMut = rs.bytesMutZeroed(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 493, col: 40 })); + const _297: rs.BytesMut = rs.bytesMutZeroed(rs.usizeSub(4294967295, at, { file: "fixtures/lang/panics/src/hooked.rs", line: 497, col: 40 })); rs.byteVecPush(out, _297.length & 0xff); _297[Symbol.dispose](); } @@ -812,7 +820,7 @@ export function stock(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { */ export function edition2018Panicked(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { b0: { - if (!(rs.u8Rem(kind, 7, { file: "fixtures/lang/panics/src/hooked.rs", line: 501, col: 8 }) !== 6)) { + if (!(rs.u8Rem(kind, 7, { file: "fixtures/lang/panics/src/hooked.rs", line: 505, col: 8 }) !== 6)) { if (!(option_unwrapOr$1fr498u(rs.byteSliceFirst(data), 0) > 200)) { break b0; } diff --git a/ts/fixtures/lang/panics/hook/expected/located.ts b/ts/fixtures/lang/panics/hook/expected/located.ts index d06e68243..a3c44a448 100644 --- a/ts/fixtures/lang/panics/hook/expected/located.ts +++ b/ts/fixtures/lang/panics/hook/expected/located.ts @@ -119,7 +119,7 @@ export function called(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void { const _75: rs.Location = h(first); const _78: rs.usize = rs.u8Rem(first, 2, { file: "fixtures/lang/panics/src/located.rs", line: 170, col: 61 }) as rs.usize; if (!(_78 < 2)) { - rs.panic("index out of bounds: the len is " + 2 + " but the index is " + _78, { file: "fixtures/lang/panics/src/located.rs", line: 170, col: 46 }, true); + rs.panicSizes(["index out of bounds: the len is ", 2, " but the index is ", _78], { file: "fixtures/lang/panics/src/located.rs", line: 170, col: 46 }); } lines(out, rs.sliceFrom([_73, _74, _75, fs[_78](), own2({})])); } else if (_7 === 4) { @@ -204,7 +204,7 @@ export function panicked(kind: rs.u8, data: rs.ByteSlice, out: rs.ByteVec): void }) as (a0: boolean) => undefined; const _18: rs.usize = rs.u8Rem(first, 2, { file: "fixtures/lang/panics/src/located.rs", line: 261, col: 28 }) as rs.usize; if (!(_18 < 2)) { - rs.panic("index out of bounds: the len is " + 2 + " but the index is " + _18, { file: "fixtures/lang/panics/src/located.rs", line: 261, col: 13 }, true); + rs.panicSizes(["index out of bounds: the len is ", 2, " but the index is ", _18], { file: "fixtures/lang/panics/src/located.rs", line: 261, col: 13 }); } [_15, f][_18](rs.u8Rem(first, 3, { file: "fixtures/lang/panics/src/located.rs", line: 261, col: 40 }) !== 1); } diff --git a/ts/fixtures/lang/panics/src/hooked.rs b/ts/fixtures/lang/panics/src/hooked.rs index a55d819ca..062c6e431 100644 --- a/ts/fixtures/lang/panics/src/hooked.rs +++ b/ts/fixtures/lang/panics/src/hooked.rs @@ -24,14 +24,14 @@ use bytes::{Buf, BufMut, Bytes, BytesMut}; use crate::NOTE; -/// Write what `info` says: its `Display`, its payload's type and text, and its location's -/// parts, and whether the thread is panicking. +/// Write what `info` says: its `Display`, its payload's type and text, a `String` payload's +/// capacity, its location's parts, and whether the thread is panicking. fn record(info: &PanicHookInfo<'_>) { let payload = info.payload(); let kind = if payload.type_id() == std::any::TypeId::of::<&'static str>() { "&str".to_string() - } else if payload.is::() { - "String".to_string() + } else if let Some(s) = payload.downcast_ref::() { + format!("String {}", s.capacity()) } else if let Some(n) = payload.downcast_ref::() { format!("u32 {n}") } else if let Some(n) = payload.downcast_ref::() { @@ -74,17 +74,6 @@ fn hook() { })); } -/// Have the hook also write a `String` payload's capacity, which `panic!` formats into one -/// from empty and `panic_any` keeps. -fn sized() { - let prev = panic::take_hook(); - panic::set_hook(Box::new(move |info| { - let capacity = info.payload().downcast_ref::().map(String::capacity); - NOTE.with_borrow_mut(|note| note.push_str(&format!("capacity {capacity:?}\n"))); - prev(info); - })); -} - #[track_caller] fn tracked(n: u8) -> u8 { panic!("tracked {n}") @@ -97,10 +86,7 @@ pub fn panicked(kind: u8, data: &[u8], out: &mut Vec) { let v = vec![n, n]; match kind % 32 { 0 => panic!("literal"), - 1 => { - sized(); - panic!("formatted {n}") - } + 1 => panic!("formatted {n}"), 2 => out.push(v[usize::from(n) + 2]), 3 => out.push(n.max(200) + n.max(100)), 4 => out.push(Some(n).filter(|_| false).unwrap()), @@ -119,10 +105,7 @@ pub fn panicked(kind: u8, data: &[u8], out: &mut Vec) { 13 => v.clone().rotate_left(usize::from(n) + 3), 14 => out.push(HashMap::::new()[&n]), 15 => panic::panic_any(u32::from(n)), - 16 => { - sized(); - panic::panic_any(format!("any {n}")) - } + 16 => panic::panic_any(format!("any {n}")), 17 => assert_eq!(n, n.wrapping_add(1), "differ"), 18 => out.push(tracked(n)), 19 => out.push(VecDeque::from(v.clone())[usize::from(n) + 2]), @@ -200,7 +183,7 @@ pub fn sited(kind: u8, data: &[u8], out: &mut Vec) { let deque = VecDeque::from(v.clone()); let map = BTreeMap::from([(u16::from(n), n)]); let set = BTreeSet::from([u16::from(n)]); - match kind % 75 { + match kind % 86 { 0 => out.push(Vec::::with_capacity(usize::MAX - at).len() as u8), 1 => v.clone().rotate_right(at + 3), 2 => out.push(n.clamp(n.max(1), n.max(1) - 1)), @@ -346,10 +329,31 @@ pub fn sited(kind: u8, data: &[u8], out: &mut Vec) { std::io::IoSlice::advance_slices(&mut left, at % 2 + 3); out.push(left.len() as u8); } + 74 => v.clone().insert(at + 3, n), + 75 => out.extend(v.clone().split_off(at + 3)), + 76 => out.push(vec![u16::from(n)].remove(at + 1) as u8), + 77 => out.push(vec![u16::from(n)].swap_remove(at + 1) as u8), + 78 => vec![u16::from(n)].insert(at + 2, 0), + 79 => out.extend(vec![u16::from(n)].split_off(at + 2).iter().map(|&w| w as u8)), + 80 => v.clone().copy_within(at + 1..at + 3, 0), + 81 => out.push(u64::from(n).clamp(u64::from(n) + 1, u64::from(n)) as u8), + 82 => out.push((-i32::from(n)).clamp(0, -1) as u8), + 83 => out.extend_from_slice(format!("{Failing}").as_bytes()), + 84 => out.extend_from_slice(Failing.to_string().as_bytes()), _ => out.push(Lying(n).len() as u8), } } +/// A `Display` that fails though the writer did not, which `format!` and `to_string` +/// panic on. +struct Failing; + +impl fmt::Display for Failing { + fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { + Err(fmt::Error) + } +} + /// A `concat` or `join` whose length overflows, by `kind`: its sum of the parts' lengths, /// or the capacity the sum reserves. fn joined(kind: u8, n: u8, out: &mut Vec) { diff --git a/ts/runtime/rs.ts b/ts/runtime/rs.ts index e1f77d1f2..3c1c1aeda 100644 --- a/ts/runtime/rs.ts +++ b/ts/runtime/rs.ts @@ -60,6 +60,14 @@ export function panic(message: string, at?: Location | string, owned?: boolean | throw new Panic(message); } +/** + * Panic at `at` with `message`: literal pieces, and the `usize`s between them, which a + * hook reads as the `String` std's `panic!` writes each piece and number into. + */ +export function panicSizes(message: readonly (string | number)[], at?: Location | string): never { + panicFmt(message.map((part) => (typeof part === "string" ? part : fmtOwned(part as usize, usizeDisplay))), at); +} + /** `resume_unwind`, which aborts as `panic=abort`'s runtime does, running no panic hook. */ export function resumeUnwind(): never { throw new Abort("resume_unwind"); @@ -80,8 +88,8 @@ export function unreachable(_value: unknown): never { /** `assert_eq!` or `assert_ne!` failing: `op` is `==` or `!=`. */ export function assertFailed(op: string, left: Fmt, right: Fmt, args?: Arguments, at?: Location | string): never { - const failed: Arguments = args === undefined ? [" failed"] : [" failed: ", (f) => fmtWriteFmt(f, args)]; - panicFmt(["assertion `left ", op, " right`", ...failed, "\n left: ", left, "\n right: ", right], at); + const failed: Arguments = args === undefined ? [" right` failed\n left: "] : [" right` failed: ", (f) => fmtWriteFmt(f, args), "\n left: "]; + panicFmt(["assertion `left ", op, ...failed, left, "\n right: ", right], at); } // Places @@ -677,8 +685,8 @@ export const OK: Result = /* @__PURE__ */ Object.freeze({ ok: export const ERR: Result = /* @__PURE__ */ Object.freeze({ ok: false, error: undefined }); /** Panic with `message` and `value`'s `Debug`. */ -function unwrapFailed(message: string, value: T, debug: Debug, at?: Location): never { - panicFmt([message, ": ", (f) => debug(value, f)], at); +function unwrapFailed(message: string, value: T, debug: Debug, at?: Location | string): never { + panicFmt([message, ": ", fmtOwned(value, debug)], at); } // A function that may drop an operand std's would, rather than return it, takes what @@ -819,7 +827,7 @@ export function sliceSame(a: Slice, b: Slice): boolean { /** A bounds-checked index into a slice. */ export function idx(slice: { readonly length: number }, index: number, at?: Location): number { - if (index >= slice.length) panic(`index out of bounds: the len is ${slice.length} but the index is ${index}`, at, true); + if (index >= slice.length) panicSizes(["index out of bounds: the len is ", slice.length, " but the index is ", index], at); return index; } @@ -830,9 +838,9 @@ export function at(slice: ArrayLike, index: number, at?: Location): T { /** Panic unless `start..end` is in a slice of `length`, as std's range checks do. */ export function rangeCheck(length: number, start: number, end: number, at?: Location): void { - if (start > length) panic(`range start index ${start} out of range for slice of length ${length}`, at, true); - if (end > length) panic(`range end index ${end} out of range for slice of length ${length}`, at, true); - if (start > end) panic(`slice index starts at ${start} but ends at ${end}`, at, true); + if (start > length) panicSizes(["range start index ", start, " out of range for slice of length ", length], at); + if (end > length) panicSizes(["range end index ", end, " out of range for slice of length ", length], at); + if (start > end) panicSizes(["slice index starts at ", start, " but ends at ", end], at); } /** `&s[start..end]` and `&mut s[start..end]`, with `end` defaulting to the length. */ @@ -1455,7 +1463,7 @@ export function sliceCopyWithin(s: Slice, start: number, end: number, dest /** `copy_within`'s checks of `start..end` and `dest` in `length` elements. */ function copyWithinCheck(length: number, start: number, end: number, dest: number, at?: Location): void { // `slice::range` checks the end first, then `range` reports the rest. - if (end > length) panic(`range end index ${end} out of range for slice of length ${length}`, at, true); + if (end > length) panicSizes(["range end index ", end, " out of range for slice of length ", length], at); rangeCheck(length, start, end, at); if (dest > length - (end - start)) panic("dest is out of bounds", at); } @@ -1493,7 +1501,7 @@ export function sliceWriteCloneOfSlice(dst: Slice, src: Slice, clone: ( } function writeCloneLengthFail(dst: number, src: number, at?: Location): never { - panic(`assertion \`left == right\` failed: destination and source slices have different lengths\n left: ${dst}\n right: ${src}`, at, true); + assertFailed("==", fmtOwned(dst as usize, usizeDebug), fmtOwned(src as usize, usizeDebug), ["destination and source slices have different lengths"], at); } /** `Box::new_uninit_slice` of `size`-byte elements: `n` of what `uninit` makes, panicking past what a `Vec` of them may hold. */ @@ -1589,7 +1597,7 @@ export function byteBoxSliceCloneFrom(dst: ByteSlice, src: ByteSlice, at?: Locat } function copyLengthFail(dst: number, src: number, at?: Location): never { - panic(`copy_from_slice: source slice length (${src}) does not match destination slice length (${dst})`, at, true); + panicSizes(["copy_from_slice: source slice length (", src, ") does not match destination slice length (", dst, ")"], at); } /** @@ -1685,7 +1693,7 @@ export function arrayAssign(p: T[], value: T[]): void { /** `Vec::insert`: `item` at `i`, with those from `i` on moved up. */ export function vecInsert(v: Vec, i: number, item: T, at?: Location): void { - if (i > v.items.length) panic(`insertion index (is ${i}) should be <= len (is ${v.items.length})`, at, true); + if (i > v.items.length) panicSizes(["insertion index (is ", i, ") should be <= len (is ", v.items.length, ")"], at); v.items.splice(i, 0, item); } @@ -1742,7 +1750,7 @@ export function vecPopIfMut( /** `Vec::remove`: the element at `i`, with those after it moved down. */ export function vecRemove(v: Vec, i: number, at?: Location): T { - if (i >= v.items.length) panic(`removal index (is ${i}) should be < len (is ${v.items.length})`, at, true); + if (i >= v.items.length) panicSizes(["removal index (is ", i, ") should be < len (is ", v.items.length, ")"], at); vecKeep(v); return v.items.splice(i, 1)[0]; } @@ -1758,7 +1766,7 @@ export function vecTruncate(v: Vec, len: number, drop?: (item: T) => void) /** `Vec::swap_remove`: the element at `i`, with the last moved into its place. */ export function vecSwapRemove(v: Vec, i: number): T { const d = v.items; - if (i >= d.length) panic(`swap_remove index (is ${i}) should be < len (is ${d.length})`, "swap_remove", true); + if (i >= d.length) panicSizes(["swap_remove index (is ", i, ") should be < len (is ", d.length, ")"], "swap_remove"); vecKeep(v); const item = d[i]; d[i] = d[d.length - 1]; @@ -1831,7 +1839,7 @@ export function vecResizeWith(v: Vec, len: number, f: () => T, size: numbe /** `Vec::split_off`: those from `mid` on, moved to a new vector with room for exactly them. */ export function vecSplitOff(v: Vec, mid: number, at?: Location): Vec { - if (mid > v.items.length) panic(`\`at\` split index (is ${mid}) should be <= len (is ${v.items.length})`, at, true); + if (mid > v.items.length) panicSizes(["`at` split index (is ", mid, ") should be <= len (is ", v.items.length, ")"], at); vecKeep(v); return vecFrom(v.items.splice(mid)); } @@ -2309,7 +2317,7 @@ export function byteVecClear(v: ByteVec): void { /** `Vec::insert`: `byte` at `i`, with those from `i` on moved up. */ export function byteVecInsert(v: ByteVec, i: number, byte: number, at?: Location): void { - if (i > v.length) panic(`insertion index (is ${i}) should be <= len (is ${v.length})`, at, true); + if (i > v.length) panicSizes(["insertion index (is ", i, ") should be <= len (is ", v.length, ")"], at); reserve(v, 1); v.data.copyWithin(i + 1, i, v.length); v.data[i] = byte; @@ -2318,7 +2326,7 @@ export function byteVecInsert(v: ByteVec, i: number, byte: number, at?: Location /** `Vec::remove`: the byte at `i`, with those after it moved down. */ export function byteVecRemove(v: ByteVec, i: number, at?: Location): number { - if (i >= v.length) panic(`removal index (is ${i}) should be < len (is ${v.length})`, at, true); + if (i >= v.length) panicSizes(["removal index (is ", i, ") should be < len (is ", v.length, ")"], at); const byte = v.data[i]; v.data.copyWithin(i, i + 1, v.length); v.length--; @@ -2327,7 +2335,7 @@ export function byteVecRemove(v: ByteVec, i: number, at?: Location): number { /** `Vec::swap_remove`: the byte at `i`, with the last moved into its place. */ export function byteVecSwapRemove(v: ByteVec, i: number): number { - if (i >= v.length) panic(`swap_remove index (is ${i}) should be < len (is ${v.length})`, "swap_remove", true); + if (i >= v.length) panicSizes(["swap_remove index (is ", i, ") should be < len (is ", v.length, ")"], "swap_remove"); const byte = v.data[i]; v.data[i] = v.data[--v.length]; return byte; @@ -2742,7 +2750,7 @@ export function byteVecResizeWith(v: ByteVec, len: number, f: () => number): voi /** `Vec::split_off` of bytes. */ export function byteVecSplitOff(v: ByteVec, mid: number, at?: Location): ByteVec { - if (mid > v.length) panic(`\`at\` split index (is ${mid}) should be <= len (is ${v.length})`, at, true); + if (mid > v.length) panicSizes(["`at` split index (is ", mid, ") should be <= len (is ", v.length, ")"], at); const other = new ByteVec(v.length - mid); copyBytes(other.data, 0, v.data, mid, v.length - mid); other.length = v.length - mid; @@ -3531,9 +3539,8 @@ function closePretty(f: Formatter, close: string): FmtResult { */ export function fmtFormat(args: Arguments): RsString { const s = stringWithCapacity(estimate(args) as usize); - if (!write(new StringWriter(s), args).ok) { - panic("a formatting trait implementation returned an error when the underlying stream did not: Error", "format", true); - } + const r = write(new StringWriter(s), args); + if (!r.ok) unwrapFailed("a formatting trait implementation returned an error when the underlying stream did not", r.error, fmtErrorDebug, "format"); return s; } @@ -3563,7 +3570,8 @@ function estimate(args: Arguments): number { */ export function fmtToString(value: Fmt, size?: number): RsString { const s = stringNew(); - if (!value({ out: new StringWriter(s), spec: {} }).ok) panic("a Display implementation returned an error unexpectedly: Error", "to_string", true); + const r = value({ out: new StringWriter(s), spec: {} }); + if (!r.ok) unwrapFailed("a Display implementation returned an error unexpectedly", r.error, fmtErrorDebug, "to_string"); if (size !== undefined) s.cap = (size === 0 ? s.len : size + (s.v.startsWith("-") ? 1 : 0)) as usize; return s; } diff --git a/ts/runtime/rs/bytes.ts b/ts/runtime/rs/bytes.ts index 1a8bf2cfb..e3930dc8e 100644 --- a/ts/runtime/rs/bytes.ts +++ b/ts/runtime/rs/bytes.ts @@ -23,6 +23,7 @@ import { fmtWriteStr, type Place, panic, + panicSizes, type RangeInclusive, type Result, Err, @@ -156,8 +157,8 @@ export function bytesTryIntoMut(b: Bytes): Result { /** `Bytes::slice` of `begin..end`, `end` defaulting to the length, panicking as `bytes` does. */ export function bytesSlice(b: Bytes, begin: usize, end: usize = b.length as usize): Bytes { - if (begin > end) panic(`range start must not be greater than end: ${begin} <= ${end}`, "bytes_slice", true); - if (end > b.length) panic(`range end out of bounds: ${end} <= ${b.length}`, "bytes_slice", true); + if (begin > end) panicSizes(["range start must not be greater than end: ", begin, " <= ", end], "bytes_slice"); + if (end > b.length) panicSizes(["range end out of bounds: ", end, " <= ", b.length], "bytes_slice"); if (begin === end) return new ByteSlice(b.data, b.start + begin, 0); return part(b, b.start + begin, end - begin); } @@ -212,7 +213,7 @@ export function bytesSplitTo(p: Place, pos: usize): Bytes { return b; } if (pos === 0) return new ByteSlice(b.data, b.start, 0); - if (pos > b.length) panic(`split_to out of bounds: ${pos} <= ${b.length}`, "bytes_split_to", true); + if (pos > b.length) panicSizes(["split_to out of bounds: ", pos, " <= ", b.length], "bytes_split_to"); const head = part(b, b.start, pos); p.v = moved(b, b.start + pos, b.length - pos); return head; @@ -226,7 +227,7 @@ export function bytesSplitOff(p: Place, pos: usize): Bytes { p.v = new ByteSlice(b.data, b.start, 0); return b; } - if (pos > b.length) panic(`split_off out of bounds: ${pos} <= ${b.length}`, "bytes_split_off", true); + if (pos > b.length) panicSizes(["split_off out of bounds: ", pos, " <= ", b.length], "bytes_split_off"); const tail = part(b, b.start + pos, b.length - pos); p.v = moved(b, b.start, pos); return tail; @@ -269,17 +270,17 @@ export function bytesSliceRef(b: Bytes, subset: ByteSlice): Bytes { /** `bytes`' panic for reading or advancing past what remains. */ function panicAdvance(requested: number, available: number): never { - panic(`advance out of bounds: the len is ${available} but advancing by ${requested}`, "bytes_advance", true); + panicSizes(["advance out of bounds: the len is ", available, " but advancing by ", requested], "bytes_advance"); } /** The `Buf` of `Bytes` or `BytesMut` advancing past what remains, which asserts at the key of its site. */ function panicRemaining(cnt: number, remaining: number, site: string): never { - panic(`cannot advance past \`remaining\`: ${cnt} <= ${remaining}`, site, true); + panicSizes(["cannot advance past `remaining`: ", cnt, " <= ", remaining], site); } /** `nbytes` read into an integer of `size` bytes, which holds at most that many. */ function checkFits(size: number, nbytes: number): void { - if (nbytes > size) panic(`size too large: the integer type can fit ${size} bytes, but nbytes is ${nbytes}`, "bytes_does_not_fit", true); + if (nbytes > size) panicSizes(["size too large: the integer type can fit ", size, " bytes, but nbytes is ", nbytes], "bytes_does_not_fit"); } /** `n` bytes from the front of `s`, the other way around if `le`. */ @@ -764,7 +765,7 @@ export function bytesMutPutBytes(b: BytesMut, be: Uint8Array, le: boolean): void /** `BufMut::put_uint` or `put_int`: the low `nbytes` of the big-endian bytes, which `bytes` checks against `size` the other way around. */ export function bytesMutPutInt(b: BytesMut, be: Uint8Array, nbytes: usize, le: boolean): void { - if (nbytes > be.length) panic(`size too large: the integer type can fit ${nbytes} bytes, but nbytes is ${be.length}`, "bytes_does_not_fit", true); + if (nbytes > be.length) panicSizes(["size too large: the integer type can fit ", nbytes, " bytes, but nbytes is ", be.length], "bytes_does_not_fit"); bytesMutPutBytes(b, be.subarray(be.length - nbytes), le); } @@ -871,7 +872,7 @@ export function bytesMutResize(b: BytesMut, len: usize, value: number): void { /** `BytesMut::split_to`: the first `at` bytes, sharing the storage, leaving the rest. */ export function bytesMutSplitTo(b: BytesMut, pos: usize): BytesMut { - if (pos > b.length) panic(`split_to out of bounds: ${pos} <= ${b.length}`, "bytes_mut_split_to", true); + if (pos > b.length) panicSizes(["split_to out of bounds: ", pos, " <= ", b.length], "bytes_mut_split_to"); const head = new BytesMut(b.data, b.start, pos, pos, share(b), 0); advanceUnchecked(b, pos); return head; @@ -879,7 +880,7 @@ export function bytesMutSplitTo(b: BytesMut, pos: usize): BytesMut { /** `BytesMut::split_off`: what it holds and has room for from `at` on, sharing the storage, leaving the rest. */ export function bytesMutSplitOff(b: BytesMut, pos: usize): BytesMut { - if (pos > b.cap) panic(`split_off out of bounds: ${pos} <= ${b.cap}`, "bytes_mut_split_off", true); + if (pos > b.cap) panicSizes(["split_off out of bounds: ", pos, " <= ", b.cap], "bytes_mut_split_off"); const tail = new BytesMut(b.data, b.start, b.length, b.cap, share(b), 0); advanceUnchecked(tail, pos); b.cap = pos; @@ -985,7 +986,7 @@ export function byteVecPutBytes(v: ByteVec, be: Uint8Array, le: boolean): void { /** `BufMut::put_uint` or `put_int` to a `Vec`, as `bytesMutPutInt`. */ export function byteVecPutInt(v: ByteVec, be: Uint8Array, nbytes: usize, le: boolean): void { - if (nbytes > be.length) panic(`size too large: the integer type can fit ${nbytes} bytes, but nbytes is ${be.length}`, "bytes_does_not_fit", true); + if (nbytes > be.length) panicSizes(["size too large: the integer type can fit ", nbytes, " bytes, but nbytes is ", be.length], "bytes_does_not_fit"); byteVecPutBytes(v, be.subarray(be.length - nbytes), le); } diff --git a/ts/runtime/rs/char.ts b/ts/runtime/rs/char.ts index 87b0c48a4..7e33ae33c 100644 --- a/ts/runtime/rs/char.ts +++ b/ts/runtime/rs/char.ts @@ -4,8 +4,8 @@ // Each reads std's own Unicode tables, which `rs/unicode.ts` holds, rather than the // engine's, whose Unicode version may differ from std's. -import { type ByteSlice, type Debug, debugListEntry, debugListFinish, debugStructField, debugStructFinish, debugTupleField, debugTupleFinish, Err, type FmtResult, type Formatter, fmtCharDebug, fmtDebugList, fmtDebugStruct, fmtDebugStructFields, fmtDebugTuple, fmtOption, fmtPad, fmtUnit, fmtWriteFmt, OK, Ok, type Place, panic, type Result, Slice } from "../rs.ts"; -import { type char, type u8, type u16, u16Debug, u16LowerHex, type u32, type usize } from "./int.ts"; +import { type ByteSlice, type Debug, debugListEntry, debugListFinish, debugStructField, debugStructFinish, debugTupleField, debugTupleFinish, Err, type FmtResult, type Formatter, fmtCharDebug, fmtDebugList, fmtDebugStruct, fmtDebugStructFields, fmtDebugTuple, fmtOption, fmtOwned, fmtPad, fmtSpec, fmtUnit, fmtWriteFmt, OK, Ok, type Place, panic, panicFmt, type Result, Slice } from "../rs.ts"; +import { type char, type u8, type u16, u16Debug, u16LowerHex, type u32, u32UpperHex, type usize, usizeDisplay } from "./int.ts"; import { type Clones, DONE, type Done, Iter, iterFlatMap, iterHeld, type SizeHint } from "./iter.ts"; import { type String as RsString, strChars, stringCased } from "./str.ts"; import { drop as dispose } from "./task.ts"; @@ -408,8 +408,8 @@ export function charLenUtf16(c: char): usize { /** std's panic for a buffer too short to encode `c` into, by `encode_utf8` or `encode_utf16`. */ function tooShort(encoding: string, c: char, len: number, has: number): never { - const code = c.toString(16).toUpperCase().padStart(4, "0"); - panic(`${encoding}: need ${len} bytes to encode U+${code} but buffer has just ${has}`, encoding, true); + const code = fmtSpec({ zero: true, width: 4 }, fmtOwned(c as u32, u32UpperHex)); + panicFmt([`${encoding}: need `, fmtOwned(len as usize, usizeDisplay), " bytes to encode U+", code, " but buffer has just ", fmtOwned(has as usize, usizeDisplay)], encoding); } /** The `&mut str` `encode_utf8` returns: the bytes it wrote, which a write changes in place. */ diff --git a/ts/runtime/rs/collections.ts b/ts/runtime/rs/collections.ts index f7b226f8f..1b268dd0a 100644 --- a/ts/runtime/rs/collections.ts +++ b/ts/runtime/rs/collections.ts @@ -15,7 +15,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 { Borrowed, ByteSlice, ByteVec, byteVecPush, byteVecReserve, capReserve, capReserveExact, capTryReserve, capTryReserveExact, type CloneFrom, type Debug, debugStructField, debugStructFinishNonExhaustive, Err, type Fmt, fmtDebugStruct, fmtDebugStructFields, fmtDebugTupleFields, fmtIter, fmtList, type FmtResult, fmtSet, fmtTuple, type Formatter, type None, OK, Ok, panic, type Place, type RangeBound, rangeCheck, type Result, type Room, roomPast, searchBy, type Elements, Slice, sliceData, sliceFrom, sliceLength, sliceSort, sliceStart, Vec, vecAppend, vecCapacity, vecCloneFrom, vecFrom, vecHold, vecKeep, vecMax, vecReserve, vecWithCapacity } from "../rs.ts"; +import { Borrowed, ByteSlice, ByteVec, byteVecPush, byteVecReserve, capReserve, capReserveExact, capTryReserve, capTryReserveExact, type CloneFrom, type Debug, debugStructField, debugStructFinishNonExhaustive, Err, type Fmt, fmtDebugStruct, fmtDebugStructFields, fmtDebugTupleFields, fmtIter, fmtList, type FmtResult, fmtSet, fmtTuple, type Formatter, type None, OK, Ok, panic, panicSizes, type Place, type RangeBound, rangeCheck, type Result, type Room, roomPast, searchBy, type Elements, Slice, sliceData, sliceFrom, sliceLength, sliceSort, sliceStart, Vec, vecAppend, vecCapacity, vecCloneFrom, vecFrom, vecHold, vecKeep, vecMax, vecReserve, vecWithCapacity } from "../rs.ts"; import { allocError, CAPACITY_OVERFLOW, type TryReserveError } from "./alloc.ts"; import type { HashKey, Hashing } from "./hash.ts"; import { type Limbs, lt, type u64, type usize } from "./int.ts"; @@ -4132,7 +4132,7 @@ function inclusive(r: Bounds): r is RangeInclusive { /** std's `slice_index_fail`, which names the end where neither bound is out of order. */ function sliceIndexFail(start: number, end: number, n: number, at?: Location): never { rangeCheck(n, start, end, at); - return panic(`range end index ${end} out of range for slice of length ${n}`, at, true); + return panicSizes(["range end index ", end, " out of range for slice of length ", n], at); } // `Vec::drain`, which leaves the vector only what comes before the range until the drain diff --git a/ts/runtime/rs/float.ts b/ts/runtime/rs/float.ts index 627fe1607..c5b4b319b 100644 --- a/ts/runtime/rs/float.ts +++ b/ts/runtime/rs/float.ts @@ -11,7 +11,7 @@ // and its payload at the top, which a signaling one keeps, where JS's conversion from a // single would quiet it. -import { Err, type FmtPart, type FmtResult, type Formatter, fmtPadFormatted, fmtToString, Ok, panic, type Result } from "../rs.ts"; +import { Err, type FmtPart, type FmtResult, type Formatter, fmtOwned, fmtPadFormatted, Ok, panicFmt, type Result } from "../rs.ts"; import type { Ordering } from "./collections.ts"; import { type f32, type f64, type u32, type u64, u64FromHalves } from "./int.ts"; @@ -312,10 +312,7 @@ function mulAddExact(a: number, b: number, c: number): number { /** `clamp`, which panics with both bounds' `Debug` unless `min <= max`. */ function clamp(x: number, min: number, max: number, debug: (x: number, f: Formatter) => FmtResult, key: string): number { - if (!(min <= max)) { - const text = (v: number) => fmtToString((f) => debug(v, f)).v; - panic(`min > max, or either was NaN. min = ${text(min)}, max = ${text(max)}`, key, true); - } + if (!(min <= max)) panicFmt(["min > max, or either was NaN. min = ", fmtOwned(min, debug), ", max = ", fmtOwned(max, debug)], key); return x < min ? min : x > max ? max : x; } diff --git a/ts/runtime/rs/int.ts b/ts/runtime/rs/int.ts index edb263aa5..0fc6e5daf 100644 --- a/ts/runtime/rs/int.ts +++ b/ts/runtime/rs/int.ts @@ -6,7 +6,7 @@ // 32-bit limbs. Arithmetic is checked as a debug build checks it: overflow panics, it // never wraps silently. Every panic's message is the one native Rust panics with. -import { Err, type Formatter, type FmtResult, fmtPadFormatted, fmtPadIntegral, Ok, panic, type Result } from "../rs.ts"; +import { Err, type Formatter, type FmtResult, fmtOwned, fmtPadFormatted, fmtPadIntegral, Ok, panic, panicFmt, type Result } from "../rs.ts"; import type { Location } from "./location.ts"; declare const brand: unique symbol; @@ -177,7 +177,7 @@ export function min(a: number, b: number): number { /** `Ord::clamp` of integers in numbers: `a` within `[min, max]`, panicking unless `min <= max`. */ export function clamp(a: number, min: number, max: number, at?: Location): number { - if (min > max) panic(`min > max. min = ${min}, max = ${max}`, at, true); + if (min > max) panicFmt(["min > max. min = ", fmtOwned(min, display), ", max = ", fmtOwned(max, display)], at); return a < min ? min : a > max ? max : a; } @@ -1042,14 +1042,9 @@ function multiple(a: Wide, b: Wide, bits: number, at?: Location): boolean { return b === 0 ? a === 0 : rem(a, b, bits, false, at) === 0; } -/** A wide value's decimal text, as its `Debug` writes it. */ -function decimal(v: Wide): string { - return typeof v === "number" ? String(v) : String(exact(v)); -} - /** `Ord::clamp` of wide values: `a` within `[min, max]`, panicking unless `min <= max`. */ function clampWide(a: Wide, min: Wide, max: Wide, at?: Location): Wide { - if (lt(max, min)) panic(`min > max. min = ${decimal(min)}, max = ${decimal(max)}`, at, true); + if (lt(max, min)) panicFmt(["min > max. min = ", fmtOwned(min, wideDisplay), ", max = ", fmtOwned(max, wideDisplay)], at); return lt(a, min) ? min : lt(max, a) ? max : a; } diff --git a/ts/runtime/rs/iter.ts b/ts/runtime/rs/iter.ts index a687c45f3..2a87a15cd 100644 --- a/ts/runtime/rs/iter.ts +++ b/ts/runtime/rs/iter.ts @@ -22,7 +22,7 @@ // `owned` functions follow it, dispatching on the kind, so a bundle that never drops an // item carries none of it. -import { ByteSlice, ByteVec, byteVecExtendFromSlice, byteVecPush, byteVecReserve, byteVecReserveExact, byteVecShrinkTo, byteVecWithCapacity, capReserve, type Debug, Err, type Fmt, type FmtResult, type Formatter, fmtBool, fmtDebugStructFields, fmtDebugTupleFields, fmtOption, type None, Ok, type Place, panic, place, type RangeBound, type Result, sliceItems, slicePart, type Slice, type SliceLike, Vec, vecCapacity, vecExtendFromSlice, vecFrom, vecHold, vecMax, vecWithCapacity } from "../rs.ts"; +import { assertFailed, ByteSlice, ByteVec, byteVecExtendFromSlice, byteVecPush, byteVecReserve, byteVecReserveExact, byteVecShrinkTo, byteVecWithCapacity, capReserve, type Debug, Err, type Fmt, type FmtResult, type Formatter, fmtBool, fmtDebugStructFields, fmtDebugTupleFields, fmtOption, fmtOwned, type None, Ok, type Place, panic, place, type RangeBound, type Result, sliceItems, slicePart, type Slice, type SliceLike, Vec, vecCapacity, vecExtendFromSlice, vecFrom, vecHold, vecMax, vecWithCapacity } from "../rs.ts"; import { AtIndex, BTreeIter, HashIter, type Ordering } from "./collections.ts"; import { type Hasher, hash8 } from "./hash.ts"; import { charStep, intToBig, type Limbs, type Step, usizeDebug, lt as wideLt } from "./int.ts"; @@ -68,8 +68,8 @@ export function exactHint(n: number): SizeHint { function hintLen(it: Iter): number { const [lower, upper] = it.sizeHint(); if (upper !== lower) { - const left = upper === undefined ? "None" : `Some(${upper})`; - panic(`assertion \`left == right\` failed\n left: ${left}\n right: Some(${lower})`, "exact_len", true); + const hint = (n: number | undefined, f: Formatter) => fmtOption(n, f, usizeDebug); + assertFailed("==", fmtOwned(upper, hint), fmtOwned(lower, hint), undefined, "exact_len"); } return lower; } diff --git a/ts/runtime/rs/str.ts b/ts/runtime/rs/str.ts index cde28f933..944e55f1d 100644 --- a/ts/runtime/rs/str.ts +++ b/ts/runtime/rs/str.ts @@ -26,6 +26,7 @@ import { fmtDebugStructFields, fmtDebugTupleFields, fmtList, + fmtOwned, fmtPad, fmtStr, OK, @@ -33,6 +34,7 @@ import { type Place, panic, panicFmt, + panicSizes, type Result, type StrCow, utf8Check, @@ -184,16 +186,17 @@ export function strSplitAtMutChecked(p: Place, mid: number): [Place len) panic(`start byte index ${start} is out of bounds for string of length ${len}`, at, true); - if (end > len) panic(`end byte index ${end} is out of bounds for string of length ${len}`, at, true); - if (start > end) panic(`byte range starts at ${start} but ends at ${end}`, at, true); + const outOfBounds = (): never => panicSizes(["end byte index ", end, " is out of bounds for string of length ", len], at); + if (start > len) panicSizes(["start byte index ", start, " is out of bounds for string of length ", len], at); + if (end > len) outOfBounds(); + if (start > end) panicSizes(["byte range starts at ", start, " but ends at ", end], at); // Neither inside a char: an inclusive end at the length, which is past the last byte. const [which, pos] = unitAt(s, 0, 0, start) < 0 ? ["start", start] : unitAt(s, 0, 0, end) < 0 ? ["end", end] - : panic(`end byte index ${end} is out of bounds for string of length ${len}`, at, true); + : outOfBounds(); // The char `at` is inside, and where its bytes start. let floor = 0; let c = 0; @@ -202,11 +205,8 @@ function sliceFailed(s: string, start: number, end: number, at?: Location): neve if (floor + charLen(c) > pos) break; floor += charLen(c); } - panicFmt([ - `${which} byte index ${pos} is not a char boundary; it is inside `, - (f) => fmtCharDebug(c as char, f), - ` (bytes ${floor}..${floor + charLen(c)} of string)`, - ], at); + const size = (n: number): Fmt => fmtOwned(n as usize, usizeDebug); + panicFmt([`${which} byte index `, size(pos), " is not a char boundary; it is inside ", fmtOwned(c as char, fmtCharDebug), " (bytes ", size(floor), "..", size(floor + charLen(c)), " of string)"], at); } /** `str::chars`. */ diff --git a/ts/runtime/rs/task.ts b/ts/runtime/rs/task.ts index 9a14842ed..2b1627f67 100644 --- a/ts/runtime/rs/task.ts +++ b/ts/runtime/rs/task.ts @@ -4,7 +4,7 @@ // A value whose drop JS can observe has `[Symbol.dispose]`, which runs its `Drop` impl // and drops its fields. `None` is `undefined`, which drops as nothing. -import { Abort, arrayAssign, type ByteSlice, type CloneFrom, cloneOver, type Debug, type DebugStruct, debugStructField, debugStructFinish, debugStructFinishNonExhaustive, debugTupleField, debugTupleFinish, Err, type FmtResult, type Formatter, fmtBool, fmtDebugStruct, fmtDebugTuple, fmtDebugTupleFields, fmtPad, fmtStr, type None, NULL, objectCopy, OK, Ok, Panic, panic, type Place, place, ptrErase, ptrHome, ptrNowhere, ptrWrite, type Result, Slice, stringAsBytes, type Vec } from "../rs.ts"; +import { Abort, arrayAssign, assertFailed, type ByteSlice, type CloneFrom, cloneOver, type Debug, type DebugStruct, debugStructField, debugStructFinish, debugStructFinishNonExhaustive, debugTupleField, debugTupleFinish, Err, type FmtResult, type Formatter, fmtBool, fmtDebugStruct, fmtDebugTuple, fmtDebugTupleFields, fmtOwned, fmtPad, fmtStr, type None, NULL, objectCopy, OK, Ok, Panic, panic, type Place, place, ptrErase, ptrHome, ptrNowhere, ptrWrite, type Result, Slice, stringAsBytes, type Vec } from "../rs.ts"; import type { Hasher } from "./hash.ts"; import type { Location } from "./location.ts"; @@ -514,7 +514,7 @@ const WOULD_BLOCK: Result> = /* @__PURE__ */ Err({ ta /** `Mutex::lock`: its guard, which is the mutex. Locking it again while held panics, as wasm32's does. */ export function mutexLock(mutex: Mutex): Mutex { - if (mutex.locked) panic("assertion `left == right` failed: cannot recursively acquire mutex\n left: true\n right: false", "mutex_lock", true); + if (mutex.locked) assertFailed("==", fmtOwned(true, fmtBool), fmtOwned(false, fmtBool), ["cannot recursively acquire mutex"], "mutex_lock"); mutex.locked = true; return mutex; } diff --git a/ts/src/lower/mir/call.rs b/ts/src/lower/mir/call.rs index 4da8a6602..9d7fc0637 100644 --- a/ts/src/lower/mir/call.rs +++ b/ts/src/lower/mir/call.rs @@ -113,7 +113,15 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { (cast, true) } ty::FnDef(def_id, gargs) => match self.intercept(def_id, gargs.skip_binder(), args, dest, span, &mut pre) { - Some(Some(done)) => done, + // Where std's function panics, as its library mapping is located: at its + // caller's call, not where the statement starts, which may be its receiver. + Some(Some((mut value, effect))) => { + if let Some((_, Some(at))) = &self.b.std_site { + crate::lower::caller::locate_expr(&mut value, at); + crate::lower::caller::locate(&mut pre, at); + } + (value, effect) + } // Done: the destination is set. Some(None) => { self.emit(pre, false, out); diff --git a/ts/src/lower/mir/mod.rs b/ts/src/lower/mir/mod.rs index 45dc195cb..8af131767 100644 --- a/ts/src/lower/mir/mod.rs +++ b/ts/src/lower/mir/mod.rs @@ -3140,10 +3140,17 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { match msg { AssertKind::ResumedAfterReturn(kind) if async_fn(kind) => Some(Expr::rs("asyncFnResumed", Vec::new())), AssertKind::ResumedAfterPanic(kind) if async_fn(kind) => Some(Expr::rs("asyncFnResumedPanic", Vec::new())), - // A hook reads a bounds check's message as the `String` std formats. + // A hook reads a bounds check's message as the `String` std writes piece by piece. AssertKind::BoundsCheck { .. } if let Some(at) = self.panic_at() => { - let message = self.assert_message(msg, operands, span)?; - Some(Expr::rs("panic", vec![message, at, Expr::lit("true")])) + let [len, index] = <[Expr; 2]>::try_from(operands).ok()?; + let text = |s: &str| Expr::Str(s.to_string()); + let message = vec![ + text("index out of bounds: the len is "), + len, + text(" but the index is "), + index, + ]; + Some(Expr::rs("panicSizes", vec![Expr::Array(message), at])) } _ => { let message = self.assert_message(msg, operands, span)?;