Skip to content

Commit 07bc6cb

Browse files
committed
Auto merge of #15040 - lnicola:hash-state-name, r=Veykril
fix: Use a more obscure hasher name in derive expansion Closes #15039
2 parents 1f1fe81 + 0b441ca commit 07bc6cb

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -396,18 +396,18 @@ enum Command {
396396
}
397397
398398
impl < > core::hash::Hash for Command< > where {
399-
fn hash<H: core::hash::Hasher>(&self , state: &mut H) {
400-
core::mem::discriminant(self ).hash(state);
399+
fn hash<H: core::hash::Hasher>(&self , ra_expand_state: &mut H) {
400+
core::mem::discriminant(self ).hash(ra_expand_state);
401401
match self {
402402
Command::Move {
403403
x: x, y: y,
404404
}
405405
=> {
406-
x.hash(state);
407-
y.hash(state);
406+
x.hash(ra_expand_state);
407+
y.hash(ra_expand_state);
408408
}
409409
, Command::Do(f0, )=> {
410-
f0.hash(state);
410+
f0.hash(ra_expand_state);
411411
}
412412
, Command::Jump=> {}
413413
,

crates/hir-expand/src/builtin_derive_macro.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,15 @@ fn hash_expand(
613613
span: tt::TokenId::unspecified(),
614614
};
615615
return quote! {
616-
fn hash<H: #krate::hash::Hasher>(&self, state: &mut H) {
616+
fn hash<H: #krate::hash::Hasher>(&self, ra_expand_state: &mut H) {
617617
match #star self {}
618618
}
619619
};
620620
}
621621
let arms = adt.shape.as_pattern(&adt.name).into_iter().zip(adt.shape.field_names()).map(
622622
|(pat, names)| {
623623
let expr = {
624-
let it = names.iter().map(|x| quote! { #x . hash(state); });
624+
let it = names.iter().map(|x| quote! { #x . hash(ra_expand_state); });
625625
quote! { {
626626
##it
627627
} }
@@ -633,8 +633,8 @@ fn hash_expand(
633633
},
634634
);
635635
quote! {
636-
fn hash<H: #krate::hash::Hasher>(&self, state: &mut H) {
637-
#krate::mem::discriminant(self).hash(state);
636+
fn hash<H: #krate::hash::Hasher>(&self, ra_expand_state: &mut H) {
637+
#krate::mem::discriminant(self).hash(ra_expand_state);
638638
match self {
639639
##arms
640640
}

0 commit comments

Comments
 (0)