aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/hir_def/src/body/lower.rs6
-rw-r--r--crates/hir_def/src/expr.rs6
-rw-r--r--crates/hir_def/src/path.rs6
-rw-r--r--crates/hir_ty/src/infer/pat.rs4
4 files changed, 14 insertions, 8 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index 73e7aee33..1e743e5d5 100644
--- a/crates/hir_def/src/body/lower.rs
+++ b/crates/hir_def/src/body/lower.rs
@@ -759,7 +759,7 @@ impl ExprCollector<'_> {
759 } 759 }
760 } 760 }
761 ast::Pat::TupleStructPat(p) => { 761 ast::Pat::TupleStructPat(p) => {
762 let path = p.path().and_then(|path| self.expander.parse_path(path)); 762 let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new);
763 let (args, ellipsis) = self.collect_tuple_pat(p.fields()); 763 let (args, ellipsis) = self.collect_tuple_pat(p.fields());
764 Pat::TupleStruct { path, args, ellipsis } 764 Pat::TupleStruct { path, args, ellipsis }
765 } 765 }
@@ -769,7 +769,7 @@ impl ExprCollector<'_> {
769 Pat::Ref { pat, mutability } 769 Pat::Ref { pat, mutability }
770 } 770 }
771 ast::Pat::PathPat(p) => { 771 ast::Pat::PathPat(p) => {
772 let path = p.path().and_then(|path| self.expander.parse_path(path)); 772 let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new);
773 path.map(Pat::Path).unwrap_or(Pat::Missing) 773 path.map(Pat::Path).unwrap_or(Pat::Missing)
774 } 774 }
775 ast::Pat::OrPat(p) => { 775 ast::Pat::OrPat(p) => {
@@ -783,7 +783,7 @@ impl ExprCollector<'_> {
783 } 783 }
784 ast::Pat::WildcardPat(_) => Pat::Wild, 784 ast::Pat::WildcardPat(_) => Pat::Wild,
785 ast::Pat::RecordPat(p) => { 785 ast::Pat::RecordPat(p) => {
786 let path = p.path().and_then(|path| self.expander.parse_path(path)); 786 let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new);
787 let args: Vec<_> = p 787 let args: Vec<_> = p
788 .record_pat_field_list() 788 .record_pat_field_list()
789 .expect("every struct should have a field list") 789 .expect("every struct should have a field list")
diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs
index ba00b9609..62a28bdba 100644
--- a/crates/hir_def/src/expr.rs
+++ b/crates/hir_def/src/expr.rs
@@ -412,13 +412,13 @@ pub enum Pat {
412 Wild, 412 Wild,
413 Tuple { args: Vec<PatId>, ellipsis: Option<usize> }, 413 Tuple { args: Vec<PatId>, ellipsis: Option<usize> },
414 Or(Vec<PatId>), 414 Or(Vec<PatId>),
415 Record { path: Option<Path>, args: Vec<RecordFieldPat>, ellipsis: bool }, 415 Record { path: Option<Box<Path>>, args: Vec<RecordFieldPat>, ellipsis: bool },
416 Range { start: ExprId, end: ExprId }, 416 Range { start: ExprId, end: ExprId },
417 Slice { prefix: Vec<PatId>, slice: Option<PatId>, suffix: Vec<PatId> }, 417 Slice { prefix: Vec<PatId>, slice: Option<PatId>, suffix: Vec<PatId> },
418 Path(Path), 418 Path(Box<Path>),
419 Lit(ExprId), 419 Lit(ExprId),
420 Bind { mode: BindingAnnotation, name: Name, subpat: Option<PatId> }, 420 Bind { mode: BindingAnnotation, name: Name, subpat: Option<PatId> },
421 TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> }, 421 TupleStruct { path: Option<Box<Path>>, args: Vec<PatId>, ellipsis: Option<usize> },
422 Ref { pat: PatId, mutability: Mutability }, 422 Ref { pat: PatId, mutability: Mutability },
423 Box { inner: PatId }, 423 Box { inner: PatId },
424 ConstBlock(ExprId), 424 ConstBlock(ExprId),
diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs
index f9c8328f0..b528ff8ba 100644
--- a/crates/hir_def/src/path.rs
+++ b/crates/hir_def/src/path.rs
@@ -289,6 +289,12 @@ impl From<Name> for Path {
289 } 289 }
290} 290}
291 291
292impl From<Name> for Box<Path> {
293 fn from(name: Name) -> Box<Path> {
294 Box::new(Path::from(name))
295 }
296}
297
292impl From<Name> for ModPath { 298impl From<Name> for ModPath {
293 fn from(name: Name) -> ModPath { 299 fn from(name: Name) -> ModPath {
294 ModPath::from_segments(PathKind::Plain, iter::once(name)) 300 ModPath::from_segments(PathKind::Plain, iter::once(name))
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs
index 252ae914a..afaf6b28b 100644
--- a/crates/hir_ty/src/infer/pat.rs
+++ b/crates/hir_ty/src/infer/pat.rs
@@ -174,7 +174,7 @@ impl<'a> InferenceContext<'a> {
174 TyKind::Ref(mutability, subty).intern(&Interner) 174 TyKind::Ref(mutability, subty).intern(&Interner)
175 } 175 }
176 Pat::TupleStruct { path: p, args: subpats, ellipsis } => self.infer_tuple_struct_pat( 176 Pat::TupleStruct { path: p, args: subpats, ellipsis } => self.infer_tuple_struct_pat(
177 p.as_ref(), 177 p.as_deref(),
178 subpats, 178 subpats,
179 expected, 179 expected,
180 default_bm, 180 default_bm,
@@ -182,7 +182,7 @@ impl<'a> InferenceContext<'a> {
182 *ellipsis, 182 *ellipsis,
183 ), 183 ),
184 Pat::Record { path: p, args: fields, ellipsis: _ } => { 184 Pat::Record { path: p, args: fields, ellipsis: _ } => {
185 self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat) 185 self.infer_record_pat(p.as_deref(), fields, expected, default_bm, pat)
186 } 186 }
187 Pat::Path(path) => { 187 Pat::Path(path) => {
188 // FIXME use correct resolver for the surrounding expression 188 // FIXME use correct resolver for the surrounding expression