Skip to content

Commit

Permalink
Add hir::Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jdonszelmann committed Dec 7, 2024
1 parent 417c4e2 commit 188807a
Show file tree
Hide file tree
Showing 88 changed files with 1,140 additions and 659 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3717,6 +3717,7 @@ dependencies = [
"rustc_span",
"rustc_target",
"smallvec",
"thin-vec",
"tracing",
]

Expand Down Expand Up @@ -4385,9 +4386,9 @@ version = "0.0.0"
dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_ast_pretty",
"rustc_data_structures",
"rustc_hir",
"rustc_hir_pretty",
"rustc_middle",
"rustc_session",
"rustc_span",
Expand Down
12 changes: 4 additions & 8 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ pub enum AttrArgs {
/// Span of the `=` token.
eq_span: Span,

expr: AttrArgsEq,
expr: P<Expr>,
},
}

Expand Down Expand Up @@ -1780,7 +1780,7 @@ impl AttrArgs {
match self {
AttrArgs::Empty => None,
AttrArgs::Delimited(args) => Some(args.dspan.entire()),
AttrArgs::Eq { eq_span, expr } => Some(eq_span.to(expr.span())),
AttrArgs::Eq { eq_span, expr } => Some(eq_span.to(expr.span)),
}
}

Expand All @@ -1790,7 +1790,7 @@ impl AttrArgs {
match self {
AttrArgs::Empty => TokenStream::default(),
AttrArgs::Delimited(args) => args.tokens.clone(),
AttrArgs::Eq { expr, .. } => TokenStream::from_ast(expr.unwrap_ast()),
AttrArgs::Eq { expr, .. } => TokenStream::from_ast(expr),
}
}
}
Expand All @@ -1804,13 +1804,9 @@ where
match self {
AttrArgs::Empty => {}
AttrArgs::Delimited(args) => args.hash_stable(ctx, hasher),
AttrArgs::Eq { expr: AttrArgsEq::Ast(expr), .. } => {
AttrArgs::Eq { expr, .. } => {
unreachable!("hash_stable {:?}", expr);
}
AttrArgs::Eq { eq_span, expr: AttrArgsEq::Hir(lit) } => {
eq_span.hash_stable(ctx, hasher);
lit.hash_stable(ctx, hasher);
}
}
}
}
Expand Down
Loading

0 comments on commit 188807a

Please sign in to comment.