diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 6 | ||||
-rw-r--r-- | crates/hir_def/src/expr.rs | 6 | ||||
-rw-r--r-- | crates/hir_def/src/path.rs | 6 |
3 files changed, 12 insertions, 6 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 | ||
292 | impl From<Name> for Box<Path> { | ||
293 | fn from(name: Name) -> Box<Path> { | ||
294 | Box::new(Path::from(name)) | ||
295 | } | ||
296 | } | ||
297 | |||
292 | impl From<Name> for ModPath { | 298 | impl 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)) |