diff --git a/compiler/rustc_data_structures/src/sorted_map/index_map.rs b/compiler/rustc_data_structures/src/sorted_map/index_map.rs index 8c439437b8be..f08f34308550 100644 --- a/compiler/rustc_data_structures/src/sorted_map/index_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map/index_map.rs @@ -29,7 +29,7 @@ pub struct SortedIndexMultiMap { items: IndexVec, // We can ignore this field because it is not observable from the outside. - #[stable_hasher(ignore)] + #[stable_hash(ignore)] /// Indices of the items in the set, sorted by the item's key. idx_sorted_by_item_key: Vec, } diff --git a/compiler/rustc_hir/src/diagnostic_items.rs b/compiler/rustc_hir/src/diagnostic_items.rs index 128b6f5e3998..5a1901fe88f2 100644 --- a/compiler/rustc_hir/src/diagnostic_items.rs +++ b/compiler/rustc_hir/src/diagnostic_items.rs @@ -7,7 +7,7 @@ #[derive(Debug, Default, StableHash)] pub struct DiagnosticItems { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub id_to_name: DefIdMap, pub name_to_id: FxIndexMap, } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 2f18b09cf1ae..ab20fccb8dfc 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -160,7 +160,7 @@ fn from(ident: Ident) -> Self { // platforms where the alignment is already sufficient. #[repr(align(4))] pub struct Lifetime { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, /// Either a named lifetime definition (e.g. `'a`, `'static`) or an @@ -369,7 +369,7 @@ pub fn is_global(&self) -> bool { pub struct PathSegment<'hir> { /// The identifier portion of this path segment. pub ident: Ident, - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub res: Res, @@ -440,7 +440,7 @@ pub fn span<'tcx>(&self, tcx: impl crate::intravisit::HirTyCtxt<'tcx>) -> Span { #[derive(Clone, Copy, Debug, StableHash)] #[repr(C)] pub struct ConstArg<'hir, Unambig = ()> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub kind: ConstArgKind<'hir, Unambig>, pub span: Span, @@ -538,7 +538,7 @@ pub struct ConstArgArrayExpr<'hir> { #[derive(Clone, Copy, Debug, StableHash)] pub struct InferArg { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub span: Span, } @@ -829,7 +829,7 @@ pub enum GenericParamKind<'hir> { #[derive(Debug, Clone, Copy, StableHash)] pub struct GenericParam<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub def_id: LocalDefId, pub name: ParamName, @@ -1093,7 +1093,7 @@ pub fn span_for_bound_removal(&self, predicate_pos: usize, bound_pos: usize) -> /// A single predicate in a where-clause. #[derive(Debug, Clone, Copy, StableHash)] pub struct WherePredicate<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub span: Span, pub kind: &'hir WherePredicateKind<'hir>, @@ -1636,7 +1636,7 @@ pub struct OwnerInfo<'hir> { /// /// WARNING: The delayed lints are not hashed as a part of the `OwnerInfo`, and therefore /// should only be accessed in `eval_always` queries. - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub delayed_lints: Steal, } @@ -1710,7 +1710,7 @@ pub struct Block<'hir> { /// An expression at the end of the block /// without a semicolon, if any. pub expr: Option<&'hir Expr<'hir>>, - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, /// Distinguishes between `unsafe { ... }` and `{ ... }`. pub rules: BlockCheckMode, @@ -1740,7 +1740,7 @@ pub struct TyFieldPath { #[derive(Debug, Clone, Copy, StableHash)] pub struct TyPat<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub kind: TyPatKind<'hir>, pub span: Span, @@ -1748,7 +1748,7 @@ pub struct TyPat<'hir> { #[derive(Debug, Clone, Copy, StableHash)] pub struct Pat<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub kind: PatKind<'hir>, pub span: Span, @@ -1896,7 +1896,7 @@ pub fn is_guaranteed_to_constitute_read_for_never(&self) -> bool { /// except `is_shorthand` is true. #[derive(Debug, Clone, Copy, StableHash)] pub struct PatField<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, /// The identifier for the field. pub ident: Ident, @@ -1952,7 +1952,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { #[derive(Debug, Clone, Copy, StableHash)] pub struct PatExpr<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub span: Span, pub kind: PatExprKind<'hir>, @@ -2060,7 +2060,7 @@ pub enum PatKind<'hir> { /// A statement. #[derive(Debug, Clone, Copy, StableHash)] pub struct Stmt<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub kind: StmtKind<'hir>, pub span: Span, @@ -2094,7 +2094,7 @@ pub struct LetStmt<'hir> { pub init: Option<&'hir Expr<'hir>>, /// Else block for a `let...else` binding. pub els: Option<&'hir Block<'hir>>, - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub span: Span, /// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop @@ -2107,7 +2107,7 @@ pub struct LetStmt<'hir> { /// ` (if ) => `. #[derive(Debug, Clone, Copy, StableHash)] pub struct Arm<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub span: Span, /// If this pattern and the optional guard matches, then `body` is evaluated. @@ -2136,7 +2136,7 @@ pub struct LetExpr<'hir> { #[derive(Debug, Clone, Copy, StableHash)] pub struct ExprField<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub ident: Ident, pub expr: &'hir Expr<'hir>, @@ -2410,7 +2410,7 @@ fn into_diag_arg(self, _: &mut Option) -> DiagArgValue { /// `const N: usize = { ... }` with `tcx.hir_opt_const_param_default_param_def_id(..)` #[derive(Copy, Clone, Debug, StableHash)] pub struct AnonConst { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub def_id: LocalDefId, pub body: BodyId, @@ -2420,7 +2420,7 @@ pub struct AnonConst { /// An inline constant expression `const { something }`. #[derive(Copy, Clone, Debug, StableHash)] pub struct ConstBlock { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub def_id: LocalDefId, pub body: BodyId, @@ -2436,7 +2436,7 @@ pub struct ConstBlock { /// [rust lang reference]: https://doc.rust-lang.org/reference/expressions.html #[derive(Debug, Clone, Copy, StableHash)] pub struct Expr<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub kind: ExprKind<'hir>, pub span: Span, @@ -3352,7 +3352,7 @@ pub enum ImplItemKind<'hir> { /// * the `f(..): Bound` in `Trait` (feature `return_type_notation`) #[derive(Debug, Clone, Copy, StableHash)] pub struct AssocItemConstraint<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub ident: Ident, pub gen_args: &'hir GenericArgs<'hir>, @@ -3432,7 +3432,7 @@ pub enum AmbigArg {} #[derive(Debug, Clone, Copy, StableHash)] #[repr(C)] pub struct Ty<'hir, Unambig = ()> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub span: Span, pub kind: TyKind<'hir, Unambig>, @@ -3678,7 +3678,7 @@ pub struct UnsafeBinderTy<'hir> { #[derive(Debug, Clone, Copy, StableHash)] pub struct OpaqueTy<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub def_id: LocalDefId, pub bounds: GenericBounds<'hir>, @@ -3718,7 +3718,7 @@ pub fn name(self) -> Symbol { /// since resolve_bound_vars operates on `Lifetime`s. #[derive(Debug, Clone, Copy, StableHash)] pub struct PreciseCapturingNonLifetimeArg { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub ident: Ident, pub res: Res, @@ -3918,7 +3918,7 @@ pub fn contains_label(&self) -> bool { /// Represents a parameter in a function header. #[derive(Debug, Clone, Copy, StableHash)] pub struct Param<'hir> { - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub pat: &'hir Pat<'hir>, pub ty_span: Span, @@ -4219,7 +4219,7 @@ pub struct Variant<'hir> { /// Name of the variant. pub ident: Ident, /// Id of the variant (not the constructor, see `VariantData::ctor_hir_id()`). - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub def_id: LocalDefId, /// Fields and constructor id of the variant. @@ -4259,7 +4259,7 @@ pub enum UseKind { pub struct TraitRef<'hir> { pub path: &'hir Path<'hir>, // Don't hash the `ref_id`. It is tracked via the thing it is used to access. - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_ref_id: HirId, } @@ -4295,7 +4295,7 @@ pub struct FieldDef<'hir> { pub span: Span, pub vis_span: Span, pub ident: Ident, - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub hir_id: HirId, pub def_id: LocalDefId, pub ty: &'hir Ty<'hir>, @@ -4320,11 +4320,11 @@ pub enum VariantData<'hir> { /// A tuple variant. /// /// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`. - Tuple(&'hir [FieldDef<'hir>], #[stable_hasher(ignore)] HirId, LocalDefId), + Tuple(&'hir [FieldDef<'hir>], #[stable_hash(ignore)] HirId, LocalDefId), /// A unit variant. /// /// E.g., `Bar = ..` as in `enum Foo { Bar = .. }`. - Unit(#[stable_hasher(ignore)] HirId, LocalDefId), + Unit(#[stable_hash(ignore)] HirId, LocalDefId), } impl<'hir> VariantData<'hir> { diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index e685545deb7e..32a5d6a1c6cf 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -59,10 +59,10 @@ pub fn extension(attr: TokenStream, input: TokenStream) -> TokenStream { } decl_derive!( - [StableHash, attributes(stable_hasher)] => stable_hash::hash_stable_derive + [StableHash, attributes(stable_hash)] => stable_hash::stable_hash_derive ); decl_derive!( - [StableHash_NoContext, attributes(stable_hasher)] => stable_hash::hash_stable_no_context_derive + [StableHash_NoContext, attributes(stable_hash)] => stable_hash::stable_hash_no_context_derive ); // Encoding and Decoding derives diff --git a/compiler/rustc_macros/src/stable_hash.rs b/compiler/rustc_macros/src/stable_hash.rs index 7603c5f564e2..2ac47ef7338d 100644 --- a/compiler/rustc_macros/src/stable_hash.rs +++ b/compiler/rustc_macros/src/stable_hash.rs @@ -10,7 +10,7 @@ fn parse_attributes(field: &syn::Field) -> Attributes { let mut attrs = Attributes { ignore: false, project: None }; for attr in &field.attrs { let meta = &attr.meta; - if !meta.path().is_ident("stable_hasher") { + if !meta.path().is_ident("stable_hash") { continue; } let mut any_attr = false; @@ -31,20 +31,20 @@ fn parse_attributes(field: &syn::Field) -> Attributes { Ok(()) }); if !any_attr { - panic!("error parsing stable_hasher"); + panic!("error parsing stable_hash"); } } attrs } -pub(crate) fn hash_stable_derive(s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { - hash_stable_derive_with_mode(s, HashStableMode::Normal) +pub(crate) fn stable_hash_derive(s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { + stable_hash_derive_with_mode(s, HashStableMode::Normal) } -pub(crate) fn hash_stable_no_context_derive( +pub(crate) fn stable_hash_no_context_derive( s: synstructure::Structure<'_>, ) -> proc_macro2::TokenStream { - hash_stable_derive_with_mode(s, HashStableMode::NoContext) + stable_hash_derive_with_mode(s, HashStableMode::NoContext) } enum HashStableMode { @@ -64,7 +64,7 @@ enum HashStableMode { NoContext, } -fn hash_stable_derive_with_mode( +fn stable_hash_derive_with_mode( mut s: synstructure::Structure<'_>, mode: HashStableMode, ) -> proc_macro2::TokenStream { @@ -75,8 +75,8 @@ fn hash_stable_derive_with_mode( s.add_bounds(add_bounds); - let discriminant = hash_stable_discriminant(&mut s); - let body = hash_stable_body(&mut s); + let discriminant = stable_hash_discriminant(&mut s); + let body = stable_hash_body(&mut s); s.bound_impl( quote!(::rustc_data_structures::stable_hash::StableHash), @@ -94,7 +94,7 @@ fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>( ) } -fn hash_stable_discriminant(s: &mut synstructure::Structure<'_>) -> proc_macro2::TokenStream { +fn stable_hash_discriminant(s: &mut synstructure::Structure<'_>) -> proc_macro2::TokenStream { match s.ast().data { syn::Data::Enum(_) => quote! { ::std::mem::discriminant(self).stable_hash(__hcx, __hasher); @@ -104,7 +104,7 @@ fn hash_stable_discriminant(s: &mut synstructure::Structure<'_>) -> proc_macro2: } } -fn hash_stable_body(s: &mut synstructure::Structure<'_>) -> proc_macro2::TokenStream { +fn stable_hash_body(s: &mut synstructure::Structure<'_>) -> proc_macro2::TokenStream { s.each(|bi| { let attrs = parse_attributes(bi.ast()); if attrs.ignore { diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs index 87e206d5f071..84e0b37a7f7d 100644 --- a/compiler/rustc_middle/src/ty/generics.rs +++ b/compiler/rustc_middle/src/ty/generics.rs @@ -121,7 +121,7 @@ pub struct Generics { pub own_params: Vec, /// Reverse map to the `index` field of each `GenericParamDef`. - #[stable_hasher(ignore)] + #[stable_hash(ignore)] pub param_def_id_to_index: FxHashMap, pub has_self: bool, diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 276a21a5cb49..9c1b2cb93fc4 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1133,7 +1133,7 @@ pub struct OutputFilenames { /// preserved with a flag like `-C save-temps`, since these files may be /// hard linked. // This does not affect incr comp outputs, only where temp files are stored. - #[stable_hasher(ignore)] + #[stable_hash(ignore)] invocation_temp: Option, explicit_dwo_out_directory: Option,