From 48ffbf29b799d4d2897d84f9902230e138b3c540 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 3 Sep 2019 08:59:09 +0300 Subject: use recrod terminology for hir::Pat --- crates/ra_hir/src/expr.rs | 4 ++-- crates/ra_hir/src/expr/lower.rs | 7 +++---- crates/ra_hir/src/ty/infer.rs | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 17e89c48f..bfd250f38 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -472,7 +472,7 @@ pub enum Pat { Missing, Wild, Tuple(Vec), - Struct { + Record { path: Option, args: Vec, // FIXME: 'ellipsis' option @@ -518,7 +518,7 @@ impl Pat { let total_iter = prefix.iter().chain(rest.iter()).chain(suffix.iter()); total_iter.copied().for_each(f); } - Pat::Struct { args, .. } => { + Pat::Record { args, .. } => { args.iter().map(|f| f.pat).for_each(f); } } diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs index 01b770149..f6a75a379 100644 --- a/crates/ra_hir/src/expr/lower.rs +++ b/crates/ra_hir/src/expr/lower.rs @@ -20,9 +20,8 @@ use crate::{ }; use super::{ - ArithOp, Array, BinaryOp, BindingAnnotation, Body, BodySourceMap, CmpOp, Expr, ExprId, - Literal, LogicOp, MatchArm, Ordering, Pat, PatId, PatPtr, RecordFieldPat, RecordLitField, - Statement, + ArithOp, Array, BinaryOp, BindingAnnotation, Body, BodySourceMap, CmpOp, Expr, ExprId, Literal, + LogicOp, MatchArm, Ordering, Pat, PatId, PatPtr, RecordFieldPat, RecordLitField, Statement, }; pub(crate) struct ExprCollector { @@ -504,7 +503,7 @@ where }); fields.extend(iter); - Pat::Struct { path, args: fields } + Pat::Record { path, args: fields } } // FIXME: implement diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 9ba146299..12d7bb174 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -749,7 +749,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { let is_non_ref_pat = match &body[pat] { Pat::Tuple(..) | Pat::TupleStruct { .. } - | Pat::Struct { .. } + | Pat::Record { .. } | Pat::Range { .. } | Pat::Slice { .. } => true, // FIXME: Path/Lit might actually evaluate to ref, but inference is unimplemented. @@ -809,7 +809,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { Pat::TupleStruct { path: ref p, args: ref subpats } => { self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm) } - Pat::Struct { path: ref p, args: ref fields } => { + Pat::Record { path: ref p, args: ref fields } => { self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat) } Pat::Path(path) => { -- cgit v1.2.3