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
As minimal reproduction as it gets: cargo new --lib repro, then:
#[derive(Hash)]
pub enum BgGameState {
Over, // you can comment it out as well
}
#[derive(Hash)]
pub struct BgGame {
pub state: BgGameState, // rename it, it will go away
}
rust-analyzer version: 0.4.1521-standalone, also some earlier versions
rustc version: tried with rustc 1.69.0 (84c898d65 2023-04-16), rustc 1.71.0-nightly (521f4dae1 2023-05-19), also some earlier versions
relevant settings: It's VS Code remote on my box, via SSH, but I've been running it without issues for many months
The text was updated successfully, but these errors were encountered:
valyagolev
changed the title
False type-mismatch for derive(Hash) ... probably doing something wrong
False type-mismatch for derive(Hash) for structs with fields called "state"
May 20, 2023
Yes this happens since state is used in the macro expansion code:
impl core::hash::HashforBgGame{fnhash<H: core::hash::Hasher>(&self,state:&mutH){
core::mem::discriminant(self).hash(state);matchself{BgGame{state: state } => {// ^^^ state shadows the state
state.hash(state);}}}}
As minimal reproduction as it gets:
cargo new --lib repro
, then:rust-analyzer version: 0.4.1521-standalone, also some earlier versions
rustc version: tried with rustc 1.69.0 (84c898d65 2023-04-16), rustc 1.71.0-nightly (521f4dae1 2023-05-19), also some earlier versions
relevant settings: It's VS Code remote on my box, via SSH, but I've been running it without issues for many months
The text was updated successfully, but these errors were encountered: