no-dead-code-1 #442
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq!442
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "no-dead-code-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Review
Mostly LGTM — the link-time GC approach is clean and the new
no_dead_codetest pins the invariant well. A few items worth attention:Doc/code divergence —
BATTERIES_INCLUDED.mdvs runtimeCargo.tomlThe rewritten
docs/BATTERIES_INCLUDED.md(new "Binary Contents" section) makes strong claims:But the feature-flag mechanism is still alive:
crates/runtime/Cargo.toml:16-41still definescrypto/http/regex/compression/fullfeatures.crates/runtime/src/lib.rsstill gates modules on#[cfg(feature = "crypto")],#[cfg(feature = "http")], etc. (lines 55–72, 172–221, 347–352).So capability selection is still possible (e.g.
cargo build --no-default-features --features crypto); the doc rewrite presents it as if it isn't. Either the docs are running ahead of a planned cleanup that removes those#[cfg]s and feature stanzas, or the docs need to keep at least a brief note that the cargo features still exist as a knob even though they're not the headline mechanism. Worth deciding before this lands so the two stay in sync.crates/compiler/src/lib.rs:387-396— unconditional dead-strip on non-macOSThis is fine for the only platforms in CI today (Linux, macOS), but the
elsebranch fires for any non-macOS target, including Windows-MSVC. clang on Windows targetinglink.exedoes not accept-Wl,--gc-sectionsand the link will fail. Not a blocker if Windows is explicitly out of scope, but it's now a hard build failure if someone tries it. Consider making the Linux branch explicit (target_os = "linux", or an env override) so the behavior on unsupported targets is at least obvious.crates/compiler/tests/no_dead_code.rs— release-profile assumption is implicitThe test invokes
seqc buildand inspects the resulting binary, but the no-dead-code result depends on the workspace's release profile (lto = true,codegen-units = 1) being applied to the runtime archiveseqclinks against. The justfile recipe runs the test withcargo test --release …which keeps everything consistent; running it manually ascargo test -p seq-compiler --test no_dead_code(no--release) will use a debug build ofseqcand a debug runtime archive, where--gc-sectionswill leave a much larger residue and the assertion will fail in confusing ways.A short comment in the test, or a
debug_assertions-gated early return, would save the next person a debugging session.crates/compiler/src/error_flag_lint/analyzer.rs:200-239— clippy refactor is semantics-preservingI traced this carefully because converting
arm => { if guard { … } }intoarm if guard => { … }changes match fall-through semantics in the general case: when the guard fails, the new form continues to subsequent arms, while the old form silently no-ops. Here it's safe — no other named arm matches"over"or"2dup", so a guard miss falls through to the catch-all_ => { /* no-op */ }, which is the same effect as the original emptyif. Worth a one-line comment if you expect future contributors to add new arms above the catch-all, since adding e.g. an_ if … =>arm earlier in the match could quietly start handling these names with the unintended branch.Minor
crates/runtime/src/report.rs:271—sort_by_key(|b| Reverse(b.1))is equivalent to the oldsort_by(|a,b| b.1.cmp(&a.1))and a bit more idiomatic. No issue.docs/design/done/BINARY_FOOTPRINT.mdis helpful but contains anecdotal byte counts (e.g. "~250K backtrace symbolizer") that will drift as the toolchain changes. Not worth blocking on, but worth a sentence noting the date the measurements were taken (the headline table already does this for2026-04-29; the per-category numbers don't).Nothing in the diff that I'd block on. The doc-vs-code divergence on feature flags is the one I'd resolve before merge.
Re-review of
cddf6ddAll five items resolved. Quick verification:
Test profile gate —
#[cfg_attr(any(target_os = "macos", debug_assertions), ignore)]plus the new comment incrates/compiler/tests/no_dead_code.rs:45-55is exactly the right shape:cargo test(debug) on Linux now silently skips with a clear reason rather than failing confusingly, andjust check-binary-contentsstill enforces it under release.Linker branch tightened —
crates/compiler/src/lib.rs:392-396now explicit ontarget_os = "linux"with the comment naming Windows-MSVC as the reason for the silent no-op fallback. Good. (Side effect: hypothetical FreeBSD/NetBSD users lose dead-stripping too even though GNU ld would accept--gc-sections— fine for now, easy to extend later if anyone asks.)NO_DEAD_CODE.md path fix —
docs/design/done/NO_DEAD_CODE.md:185now points at the correct location.BATTERIES_INCLUDED — The added blockquote at
docs/BATTERIES_INCLUDED.md:82-87resolves the divergence: it preserves the user-visible claim ("noseqcflags for capability selection") while accurately stating the cargo features still exist for direct runtime consumers. Doc and code are aligned.analyzer.rs guard comment —
crates/compiler/src/error_flag_lint/analyzer.rs:203-208correctly warns about the fall-through assumption. Placement above"over"covers"2dup"too since they're the only guarded arms in the match.Nothing further from me. LGTM.