Skip to content

Commit d50c0a5

Browse files
committed
Add hir::Attribute
1 parent 53b2c7c commit d50c0a5

File tree

89 files changed

+1143
-658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1143
-658
lines changed

Diff for: Cargo.lock

+3-1
Original file line numberDiff line numberDiff line change
@@ -3521,6 +3521,7 @@ dependencies = [
35213521
"rustc_fluent_macro",
35223522
"rustc_fs_util",
35233523
"rustc_hir",
3524+
"rustc_hir_pretty",
35243525
"rustc_incremental",
35253526
"rustc_index",
35263527
"rustc_macros",
@@ -3786,6 +3787,7 @@ dependencies = [
37863787
"rustc_span",
37873788
"rustc_target",
37883789
"smallvec",
3790+
"thin-vec",
37893791
"tracing",
37903792
]
37913793

@@ -4454,9 +4456,9 @@ version = "0.0.0"
44544456
dependencies = [
44554457
"rustc_abi",
44564458
"rustc_ast",
4457-
"rustc_ast_pretty",
44584459
"rustc_data_structures",
44594460
"rustc_hir",
4461+
"rustc_hir_pretty",
44604462
"rustc_middle",
44614463
"rustc_session",
44624464
"rustc_span",

Diff for: compiler/rustc_ast/src/ast.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ pub enum AttrArgs {
17591759
/// Span of the `=` token.
17601760
eq_span: Span,
17611761

1762-
expr: AttrArgsEq,
1762+
expr: P<Expr>,
17631763
},
17641764
}
17651765

@@ -1804,7 +1804,7 @@ impl AttrArgs {
18041804
match self {
18051805
AttrArgs::Empty => None,
18061806
AttrArgs::Delimited(args) => Some(args.dspan.entire()),
1807-
AttrArgs::Eq { eq_span, expr } => Some(eq_span.to(expr.span())),
1807+
AttrArgs::Eq { eq_span, expr } => Some(eq_span.to(expr.span)),
18081808
}
18091809
}
18101810

@@ -1814,7 +1814,7 @@ impl AttrArgs {
18141814
match self {
18151815
AttrArgs::Empty => TokenStream::default(),
18161816
AttrArgs::Delimited(args) => args.tokens.clone(),
1817-
AttrArgs::Eq { expr, .. } => TokenStream::from_ast(expr.unwrap_ast()),
1817+
AttrArgs::Eq { expr, .. } => TokenStream::from_ast(expr),
18181818
}
18191819
}
18201820
}
@@ -1828,13 +1828,9 @@ where
18281828
match self {
18291829
AttrArgs::Empty => {}
18301830
AttrArgs::Delimited(args) => args.hash_stable(ctx, hasher),
1831-
AttrArgs::Eq { expr: AttrArgsEq::Ast(expr), .. } => {
1831+
AttrArgs::Eq { expr, .. } => {
18321832
unreachable!("hash_stable {:?}", expr);
18331833
}
1834-
AttrArgs::Eq { eq_span, expr: AttrArgsEq::Hir(lit) } => {
1835-
eq_span.hash_stable(ctx, hasher);
1836-
lit.hash_stable(ctx, hasher);
1837-
}
18381834
}
18391835
}
18401836
}

0 commit comments

Comments
 (0)