-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
When working for a while in a large codebase, I get a lot of errors like this one from tracing::info!
macro invocations:
non-primitive cast:
&Arguments<_>
as&dyn Value
This seems to come from an expression &(format_args!(...)) as &dyn Value
in the macro expansion, which should work (and works according to rustc
). std::fmt::Arguments<'_>
implements tracing_core::field::Value
, however rust-analyzer seems to in some cases still produce an error.
I've so far been unable to create a minimal reproducible example, I've only so far seen this in a fairly large (170k LOC) commercial codebase that I'm working with. Restarting rust-analyzer does make the error go away for a while, in my case for about 1.5 minutes after other errors are visible.
let _ = &format_args!("...") as &dyn std::io::Write; // <-- immediately has error
let _ = &format_args!("...") as &dyn tracing::Value; // <-- has an error after a while
The errors started showing up after updating the rust-analyzer extension earlier today, not sure what the version prior to the update was. The errors seem to not be present on the latest stable release (v0.3.2096). It seems like it may be related to the recently merged #17984.
rust-analyzer version: rust-analyzer version: 0.4.2098-standalone
rustc version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)
editor or extension: VSCode, extension version v0.4.2098 (pre-release)
relevant settings: none that I can find