Bug description
ts_parse() in system/scribe/src/lib.rs fails to compile on any non-Unix target (e.g. Windows MSVC, aarch64-linux-android). The line that consumes secs:
let ts_ns = secs.checked_mul(1_000_000_000)?.checked_add(nsec as u64)?;
sits between the two #[cfg]-gated bindings of secs:
#[cfg(unix)]
let secs = { … }; // only compiled when target_family = "unix"
let ts_ns = secs.checked_mul(1_000_000_000)?.checked_add(nsec as u64)?; // ← uses secs
#[cfg(not(unix))]
let secs = { … }; // only compiled when target_family != "unix"
When cfg(unix) is false, the #[cfg(unix)] let secs = {…} binding is removed by the compiler, so secs is undefined at the point where it's used (this line). Meanwhile, the #[cfg(not(unix))] let secs = {…} binding that should provide this value is declared after the use — Rust resolves #[cfg] before name resolution, so a binding cannot satisfy a use that appears before it. The result is error[E0425]: cannot find value 'secs' in this scope. The compiler hint (help: a local variable with a similar name exists: 'sec') is a red herring — this is an ordering bug, not a typo.
Affected component
Tick the closest match — maintainers confirm the final comp:* label.
System (core OS services)
Service (scene-level capabilities)
Skill / Primitive
Tooling / cross-cutting
Steps to reproduce
-
On a non-Unix host (confirmed on Windows 11 + MSVC toolchain, building for aarch64-linux-android):
cargo build -p robonix-scribe
-
Alternatively, from a Unix host, cross-compile to any non-Unix target to reproduce in isolation:
rustup target install aarch64-linux-android
cargo check -p robonix-scribe --target aarch64-linux-android
Expected behavior
robonix-scribe compiles on both Unix and non-Unix targets without error — each #[cfg]-gated secs binding should provide the value for the downstream ts_ns computation.
Actual behavior
Compilation aborts with:
error[E0425]: cannot find value `secs` in this scope
--> system\scribe\src\lib.rs:173:17
|
173| let ts_ns = secs.checked_mul(1_000_000_000)?.checked_add(nsec as u64)?;
| ^^^ cannot find value `secs`
|
help: a local variable with a similar name exists: `sec`
error: could not compile `robonix-scribe` (lib) due to 1 previous error
Root cause & suggested fix
The let ts_ns = secs.checked_mul(…) line was placed between the two #[cfg] bindings of secs. Because Rust resolves #[cfg] before name resolution, the consumer of secs must appear after both bindings, not between them.
Move the let ts_ns = … line to after the #[cfg(not(unix))] block (one-line reorder, no logic change):
};
- let ts_ns = secs.checked_mul(1_000_000_000)?.checked_add(nsec as u64)?;
#[cfg(not(unix))]
let secs = {
// …
};
+ let ts_ns = secs.checked_mul(1_000_000_000)?.checked_add(nsec as u64)?;
Some(ts_ns)
Note: ts_fmt() (the reverse function) uses the same #[cfg(unix)] / #[cfg(not(unix))] pattern but only consumes secs inside each cfg block separately, so it does not hit this issue.
Environment
- rbnx version / commit: upstream
dev at af7f2281 (latest as of 2026-08-13)
- Bug present since scribe was introduced (
d7d1ecaa — feat: add Scribe logs)
- Host: Windows 11 + MSVC (also reproducible cross-compiling to
aarch64-linux-android from Unix)
- Package:
robonix-scribe v0.1.0
Logs
Full compile error trace (Windows MSVC, target aarch64-linux-android):
Compile output
Compiling tonic-build v0.14.6
Compiling tokio-macros v2.7.0
Compiling prost-derive v0.14.4
Compiling futures-macro v0.3.32
Compiling tracing-attributes v0.1.31
Compiling serde_derive v1.0.228
Compiling thiserror-impl v2.0.18
Compiling clap_derive v4.6.1
Compiling pin-project-internal v1.1.13
Compiling async-trait v0.1.89
Compiling futures-util v0.3.32
Compiling tokio v1.52.3
Compiling pin-project v1.1.13
Compiling tracing v0.1.44
Compiling clap v4.6.1
Compiling prost v0.14.4
Compiling robonix-scribe v0.1.0 (D:\DeepRobotics\robonix-thor\system\scribe)
Compiling futures-executor v0.3.32
error[E0425]: cannot find value `secs` in this scope
--> system\scribe\src\lib.rs:173:17
|
173| let ts_ns = secs.checked_mul(1_000_000_000)?.checked_add(nsec as u64)?;
| ^^^
|
help: a local variable with a similar name exists: `sec`
error: could not compile `robonix-scribe` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
note: … rustup target install aarch64-linux-android …
Additional context
- Searched existing issues — no prior report for this.
- The companion function
ts_fmt() in the same file is unaffected (see Root cause).
Bug description
ts_parse()insystem/scribe/src/lib.rsfails to compile on any non-Unix target (e.g. Windows MSVC,aarch64-linux-android). The line that consumessecs:sits between the two
#[cfg]-gated bindings ofsecs:When
cfg(unix)is false, the#[cfg(unix)] let secs = {…}binding is removed by the compiler, sosecsis undefined at the point where it's used (this line). Meanwhile, the#[cfg(not(unix))] let secs = {…}binding that should provide this value is declared after the use — Rust resolves#[cfg]before name resolution, so a binding cannot satisfy a use that appears before it. The result iserror[E0425]: cannot find value 'secs' in this scope. The compiler hint (help: a local variable with a similar name exists: 'sec') is a red herring — this is an ordering bug, not a typo.Affected component
Tick the closest match — maintainers confirm the final
comp:*label.System (core OS services)
Service (scene-level capabilities)
service/map)Skill / Primitive
__________(e.g. explore)__________(camera / chassis / lidar / audio / arm)Tooling / cross-cutting
Steps to reproduce
On a non-Unix host (confirmed on Windows 11 + MSVC toolchain, building for
aarch64-linux-android):cargo build -p robonix-scribe
Alternatively, from a Unix host, cross-compile to any non-Unix target to reproduce in isolation:
rustup target install aarch64-linux-android
cargo check -p robonix-scribe --target aarch64-linux-android
Expected behavior
robonix-scribecompiles on both Unix and non-Unix targets without error — each#[cfg]-gatedsecsbinding should provide the value for the downstreamts_nscomputation.Actual behavior
Compilation aborts with:
Root cause & suggested fix
The
let ts_ns = secs.checked_mul(…)line was placed between the two#[cfg]bindings ofsecs. Because Rust resolves#[cfg]before name resolution, the consumer ofsecsmust appear after both bindings, not between them.Move the
let ts_ns = …line to after the#[cfg(not(unix))]block (one-line reorder, no logic change):Note:
ts_fmt()(the reverse function) uses the same#[cfg(unix)] / #[cfg(not(unix))]pattern but only consumessecsinside each cfg block separately, so it does not hit this issue.Environment
devataf7f2281(latest as of 2026-08-13)d7d1ecaa—feat: add Scribe logs)aarch64-linux-androidfrom Unix)robonix-scribe v0.1.0Logs
Full compile error trace (Windows MSVC, target
aarch64-linux-android):Compile output
Additional context
ts_fmt()in the same file is unaffected (see Root cause).