chore(warnings): take the workspace from 492 rustc warnings to 0, and gate it#6837
chore(warnings): take the workspace from 492 rustc warnings to 0, and gate it#6837TheHypnoo wants to merge 12 commits into
Conversation
…argets Run `cargo fix --workspace --all-targets` now that the workspace test targets compile again, so test-only imports are seen instead of pruned. Clears 87 warnings: 74 unused_imports, 11 function_casts_as_integer (new in rustc 1.95 — casting a function item straight to an integer), plus one each of unused_mut and unused_variables. Two things the tool could not do on its own: - optimized_libs/tests.rs reached build_missing_prebuilt_ext_lib through `super::*`, so cargo fix pruned the re-export it needed. The test now imports the function from no_auto directly. - 49 of the pruned imports were duplicate preambles introduced when commands/compile.rs was split into submodules after #6639.
rustc reports these as `unused_unsafe`: the block wraps code that needs no unsafe context, so the marker hides the sites that do. rustc gives no machine-applicable fix, so this was scripted off the diagnostic byte spans. Where the block only held expressions or statements, the block goes with the keyword. Where it held a top-level `let`, `use`, or item, only the keyword goes and the braces stay — splicing those into the enclosing scope would widen the binding and could silently re-resolve a later name. 106 blocks removed, 44 kept as plain scoping blocks.
handle_dispatch.rs declares `js_node_http_res_write` and `js_node_http_res_end` in an `extern "C"` block, but perry-ext-http-server defines both itself (response.rs:1136 and response.rs:1393). Nothing calls the declarations, so rustc reports them as dead functions. Both signatures matched their definitions, so the deletion is a no-op at link time. The other ~62 declarations in that block are used and stay for now; they carry the same hazard — a local declaration of a symbol you also define is never checked against the definition, which is how #6646 shipped an ABI mismatch on `len: i64` vs `u32`. Tracked separately.
Deletes refactor leftovers — helpers, thunks, fields and constants nothing calls any more. Keeps, with a justified `#[allow(dead_code)]`, the GC verifiers, the `#[cfg(test)]`-only helpers and the FFI keepalives that exist to be reachable from generated code rather than from Rust. No `#[no_mangle]` function is deleted, so no symbol the compiler emits calls to can go missing at link time. The 11 deleted `extern "C"` items are Rust-internal closure thunks addressed by function pointer, which rustc tracks precisely. Rebased from the triage done on 2026-07-18, so three sites needed fixing against current main: - `path::resolve_win32_str` is no longer dead — url/node_compat.rs calls it. Restored. - `class_field_inline_guard_enabled` and `test_reset_class_field_inline_guard` arrived after that triage (#6802). Kept. - The CGContext* declarations in widgets/chart.rs were already removed by #6646. Kept removed.
…arnings Four triaged families, rebased onto current main: - non_snake_case: the generated `thunk_<module>_<jsName>` wrappers keep the JS spelling on purpose, so the allow sits on the three thunk macros and the node_submodule thunks rather than on each site. Real Rust names renamed. - private_interfaces / private_bounds: widen the leaked types to `pub(crate)` so the signature matches what callers can already reach. - unreachable_patterns: 32 duplicate match arms. Each was checked against the arm that shadows it — all are literal repeats, none had a different body that the first arm was swallowing. - unreachable_code: two `return js_throw(..)` where `js_throw` returns `!`. - sqlite `Connection::set_limit` returned a discarded `Result`: propagated with `?` in connection.rs, and `let _` in dispatch.rs where the limit id is already validated. - unused_doc_comments: 8 `///` comments on statements, which rustdoc drops. - Four dead bindings whose right-hand side is pure, so the binding goes instead of getting an underscore. Conflicts against main resolved in favour of main: perry-hir switched to `crate::types::Type`, and object/mod.rs moved the transition cache into `RuntimeState`.
- objc2 deprecations: 17 `msg_send!` invocations were missing the comma between arguments, plus one `Retained::cast` swapped for the `cast_unchecked` the sibling widgets already use. - Vacuous glob re-exports: `pub use child::*` where every item in the child is `pub(super)` re-exports nothing, which is what rustc was reporting. Narrowed each to the visibility it actually has — two to `pub(crate)`, six to a plain `use` — instead of silencing the lint. - `native_proof_*` integration tests share one HIR builder toolkit and each file drives a subset, so the allow sits on the file with that reason. - issue_4914_cluster_port_sharing.rs: its only test is gated to non-macOS unix; the helpers and imports now carry the same gate. - `duplex_allow_half_open_defaults_true_and_honors_false_option` had no `#[test]`, so it had never run. Added. - `test_seed_class_parent_closure_root` existed twice, both writing the same `CLASS_PARENT_CLOSURES` static. Deleted the unreachable copy. - `WIDE_KEY_INDEX_CAPACITY` is a leftover of the 4-entry LRU that #6759 C1 replaced with shape records. - crash_log.rs took a shared reference to a `static mut` inside a signal handler; now `&raw const`. - Two dead stores removed (`idx`, `adjusted_args_storage`). The third, `done` in publish, is kept with a comment: rustc is right that the store is never read, and that means the reconnect guard it feeds can never fire — a protocol question, not a lint one. - Four test names de-camel-cased, one duplicated `#[test]` removed. `cargo check --workspace --all-targets` now reports zero warnings for the host-compatible scope. The cross-host UI crates (ios/tvos/watchos/visionos/ android/windows/gtk4) cannot be checked from macOS and are untouched.
`perry` depends on perry-runtime with `default-features = false`, so `cargo clippy -p perry --bins` — the product leg in CI — compiles a runtime where regex-engine, diagnostics and temporal are off. Eleven items are live under the workspace feature set and dead under that one, and the workspace check never saw them. Each is now gated at the item rather than silenced: - `array_named_props_install_fresh` and `regex::utf16::utf16_index_to_byte` are called only from regex-engine modules; both, and the array re-export, carry that feature (the cross-gate shape regex/utf16.rs already documents). - Four `fs::dir_glob_watch::glob` imports serve regex-engine-gated code and now match the `PathBuf` import next to them. - The two `AllocatorMaintenance*` enums and `TemporalLocaleCtx` are built from `diagnostics` and `temporal` code respectively, so the allow applies only when that feature is off. - publish's `done` allow moved to the function: a statement-level attribute does not affect `unused_assignments`. Four scopes now report zero warnings: `--workspace --all-targets`, `-p perry --bins`, `-p perry-runtime --no-default-features`, and `-p perry-runtime -p perry-stdlib -p perry-runtime-static -p perry-stdlib-static`.
Nothing stopped a PR from adding a warning: `lint` runs only `cargo fmt --check`, and `clippy` exits non-zero only on the deny-level lints in `[workspace.lints]`. The 96 unused imports this branch removed include 49 that reappeared within four days of #6639, from a file split that copied whole import preambles into each new submodule — the gate is what stops that. Two legs, because they compile different code. `perry` depends on perry-runtime with `default-features = false`, so the product leg sees a runtime with regex-engine, diagnostics and temporal off. The workspace leg passes `--all-targets` so test and bench targets count. Separate from the clippy job on purpose: clippy's warn-level lints stay informational, rustc's do not. perry-ui-macos sits in the excluded scope (this runs on ubuntu), so its warnings are not gated here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe PR reduces Rust compiler warnings across the workspace, adds a ChangesRust warning enforcement and cleanup
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CI runs `dtolnay/rust-toolchain@stable`, which is 1.97.1 on the runners; the local default stable here is 1.97.1's predecessor, 1.95.0, which does not have this lint yet. `length(1.0)` in the TUI layout pass inferred `f32` by fallback rather than by the `From<f64>` bound, which rustc is phasing out (rust-lang/rust#154024). Spelling the literal `1.0_f32` says what was already meant. It was the only occurrence. All four scopes re-checked under 1.97.1 report zero warnings.
The macOS host cannot see these; the first CI run on this branch found them. `commands::sandbox_profile` is the #506 MVP, macOS-only by design — its only caller is inside `#[cfg(target_os = "macos")]`, so off macOS all three of its functions are unreachable. The module declaration now carries the same gate as its caller instead of compiling into a build that can never call it. Verified by flipping both cfgs to a target this host is not, and checking: no errors, no warnings. The Linux linker branch in `platform_cmd.rs` binds `let mut c`, but only the `#[cfg(not(target_os = "linux"))]` cross-compile block mutates it, so building on Linux the `mut` is dead. Scoped allow on the binding, which does apply to `unused_mut` — verified by flipping the target and watching the warning disappear.
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
crates/perry/src/commands/compile/resolve.rs (2)
908-910: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winGuard the wildcard slice bounds.
At Lines 908-910, a subpath can satisfy both
starts_with(prefix)andends_with(suffix)whileprefix.len() > subpath.len() - suffix.len(). The resulting range panics instead of rejecting the pattern.Proposed fix
if subpath.starts_with(prefix) && subpath.ends_with(suffix) { - let matched = &subpath[prefix.len()..subpath.len() - suffix.len()]; + let Some(end) = subpath.len().checked_sub(suffix.len()) else { + continue; + }; + if prefix.len() > end { + continue; + } + let matched = &subpath[prefix.len()..end];🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/perry/src/commands/compile/resolve.rs` around lines 908 - 910, Guard the slice in the wildcard-matching branch before computing matched in the resolve logic: require prefix.len() <= subpath.len() - suffix.len() after the existing prefix and suffix checks, and reject/skip the pattern when the bounds are invalid. Preserve the current template handling for valid ranges.
903-916: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPreserve wildcard pattern specificity when ordering candidates.
resolve_exports_candidatesappends non-exact wildcard candidates inmap.iter()order, andresolve_package_entryuses the first candidate that exists on disk. For overlapping patterns, a broad wildcard can win over a more-specific pattern and resolve the wrong entry. Keep existing condition/fallback ordering while sorting wildcard matches from most to least specific before pushing them toout.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/perry/src/commands/compile/resolve.rs` around lines 903 - 916, Update wildcard handling in resolve_exports_candidates to collect matching patterns separately and order them from most to least specific before appending resolved candidates to out. Preserve the existing match conditions and fallback ordering, while ensuring resolve_package_entry sees the most-specific wildcard candidate first.crates/perry-runtime/src/url/node_compat.rs (1)
842-850: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftRoot all GC-managed values across allocations.
Lines [842]-[850] retain
obj,keys, and the incomingvaluesarray whilecreate_string_f64andjs_array_push_f64may allocate and trigger moving GC. Subsequent field writes or stored pointer values can therefore target stale addresses, corrupting legacy URL objects, or crash. UseRuntimeHandleScope, root the object/array and pointer-bearing inputs, and reload handles after each allocation.Based on learnings, raw Rust pointers and NaN-boxed values are not reliable GC roots across allocating operations.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/perry-runtime/src/url/node_compat.rs` around lines 842 - 850, Update create_legacy_url_object to use RuntimeHandleScope for all GC-managed state. Root the allocated obj and keys handles, and root the pointer-bearing values input before create_string_f64 or js_array_push_f64 can trigger GC. After each allocation, reload obj and keys from their handles before setting fields or keys, ensuring all writes target current objects.Source: Learnings
🧹 Nitpick comments (1)
crates/perry-codegen/src/stmt/loops.rs (1)
2371-2371: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winRemove the unused label computation.
_preheader_labelis never read inlower_object_array_write_versioned_for; Line 2371 still clones the block label solely to silence the warning. Delete the assignment instead of retaining dead compile-time work.Proposed fix
- let _preheader_label = ctx.block().label.clone();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/perry-codegen/src/stmt/loops.rs` at line 2371, Remove the unused _preheader_label assignment from lower_object_array_write_versioned_for, including the unnecessary ctx.block().label clone; leave the surrounding lowering logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@changelog.d/6837-rust-warnings-to-zero.md`:
- Line 30: Update the platform name in the changelog text from “watchos” to the
canonical casing “watchOS”; leave the other platform names unchanged.
In `@crates/perry-ext-http-server/src/http2_server.rs`:
- Around line 68-74: Restore the crate-visible re-export of
h2_listening_server_for_authority in the session exports of http2_server.rs so
session.rs and other crate callers can resolve client authorities through the
existing http2_server interface.
In `@crates/perry-ui-macos/src/widgets/qrcode.rs`:
- Line 139: Update the QR image initialization around initWithCGImage:size: to
adopt the already-owned +1 result from the init-style Objective-C call rather
than retaining it again. Remove the extra Retained::retain ownership increment
while preserving the existing image creation and ownership flow.
In `@crates/perry/src/commands/compile.rs`:
- Around line 137-138: Restore the Windows re-export of backend_disabled_msg in
the compile command module, or import it directly in run_pipeline.rs so its
existing use through use super::* remains available when backend-wasm is
disabled.
---
Outside diff comments:
In `@crates/perry-runtime/src/url/node_compat.rs`:
- Around line 842-850: Update create_legacy_url_object to use RuntimeHandleScope
for all GC-managed state. Root the allocated obj and keys handles, and root the
pointer-bearing values input before create_string_f64 or js_array_push_f64 can
trigger GC. After each allocation, reload obj and keys from their handles before
setting fields or keys, ensuring all writes target current objects.
In `@crates/perry/src/commands/compile/resolve.rs`:
- Around line 908-910: Guard the slice in the wildcard-matching branch before
computing matched in the resolve logic: require prefix.len() <= subpath.len() -
suffix.len() after the existing prefix and suffix checks, and reject/skip the
pattern when the bounds are invalid. Preserve the current template handling for
valid ranges.
- Around line 903-916: Update wildcard handling in resolve_exports_candidates to
collect matching patterns separately and order them from most to least specific
before appending resolved candidates to out. Preserve the existing match
conditions and fallback ordering, while ensuring resolve_package_entry sees the
most-specific wildcard candidate first.
---
Nitpick comments:
In `@crates/perry-codegen/src/stmt/loops.rs`:
- Line 2371: Remove the unused _preheader_label assignment from
lower_object_array_write_versioned_for, including the unnecessary
ctx.block().label clone; leave the surrounding lowering logic unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 31275f6e-86f1-4769-92e6-d40a41428044
📒 Files selected for processing (211)
.github/workflows/test.ymlchangelog.d/6837-rust-warnings-to-zero.mdcrates/perry-codegen-arkts/src/tests/containers.rscrates/perry-codegen-arkts/src/tests/widgets.rscrates/perry-codegen-wasm/src/emit/mod.rscrates/perry-codegen-wasm/src/emit/runtime_imports.rscrates/perry-codegen-wasm/src/emit/ui_method_map.rscrates/perry-codegen/src/codegen/helpers.rscrates/perry-codegen/src/codegen/typed_abi.rscrates/perry-codegen/src/collectors/i64_emit.rscrates/perry-codegen/src/ext_registry.rscrates/perry-codegen/src/lower_call/early_branches.rscrates/perry-codegen/src/lower_call/func_ref.rscrates/perry-codegen/src/lower_call/method_override.rscrates/perry-codegen/src/nm_install.rscrates/perry-codegen/src/stmt/loops.rscrates/perry-codegen/tests/native_proof_buffer_views.rscrates/perry-codegen/tests/native_proof_regressions.rscrates/perry-container-compose/tests/backend_tests.rscrates/perry-doc-tests/src/main.rscrates/perry-ext-http-server/src/handle_dispatch.rscrates/perry-ext-http-server/src/http2_server.rscrates/perry-ext-http/src/agent.rscrates/perry-ext-http/src/lib.rscrates/perry-ext-net/src/lib.rscrates/perry-ext-zlib/src/stream.rscrates/perry-hir/src/destructuring/assignment_expr.rscrates/perry-hir/src/destructuring/assignment_stmt.rscrates/perry-hir/src/js_transform/imports.rscrates/perry-hir/src/lower/builder_fold.rscrates/perry-hir/src/lower/const_fold_fn.rscrates/perry-hir/src/lower/context.rscrates/perry-hir/src/lower/expr_call/intrinsics/eval_strict.rscrates/perry-hir/src/lower/fn_ctor_env.rscrates/perry-hir/src/lower/lowering_context.rscrates/perry-hir/src/lower/misc.rscrates/perry-hir/src/lower/pre_scan.rscrates/perry-hir/src/lower_decl/class_captures.rscrates/perry-hir/src/stable_hash/expr.rscrates/perry-hir/src/walker/expr_mut.rscrates/perry-hir/src/walker/expr_ref.rscrates/perry-runtime/src/abi_trampoline.rscrates/perry-runtime/src/array/from_concat.rscrates/perry-runtime/src/array/header.rscrates/perry-runtime/src/array/mod.rscrates/perry-runtime/src/array/push_pop.rscrates/perry-runtime/src/array/species.rscrates/perry-runtime/src/array/tests.rscrates/perry-runtime/src/buffer/dataview.rscrates/perry-runtime/src/buffer/from.rscrates/perry-runtime/src/buffer/header.rscrates/perry-runtime/src/buffer/mutate.rscrates/perry-runtime/src/builtins/formatting.rscrates/perry-runtime/src/builtins/formatting/util_format.rscrates/perry-runtime/src/builtins/globals.rscrates/perry-runtime/src/builtins/mod.rscrates/perry-runtime/src/builtins/numbers.rscrates/perry-runtime/src/bun_ffi/call.rscrates/perry-runtime/src/child_process/sync_run.rscrates/perry-runtime/src/child_process/v8_serde.rscrates/perry-runtime/src/closure/dispatch/bound.rscrates/perry-runtime/src/closure/dynamic_props.rscrates/perry-runtime/src/collection_iter.rscrates/perry-runtime/src/date.rscrates/perry-runtime/src/date/parse.rscrates/perry-runtime/src/dgram.rscrates/perry-runtime/src/dns.rscrates/perry-runtime/src/error.rscrates/perry-runtime/src/fs/cp.rscrates/perry-runtime/src/fs/dir_glob_watch/glob.rscrates/perry-runtime/src/fs/fd_ops.rscrates/perry-runtime/src/fs/fd_sync_ops.rscrates/perry-runtime/src/fs/mod.rscrates/perry-runtime/src/fs/validate.rscrates/perry-runtime/src/gc/barrier.rscrates/perry-runtime/src/gc/cycle.rscrates/perry-runtime/src/gc/heap_snapshot.rscrates/perry-runtime/src/gc/mod.rscrates/perry-runtime/src/gc/oldgen.rscrates/perry-runtime/src/gc/policy.rscrates/perry-runtime/src/gc/roots.rscrates/perry-runtime/src/gc/telemetry.rscrates/perry-runtime/src/gc/tests/cycle_state.rscrates/perry-runtime/src/gc/trace.rscrates/perry-runtime/src/gc/verify.rscrates/perry-runtime/src/intl.rscrates/perry-runtime/src/intl/date_collator.rscrates/perry-runtime/src/intl/date_collator/temporal.rscrates/perry-runtime/src/intl/number_format.rscrates/perry-runtime/src/json/reviver.rscrates/perry-runtime/src/node_stream.rscrates/perry-runtime/src/node_stream_constructors/web_adapter.rscrates/perry-runtime/src/node_stream_iter_helpers.rscrates/perry-runtime/src/node_stream_readable_read.rscrates/perry-runtime/src/node_stream_readwrite.rscrates/perry-runtime/src/node_stream_tests_extra.rscrates/perry-runtime/src/node_submodules/consumers.rscrates/perry-runtime/src/node_submodules/diagnostics.rscrates/perry-runtime/src/node_submodules/fs_promises.rscrates/perry-runtime/src/node_submodules/mod.rscrates/perry-runtime/src/node_submodules/stream_promises.rscrates/perry-runtime/src/node_submodules/test.rscrates/perry-runtime/src/node_submodules/tests.rscrates/perry-runtime/src/node_submodules/trace_events.rscrates/perry-runtime/src/node_test.rscrates/perry-runtime/src/node_v8.rscrates/perry-runtime/src/object/assert.rscrates/perry-runtime/src/object/class_registry.rscrates/perry-runtime/src/object/class_registry/class_meta.rscrates/perry-runtime/src/object/class_registry/dispatch.rscrates/perry-runtime/src/object/class_registry/gc_roots.rscrates/perry-runtime/src/object/class_registry/registration.rscrates/perry-runtime/src/object/delete_rest.rscrates/perry-runtime/src/object/field_get_set/enumeration.rscrates/perry-runtime/src/object/field_get_set/get_field_by_name.rscrates/perry-runtime/src/object/field_get_set/has_property.rscrates/perry-runtime/src/object/field_get_set/ic_miss.rscrates/perry-runtime/src/object/global_this/array_error.rscrates/perry-runtime/src/object/global_this/bigint_promise.rscrates/perry-runtime/src/object/map_set_subclass.rscrates/perry-runtime/src/object/mod.rscrates/perry-runtime/src/object/native_module.rscrates/perry-runtime/src/object/native_module/callable_export_check.rscrates/perry-runtime/src/object/native_module/callable_exports.rscrates/perry-runtime/src/object/native_module/constants.rscrates/perry-runtime/src/object/native_module/module_keys.rscrates/perry-runtime/src/object/native_module_dispatch/dispatch_d_i.rscrates/perry-runtime/src/object/native_module_dispatch/dispatch_m_p.rscrates/perry-runtime/src/object/native_module_dispatch_crypto.rscrates/perry-runtime/src/object/object_ops.rscrates/perry-runtime/src/object/object_ops/define_properties.rscrates/perry-runtime/src/object/tests.rscrates/perry-runtime/src/object/util_types.rscrates/perry-runtime/src/object/with_env.rscrates/perry-runtime/src/path.rscrates/perry-runtime/src/perf_hooks.rscrates/perry-runtime/src/plugin.rscrates/perry-runtime/src/pointer_event.rscrates/perry-runtime/src/process.rscrates/perry-runtime/src/process/credentials.rscrates/perry-runtime/src/promise/combinators.rscrates/perry-runtime/src/promise/keyed_table.rscrates/perry-runtime/src/promise/mod.rscrates/perry-runtime/src/promise/then.rscrates/perry-runtime/src/regex.rscrates/perry-runtime/src/regex/tests.rscrates/perry-runtime/src/regex/utf16.rscrates/perry-runtime/src/safe_area.rscrates/perry-runtime/src/string/compare.rscrates/perry-runtime/src/string/intern.rscrates/perry-runtime/src/string/tests.rscrates/perry-runtime/src/string/tests_guard_page.rscrates/perry-runtime/src/temporal/dispatch.rscrates/perry-runtime/src/tty.rscrates/perry-runtime/src/tui/layout.rscrates/perry-runtime/src/typedarray/mod.rscrates/perry-runtime/src/url/mod.rscrates/perry-runtime/src/url/node_compat.rscrates/perry-runtime/src/url/search_params.rscrates/perry-runtime/src/util_promisify.rscrates/perry-runtime/src/weakref.rscrates/perry-stdlib/src/commander.rscrates/perry-stdlib/src/common/dispatch.rscrates/perry-stdlib/src/crypto/sign.rscrates/perry-stdlib/src/fetch/dispatch.rscrates/perry-stdlib/src/http.rscrates/perry-stdlib/src/querystring.rscrates/perry-stdlib/src/sqlite/connection.rscrates/perry-stdlib/src/sqlite/dispatch.rscrates/perry-stdlib/src/streams/transform.rscrates/perry-stdlib/src/streams/writable.rscrates/perry-stdlib/src/tls.rscrates/perry-stdlib/src/zlib.rscrates/perry-transform/src/generator/lower.rscrates/perry-ui-geisterhand/src/server.rscrates/perry-ui-macos/src/app.rscrates/perry-ui-macos/src/audio.rscrates/perry-ui-macos/src/audio_playback.rscrates/perry-ui-macos/src/crash_log.rscrates/perry-ui-macos/src/geolocation.rscrates/perry-ui-macos/src/network.rscrates/perry-ui-macos/src/widgets/adbanner.rscrates/perry-ui-macos/src/widgets/canvas.rscrates/perry-ui-macos/src/widgets/chart.rscrates/perry-ui-macos/src/widgets/combobox.rscrates/perry-ui-macos/src/widgets/hstack.rscrates/perry-ui-macos/src/widgets/image.rscrates/perry-ui-macos/src/widgets/mod.rscrates/perry-ui-macos/src/widgets/qrcode.rscrates/perry-ui-macos/src/widgets/table.rscrates/perry-ui-macos/src/widgets/tree_view.rscrates/perry-ui-macos/src/widgets/vstack.rscrates/perry-ui-macos/src/widgets/webview.rscrates/perry/src/commands/compile.rscrates/perry/src/commands/compile/cjs_wrap/detect.rscrates/perry/src/commands/compile/cjs_wrap/extract_requires.rscrates/perry/src/commands/compile/cjs_wrap/hoist_classes.rscrates/perry/src/commands/compile/collect_modules.rscrates/perry/src/commands/compile/helpers.rscrates/perry/src/commands/compile/object_cache.rscrates/perry/src/commands/compile/optimized_libs.rscrates/perry/src/commands/compile/optimized_libs/driver.rscrates/perry/src/commands/compile/optimized_libs/freshness.rscrates/perry/src/commands/compile/optimized_libs/no_auto.rscrates/perry/src/commands/compile/optimized_libs/paths.rscrates/perry/src/commands/compile/optimized_libs/tests.rscrates/perry/src/commands/compile/resolve.rscrates/perry/src/commands/compile/run_pipeline.rscrates/perry/src/commands/compile/types.rscrates/perry/src/commands/publish/mod.rscrates/perry/tests/issue_4914_cluster_port_sharing.rs
💤 Files with no reviewable changes (65)
- crates/perry-codegen-wasm/src/emit/runtime_imports.rs
- crates/perry-container-compose/tests/backend_tests.rs
- crates/perry-ext-http-server/src/handle_dispatch.rs
- crates/perry-runtime/src/object/native_module_dispatch_crypto.rs
- crates/perry-codegen-arkts/src/tests/containers.rs
- crates/perry/src/commands/compile/optimized_libs/paths.rs
- crates/perry-runtime/src/object/mod.rs
- crates/perry-codegen-wasm/src/emit/mod.rs
- crates/perry/src/commands/compile/optimized_libs/no_auto.rs
- crates/perry-runtime/src/buffer/dataview.rs
- crates/perry-ext-http/src/agent.rs
- crates/perry-runtime/src/object/class_registry/gc_roots.rs
- crates/perry-ext-http/src/lib.rs
- crates/perry-stdlib/src/crypto/sign.rs
- crates/perry-runtime/src/builtins/mod.rs
- crates/perry-runtime/src/url/mod.rs
- crates/perry-codegen/src/codegen/typed_abi.rs
- crates/perry-hir/src/lower/misc.rs
- crates/perry-doc-tests/src/main.rs
- crates/perry-runtime/src/temporal/dispatch.rs
- crates/perry-runtime/src/buffer/header.rs
- crates/perry-ui-macos/src/network.rs
- crates/perry-runtime/src/date.rs
- crates/perry-runtime/src/dgram.rs
- crates/perry-hir/src/walker/expr_mut.rs
- crates/perry-hir/src/lower/context.rs
- crates/perry-hir/src/lower_decl/class_captures.rs
- crates/perry-runtime/src/fs/cp.rs
- crates/perry-runtime/src/typedarray/mod.rs
- crates/perry-runtime/src/node_stream_readable_read.rs
- crates/perry/src/commands/compile/cjs_wrap/extract_requires.rs
- crates/perry-runtime/src/json/reviver.rs
- crates/perry-codegen-wasm/src/emit/ui_method_map.rs
- crates/perry-runtime/src/array/species.rs
- crates/perry-runtime/src/node_submodules/test.rs
- crates/perry-runtime/src/object/native_module.rs
- crates/perry-hir/src/walker/expr_ref.rs
- crates/perry-ext-net/src/lib.rs
- crates/perry-hir/src/destructuring/assignment_stmt.rs
- crates/perry-stdlib/src/streams/writable.rs
- crates/perry/src/commands/compile/cjs_wrap/detect.rs
- crates/perry-hir/src/lower/pre_scan.rs
- crates/perry-runtime/src/node_test.rs
- crates/perry-codegen/src/lower_call/method_override.rs
- crates/perry-hir/src/destructuring/assignment_expr.rs
- crates/perry-codegen/src/nm_install.rs
- crates/perry-runtime/src/node_stream_readwrite.rs
- crates/perry-runtime/src/object/native_module_dispatch/dispatch_d_i.rs
- crates/perry-codegen/src/codegen/helpers.rs
- crates/perry-runtime/src/fs/validate.rs
- crates/perry-hir/src/stable_hash/expr.rs
- crates/perry/src/commands/compile/cjs_wrap/hoist_classes.rs
- crates/perry-codegen/src/lower_call/func_ref.rs
- crates/perry-runtime/src/collection_iter.rs
- crates/perry-runtime/src/node_stream_iter_helpers.rs
- crates/perry-codegen/src/lower_call/early_branches.rs
- crates/perry-runtime/src/object/native_module_dispatch/dispatch_m_p.rs
- crates/perry-runtime/src/intl/date_collator.rs
- crates/perry/src/commands/compile/run_pipeline.rs
- crates/perry-hir/src/lower/expr_call/intrinsics/eval_strict.rs
- crates/perry-runtime/src/gc/barrier.rs
- crates/perry-runtime/src/object/native_module/module_keys.rs
- crates/perry-runtime/src/object/native_module/callable_export_check.rs
- crates/perry-hir/src/lower/lowering_context.rs
- crates/perry-runtime/src/promise/then.rs
| Eleven warnings appeared only under the reduced feature set `perry` selects | ||
| (`default-features = false` on perry-runtime), where regex-engine, | ||
| diagnostics and temporal are off. Those items are gated at the item, not | ||
| suppressed. The cross-host UI crates (ios/tvos/watchos/visionos/android/ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use the canonical platform casing.
Change watchos to watchOS in the changelog.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~30-~30: The operating system from Apple is written “watchOS”.
Context: ...sed. The cross-host UI crates (ios/tvos/watchos/visionos/android/ windows/gtk4) canno...
(MAC_OS)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@changelog.d/6837-rust-warnings-to-zero.md` at line 30, Update the platform
name in the changelog text from “watchos” to the canonical casing “watchOS”;
leave the other platform names unchanged.
Source: Linters/SAST tools
| has_active_h2_clients, process_pending_h2, process_pending_h2_events, | ||
| try_recv_pending_h2_nonblocking, | ||
| }; | ||
| pub(crate) use session::{ | ||
| h2_listening_server_for_authority, local_client_connect_ready, local_server_handle_for_client, | ||
| local_server_session_event_ready, mark_server_sessions_closed, mark_session_closed, | ||
| parse_headers_object, register_server_session, start_client_request, | ||
| local_client_connect_ready, local_server_handle_for_client, local_server_session_event_ready, | ||
| mark_server_sessions_closed, mark_session_closed, parse_headers_object, | ||
| register_server_session, start_client_request, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep the HTTP/2 authority resolver crate-visible.
crates/perry-ext-http-server/src/http2_server/session.rs still depends on h2_listening_server_for_authority when resolving a client session’s local server handle. Restore this re-export, or update every caller to import the defining module directly.
Proposed fix
pub(crate) use session::{
+ h2_listening_server_for_authority,
local_client_connect_ready, local_server_handle_for_client, local_server_session_event_ready,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| has_active_h2_clients, process_pending_h2, process_pending_h2_events, | |
| try_recv_pending_h2_nonblocking, | |
| }; | |
| pub(crate) use session::{ | |
| h2_listening_server_for_authority, local_client_connect_ready, local_server_handle_for_client, | |
| local_server_session_event_ready, mark_server_sessions_closed, mark_session_closed, | |
| parse_headers_object, register_server_session, start_client_request, | |
| local_client_connect_ready, local_server_handle_for_client, local_server_session_event_ready, | |
| mark_server_sessions_closed, mark_session_closed, parse_headers_object, | |
| register_server_session, start_client_request, | |
| has_active_h2_clients, process_pending_h2, process_pending_h2_events, | |
| try_recv_pending_h2_nonblocking, | |
| }; | |
| pub(crate) use session::{ | |
| h2_listening_server_for_authority, | |
| local_client_connect_ready, local_server_handle_for_client, local_server_session_event_ready, | |
| mark_server_sessions_closed, mark_session_closed, parse_headers_object, | |
| register_server_session, start_client_request, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/perry-ext-http-server/src/http2_server.rs` around lines 68 - 74,
Restore the crate-visible re-export of h2_listening_server_for_authority in the
session exports of http2_server.rs so session.rs and other crate callers can
resolve client authorities through the existing http2_server interface.
| let ns_image_raw: *mut AnyObject = msg_send![ns_image_cls, alloc]; | ||
| let ns_image_raw: *mut AnyObject = | ||
| msg_send![ns_image_raw, initWithCGImage: cg_image size: target_size]; | ||
| msg_send![ns_image_raw, initWithCGImage: cg_image, size: target_size]; |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)qrcode\.rs$|(^|/)Cargo\.toml$|(^|/)CLAUDE\.md$|(^|/)\.node-version$' || true
echo "== target file outline =="
ast-grep outline crates/perry-ui-macos/src/widgets/qrcode.rs --view compact || true
echo "== target section =="
cat -n crates/perry-ui-macos/src/widgets/qrcode.rs | sed -n '120,155p'
echo "== Retained usages in qrcode =="
rg -n "Retained|ns_image_raw|initWithCGImage|retain|forget" crates/perry-ui-macos/src/widgets/qrcode.rs crates/perry-ui-macos/src -g '*.rs' || true
echo "== local objc2 version =="
rg -n "objc2" crates/perry-ui-macos/Cargo.toml Cargo.toml crates -g 'Cargo.toml' | head -80 || trueRepository: PerryTS/perry
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== all InitWithCGImage usage sites =="
rg -n "initWithCGImage|initWithCGImage:" crates/perry-ui-macos/src -g '*.rs' || true
echo "== local objc2 versions in workspace =="
rg -n 'name = "objc2"|^[[:space:]]*objc2[[:space:]]*=' Cargo.toml crates -g 'Cargo.toml' | head -120 || true
echo "== nearby generate_qr_image caller/usages =="
rg -n "generate_qr_image|QR|qrcode|qrcode" crates/perry-ui-macos/src -g '*.rs' || true
echo "== inspect qrcode top/imports =="
cat -n crates/perry-ui-macos/src/widgets/qrcode.rs | sed -n '1,70p'Repository: PerryTS/perry
Length of output: 6206
🌐 Web query:
Apple Foundation NSImage initWithCGImage:size: returns new object Retained object documentation
💡 Result:
The NSImage initializer initWithCGImage:size: creates a new NSImage object that references the provided CGImage [1]. Regarding memory management, when you use this initializer, the underlying CGImage is maintained by the NSImage for its use [1]. It is standard Cocoa convention that the caller is not responsible for releasing the CGImage after passing it to this initializer [1]. The CGImage remains valid for the life of the NSImage object or as otherwise required by the framework's internal management [1]. You do not need to manually retain or release the CGImage passed into this method, as the system handles the necessary reference counting [1]. Older methods related to data retention, such as setDataRetained: and isDataRetained, have been deprecated since Mac OS X 10.6, as modern NSImage implementations manage image data efficiently without requiring manual retention flags [2].
Citations:
- 1: https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSImage.h
- 2: http://api.monobjc.net/html/T_Monobjc_AppKit_NSImage.htm
Adopt the +1 result from initWithCGImage:size: instead of retaining it again.
init-style Objective-C methods on the result of alloc return an already-owned (+1) object; using Retained::retain here increments ownership again. The current loop increments the returned object’s retain count once per QR image and leaves an extra retained object behind via mem::forget.
Proposed ownership fix
- let ns_image: Retained<NSImage> = Retained::retain(ns_image_raw as *mut NSImage)?;
- // Balance the retain (init already gives us +1)
- std::mem::forget(Retained::retain(ns_image_raw as *mut NSImage));
+ // SAFETY: initWithCGImage:size: returns an owned (+1) object.
+ let ns_image: Retained<NSImage> =
+ unsafe { Retained::from_raw(ns_image_raw as *mut NSImage)? };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/perry-ui-macos/src/widgets/qrcode.rs` at line 139, Update the QR image
initialization around initWithCGImage:size: to adopt the already-owned +1 result
from the init-style Objective-C call rather than retaining it again. Remove the
extra Retained::retain ownership increment while preserving the existing image
creation and ownership flow.
| apply_libc_to_target, canonical_class_source_prefix, native_object_file_stem, | ||
| object_cache_project_root, print_deferred_eval_notice, NativeObjectArtifact, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Preserve the Windows backend_disabled_msg re-export.
crates/perry/src/commands/compile/run_pipeline.rs imports this module via use super::* and calls backend_disabled_msg(...) when backend-wasm is disabled. Removing the symbol from the Windows re-export makes that configuration fail to compile.
Restore the re-export or import the helper directly in run_pipeline.rs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/perry/src/commands/compile.rs` around lines 137 - 138, Restore the
Windows re-export of backend_disabled_msg in the compile command module, or
import it directly in run_pipeline.rs so its existing use through use super::*
remains available when backend-wasm is disabled.
The import block read:
#[cfg(unix)]
use std::os::unix::fs::{MetadataExt, PermissionsExt};
#[cfg(unix)]
use std::os::unix::io::AsRawFd;
use std::path::Path;
`cargo fix` deleted the unused `AsRawFd` line and left its `#[cfg(unix)]`
behind, which then applied to the `Path` import below it. Every unix host still
compiled; Windows failed with four `cannot find type Path` errors.
Swept the whole diff for the same shape — an attribute that outlived the item
it was written for — and this was the only one. The other new cfg/import
adjacencies are deliberate.
What
A clean
cargo check --workspace --all-targetsonmain(8b2c736ed, rustc 1.95.0) emitted 492 warnings. This branch takes that to 0 across four build scopes, and adds a CI job so it stays there.unused_unsafedead_codeunused_importsunreachable_patternsnon_snake_caseprivate_interfaces/private_boundsdeprecated(objc2)function_casts_as_integerScopes verified at zero:
Why now
Nothing gated warnings.
lintruns onlycargo fmt --check; theclippyjob exits non-zero only on deny-level[workspace.lints], runs without--all-targets, and test.yml setsRUSTFLAGS: -Awarningsin one leg. #6639 cleared the imports four days ago and 49 came straight back, from a file split that copied whole import preambles into each new submodule ofcommands/compile.rs. The last commit here adds arustc-warningsjob —cargo checkwith-D warnings, two legs.Three real defects the sweep found
extern "C"declarations for symbols the crate defines itself.perry-ext-http-server/src/handle_dispatch.rsdeclaresjs_node_http_res_writeandjs_node_http_res_end; the definitions are inresponse.rs. A local declaration of a symbol you also define is never checked against the definition — the class that shipped an ABI mismatch onlen: i64vsu32in refactor(perry-ui-macos): single canonical extern decls for clashing FFI symbols #6646. Both matched here. The two unused ones are deleted; the other ~62 in that block are used, carry the same hazard, and are tracked separately.duplex_allow_half_open_defaults_true_and_honors_false_optionhad no#[test].test_seed_class_parent_closure_rootexisted in bothobject/class_gc_roots.rsandobject/class_registry/gc_roots.rs, both writing the sameCLASS_PARENT_CLOSURESstatic.Judgment calls
unused_unsafe(150). rustc gives no machine-applicable fix, so this was scripted off the diagnostic byte spans. Where the block held only expressions or statements, the block went with the keyword (106). Where it held a top-levellet,use, or item, only the keyword went and the braces stayed (44) — splicing those into the enclosing scope widens the binding and can silently re-resolve a later name.dead_code(121). Rebased from the 2026-07-18 triage. No#[no_mangle]function is deleted, so nothing the compiler emits calls to can go missing at link time; the 11 deletedextern "C"items are Rust-internal closure thunks addressed by function pointer, which rustc tracks precisely. GC verifiers,#[cfg(test)]helpers and FFI keepalives are kept with a justified allow. Three sites needed fixing against current main:path::resolve_win32_stris called again byurl/node_compat.rs, and twoclass_field_inline_guardhelpers arrived after that triage (perf(runtime): #6759 C5a — per-key vetting for the class-field inline-guard disable #6802).pub use child::*where every item in the child ispub(super)re-exports nothing — narrowed each to the visibility it actually has (twopub(crate), six plainuse) rather than adding an allow.perrydepends on perry-runtime withdefault-features = false, socargo clippy -p perry --binscompiles a runtime with regex-engine, diagnostics and temporal off, where items the workspace check finds live are dead. Each is gated at the item.doneincommands/publishis the one warning left suppressed. rustc is right that the store is never read, because theCompletearm breaks immediately — which means the twoif done { break }reconnect guards can only ever seefalse. Whether the flag still buys anything is a protocol question, so the store stays with the allow and a comment.Not covered
The cross-host UI crates (ios, tvos, watchos, visionos, android, windows, windows-winui, gtk4) cannot be checked from this host and are untouched.
perry-ui-macosis fixed here but sits in CI's excluded scope, so the new gate does not cover it on ubuntu.Verification
cargo fmt --all --check,scripts/check_file_size.sh,scripts/addr_class_inventory.py: pass.cargo test --workspace(minus cross-host UI crates): see the CI run.Summary by CodeRabbit
then/catch/finallyhandling, including subclass/species behavior."exports"resolution by considering multiple candidate paths.process.umaskbehavior when the argument is omitted.