diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index ab5caff86204d..bb84e0bfc5ebc 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -695,14 +695,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let bodies = SortedMap::from_presorted_elements(bodies); // Don't hash unless necessary, because it's expensive. - let rustc_middle::hir::Hashes { opt_hash_including_bodies, attrs_hash, delayed_lints_hash } = - self.tcx.hash_owner_nodes(node, &bodies, &attrs, &delayed_lints, define_opaque); + let rustc_middle::hir::Hashes { opt_hash_including_bodies, attrs_hash } = + self.tcx.hash_owner_nodes(node, &bodies, &attrs, define_opaque); let num_nodes = self.item_local_id_counter.as_usize(); let (nodes, parenting) = index::index_hir(self.tcx, node, &bodies, num_nodes); let nodes = hir::OwnerNodes { opt_hash_including_bodies, nodes, bodies }; let attrs = hir::AttributeMap { map: attrs, opt_hash: attrs_hash, define_opaque }; - let delayed_lints = - hir::lints::DelayedLints { lints: delayed_lints, opt_hash: delayed_lints_hash }; + let delayed_lints = hir::lints::DelayedLints { lints: delayed_lints }; self.arena.alloc(hir::OwnerInfo { nodes, parenting, attrs, trait_map, delayed_lints }) } diff --git a/compiler/rustc_hir/src/lints.rs b/compiler/rustc_hir/src/lints.rs index eba2d182d2c48..ac383beb0bc61 100644 --- a/compiler/rustc_hir/src/lints.rs +++ b/compiler/rustc_hir/src/lints.rs @@ -1,7 +1,5 @@ -use rustc_data_structures::fingerprint::Fingerprint; pub use rustc_lint_defs::AttributeLintKind; use rustc_lint_defs::LintId; -use rustc_macros::HashStable_Generic; use rustc_span::Span; use crate::HirId; @@ -9,8 +7,6 @@ use crate::HirId; #[derive(Debug)] pub struct DelayedLints { pub lints: Box<[DelayedLint]>, - // Only present when the crate hash is needed. - pub opt_hash: Option, } /// During ast lowering, no lints can be emitted. @@ -19,12 +15,12 @@ pub struct DelayedLints { /// and then there's a gap where no lints can be emitted until HIR is done. /// The variants in this enum represent lints that are temporarily stashed during /// AST lowering to be emitted once HIR is built. -#[derive(Debug, HashStable_Generic)] +#[derive(Debug)] pub enum DelayedLint { AttributeParsing(AttributeLint), } -#[derive(Debug, HashStable_Generic)] +#[derive(Debug)] pub struct AttributeLint { pub lint_id: LintId, pub id: Id, diff --git a/compiler/rustc_hir/src/stable_hash_impls.rs b/compiler/rustc_hir/src/stable_hash_impls.rs index 16e8bac3d8a4d..e48cd39196305 100644 --- a/compiler/rustc_hir/src/stable_hash_impls.rs +++ b/compiler/rustc_hir/src/stable_hash_impls.rs @@ -81,10 +81,7 @@ impl<'tcx, HirCtx: crate::HashStableContext> HashStable for OwnerNodes<' } impl HashStable for DelayedLints { - fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) { - let DelayedLints { opt_hash, .. } = *self; - opt_hash.unwrap().hash_stable(hcx, hasher); - } + fn hash_stable(&self, _hcx: &mut HirCtx, _hasher: &mut StableHasher) {} } impl<'tcx, HirCtx: crate::HashStableContext> HashStable for AttributeMap<'tcx> { diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 19ba27a27eafe..565eb6c46997c 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -700,7 +700,7 @@ pub enum BuiltinLintDiag { AttributeLint(AttributeLintKind), } -#[derive(Debug, HashStable_Generic)] +#[derive(Debug)] pub enum AttributeLintKind { UnusedDuplicate { this: Span, diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index 0ab5a792e040b..dae5f0d78a620 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -12,7 +12,6 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::{DynSend, DynSync, try_par_for_each_in}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; -use rustc_hir::lints::DelayedLint; use rustc_hir::*; use rustc_macros::{Decodable, Encodable, HashStable}; use rustc_span::{ErrorGuaranteed, ExpnId, Span}; @@ -165,15 +164,10 @@ impl<'tcx> TyCtxt<'tcx> { node: OwnerNode<'_>, bodies: &SortedMap>, attrs: &SortedMap, - delayed_lints: &[DelayedLint], define_opaque: Option<&[(Span, LocalDefId)]>, ) -> Hashes { if !self.needs_crate_hash() { - return Hashes { - opt_hash_including_bodies: None, - attrs_hash: None, - delayed_lints_hash: None, - }; + return Hashes { opt_hash_including_bodies: None, attrs_hash: None }; } self.with_stable_hashing_context(|mut hcx| { @@ -191,16 +185,7 @@ impl<'tcx> TyCtxt<'tcx> { let h2 = stable_hasher.finish(); - // hash lints emitted during ast lowering - let mut stable_hasher = StableHasher::new(); - delayed_lints.hash_stable(&mut hcx, &mut stable_hasher); - let h3 = stable_hasher.finish(); - - Hashes { - opt_hash_including_bodies: Some(h1), - attrs_hash: Some(h2), - delayed_lints_hash: Some(h3), - } + Hashes { opt_hash_including_bodies: Some(h1), attrs_hash: Some(h2) } }) } @@ -364,7 +349,6 @@ impl<'tcx> TyCtxt<'tcx> { pub struct Hashes { pub opt_hash_including_bodies: Option, pub attrs_hash: Option, - pub delayed_lints_hash: Option, } pub fn provide(providers: &mut Providers) { diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 88f0a2a7c23c6..e1859302dfa5a 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1496,7 +1496,7 @@ impl<'tcx> TyCtxtFeed<'tcx, LocalDefId> { let attrs = hir::AttributeMap::EMPTY; let rustc_middle::hir::Hashes { opt_hash_including_bodies, .. } = - self.tcx.hash_owner_nodes(node, &bodies, &attrs.map, &[], attrs.define_opaque); + self.tcx.hash_owner_nodes(node, &bodies, &attrs.map, attrs.define_opaque); let node = node.into(); self.opt_hir_owner_nodes(Some(self.tcx.arena.alloc(hir::OwnerNodes { opt_hash_including_bodies,