about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/hir
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2022-05-03 13:23:03 -0700
committerEric Huss <eric@huss.org>2022-08-11 21:48:39 -0700
commitb651c1cebe5f365201d568507ddb49ca343f2e7d (patch)
treeb26963368c9baa9a06e22ff73ee8aa64a0f6e5fe /compiler/rustc_middle/src/hir
parent1b464c73b7f5223d85eb2380af7f448c4be6baf4 (diff)
downloadrust-b651c1cebe5f365201d568507ddb49ca343f2e7d.tar.gz
rust-b651c1cebe5f365201d568507ddb49ca343f2e7d.zip
Check attributes on struct expression fields.
Attributes on struct expression fields were not being checked for
validity. This adds the fields as HIR nodes so that `CheckAttrVisitor`
can visit those nodes to check their attributes.
Diffstat (limited to 'compiler/rustc_middle/src/hir')
-rw-r--r--compiler/rustc_middle/src/hir/map/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs
index 06fdef4142e..79e6804a289 100644
--- a/compiler/rustc_middle/src/hir/map/mod.rs
+++ b/compiler/rustc_middle/src/hir/map/mod.rs
@@ -298,6 +298,7 @@ impl<'hir> Map<'hir> {
             | Node::TraitRef(_)
             | Node::Pat(_)
             | Node::PatField(_)
+            | Node::ExprField(_)
             | Node::Local(_)
             | Node::Param(_)
             | Node::Arm(_)
@@ -1021,6 +1022,7 @@ impl<'hir> Map<'hir> {
             Node::Field(field) => field.span,
             Node::AnonConst(constant) => self.body(constant.body).value.span,
             Node::Expr(expr) => expr.span,
+            Node::ExprField(field) => field.span,
             Node::Stmt(stmt) => stmt.span,
             Node::PathSegment(seg) => {
                 let ident_span = seg.ident.span;
@@ -1243,6 +1245,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String {
         }
         Some(Node::AnonConst(_)) => node_str("const"),
         Some(Node::Expr(_)) => node_str("expr"),
+        Some(Node::ExprField(_)) => node_str("expr field"),
         Some(Node::Stmt(_)) => node_str("stmt"),
         Some(Node::PathSegment(_)) => node_str("path segment"),
         Some(Node::Ty(_)) => node_str("type"),