RyanCodrai/turbovec · warning
turbovec: warning: {message}
Error message
turbovec: warning: {message} What it means
This is turbovec's internal warning output, emitted by the `warn` function when the library needs to surface a non-fatal issue to the caller. It is not a panic or returned error: the message goes to stderr (or to a user-installed warning hook if one was registered via `set_warning_hook`). The library uses it to report conditions it recovers from but that the caller should know about.
Source
Thrown at turbovec/src/warning.rs:67
///
/// ```
/// fn to_my_log(message: &str) {
/// eprintln!("[turbovec] {message}");
/// }
/// turbovec::set_warning_hook(Some(to_my_log));
/// turbovec::set_warning_hook(None); // back to the default
/// ```
pub fn set_warning_hook(hook: Option<WarningHook>) {
let ptr = match hook {
Some(f) => f as *const () as *mut (),
None => std::ptr::null_mut(),
};
HOOK.store(ptr, Ordering::Release);
}
/// Deliver `message` to the installed hook, or to stderr if there is
/// none.
pub(crate) fn warn(message: &str) {
let ptr = HOOK.load(Ordering::Acquire);
if ptr.is_null() {
eprintln!("turbovec: warning: {message}");
return;
}
// SAFETY: `HOOK` is only ever written by `set_warning_hook`, which
// stores either null (handled above) or a `WarningHook` cast to
// `*mut ()`. Function and data pointers are the same width on every
// target this crate compiles for (64-bit only, enforced in lib.rs),
// so the round trip recovers exactly the pointer that was stored.
let hook: WarningHook = unsafe { std::mem::transmute::<*mut (), WarningHook>(ptr) };
hook(message);
}
View on GitHub (pinned to ccab9f325e)
Solutions
- Read the trailing `{message}` text to identify the actual condition being reported
- Install a warning hook with `set_warning_hook` to capture warnings programmatically (logging, metrics, tests) instead of stderr
- Fix the underlying condition described in the message (invalid input, fallback taken, etc.)
- In tests, install a hook that asserts/collects warnings so they do not clutter test output
Example fix
// before: warnings go to stderr, easy to miss
let v = turbovec::do_thing(&input);
// after: capture warnings programmatically
turbovec::set_warning_hook(Some(Box::new(|msg| {
log::warn!("turbovec: {}", msg);
})));
let v = turbovec::do_thing(&input); Defensive patterns
Strategy: fallback
Prevention
- Install a warning hook early (at program start) so all turbovec warnings are captured and actionable
- Monitor stderr for lines prefixed with 'turbovec: warning:' in CI and fail or alert on them
- Read and fix the specific condition in each warning message rather than suppressing output
- Treat repeated warnings as signals of data or configuration problems, not noise
When it happens
Trigger: Any call into turbovec internals that calls `warn(message)` when no warning hook is installed — e.g. a function detects a degraded/ignored input, a fallback path is taken, or a questionable configuration is encountered. The literal stderr line 'turbovec: warning: {message}' is printed only when the HOOK static is null.
Common situations: Running an application where turbovec logs warnings to stderr during bulk operations; CI logs polluted with 'turbovec: warning:' lines; developers unaware they can redirect these messages by installing a custom hook via `set_warning_hook` instead of letting them hit stderr.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06).
Data as JSON: /api/errors/c9f1e325359c60fa.
Report an issue: GitHub.