Add hir::Attribute

This commit is contained in:
Jonathan Dönszelmann
2024-10-17 01:14:01 +02:00
parent 53b2c7cc95
commit d50c0a5480
89 changed files with 1144 additions and 659 deletions

View File

@@ -44,20 +44,10 @@ pub mod token;
pub mod tokenstream;
pub mod visit;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
pub use self::ast::*;
pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasTokens};
/// Requirements for a `StableHashingContext` to be used in this crate.
/// This is a hack to allow using the `HashStable_Generic` derive macro
/// instead of implementing everything in `rustc_middle`.
pub trait HashStableContext: rustc_span::HashStableContext {
fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
}
impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute {
fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) {
hcx.hash_attr(self, hasher)
}
}
pub trait HashStableContext: rustc_span::HashStableContext {}