You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Cargo.toml[package]
name = "minissue"
version = "0.1.0"
edition = "2021"[dependencies]
serde = { version = "1.0.197", features = ["derive"]}[features]
default = ["hello","bye"]
hello = []
bye = []//main.rs
use serde::Deserialize;//Both lines display as two errors each.#[derive(Deserialize)]
struct SomeStruct{//Error: missing structure field: - hello#[cfg(feature = "hello")]
pub hello:String,#[cfg(not(feature = "bye"))]pub bye:String,//Error: no such field}
fn main(){#[cfg(feature = "hello")]println!("{}",SomeStruct{
hello:"hello".to_owned(),}.hello
);}
Only requires #[derive(Deserialize)], other derives such as Serialize, Debug, etc, are working fine. cargo check doesn't show any errors.
We can avoid the rust-analyzer false flags by adding redundant code. Something like the following:
Previously we were tracking this behavior with #11657 as it was the same error we had in this snippet. But as of recently the issue was marked resolved.
minimal code snippet to reproduce:
Only requires
#[derive(Deserialize)]
, other derives such as Serialize, Debug, etc, are working fine.cargo check
doesn't show any errors.We can avoid the rust-analyzer false flags by adding redundant code. Something like the following:
Previously we were tracking this behavior with #11657 as it was the same error we had in this snippet. But as of recently the issue was marked resolved.
rust-analyzer version: 2024-03-25
rustc version:
rustc 1.74.0 (79e9716c9 2023-11-13)
The text was updated successfully, but these errors were encountered: