main: gate the restart import to unix - #527
Open
obodnikov wants to merge 1 commit into
Open
Conversation
`restart.rs` is `#![cfg(unix)]`, so on a non-unix target the module does not
exist at all -- a cfg-false module file is absent, not empty -- and the
unconditional import in `main.rs` fails to resolve:
error[E0432]: unresolved import `tuwunel::restart`
| ^^^^^^^^^^^^^^^^ no `restart` in the root
The call site is already gated:
#[cfg(unix)]
if server.server.restarting.load(Ordering::Acquire) {
restart::restart();
}
so this only extends the same condition to the import that serves it. `Ordering`
follows, its sole use being inside that block.
No behaviour change on unix.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
src/main/restart.rsis#![cfg(unix)]. A cfg-false module file is absent,not empty, so on a non-unix target
tuwunel::restartdoes not exist and theunconditional import in
main.rsis a hard error:The call site is already gated:
so this only extends the same condition to the import that serves it.
Orderingfollows for the same reason — its sole use is inside that block, so it is an
unused import on any non-unix target.
No behaviour change on unix. Same class of fix as #526.
On verification. CI builds Linux only, where none of this appears, so CI
cannot demonstrate the change. It was observed building v1.8.2 for
x86_64-pc-windows-msvc; the module-absence behaviour is reproducible with athree-file crate on any host.
cargo checkandcargo clippyon the unix pathare clean before and after.
Checklist
cargo fmtand satisfies clippy andrustc lints; any allowed lint is justified by an obvious reason or a
comment.
are noted in the description above. — none; no runtime path is touched.
src/core/config/mod.rsdoccomments and the regenerated
tuwunel-example.tomlis committed. — n/adocs/. — n/aand my conduct is in line with the Contributor's Covenant and
Tuwunel's Code of Conduct.