mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Implement box pattern inference
This commit is contained in:
parent
2de6eb7bc8
commit
07a704e31c
3 changed files with 20 additions and 2 deletions
|
@ -835,8 +835,12 @@ impl ExprCollector<'_> {
|
|||
|
||||
Pat::Missing
|
||||
}
|
||||
ast::Pat::BoxPat(boxpat) => {
|
||||
let inner = self.collect_pat_opt(boxpat.pat());
|
||||
Pat::Box { inner }
|
||||
}
|
||||
// FIXME: implement
|
||||
ast::Pat::BoxPat(_) | ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing,
|
||||
ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing,
|
||||
};
|
||||
let ptr = AstPtr::new(&pat);
|
||||
self.alloc_pat(pattern, Either::Left(ptr))
|
||||
|
|
|
@ -395,6 +395,7 @@ pub enum Pat {
|
|||
Bind { mode: BindingAnnotation, name: Name, subpat: Option<PatId> },
|
||||
TupleStruct { path: Option<Path>, args: Vec<PatId>, ellipsis: Option<usize> },
|
||||
Ref { pat: PatId, mutability: Mutability },
|
||||
Box { inner: PatId },
|
||||
}
|
||||
|
||||
impl Pat {
|
||||
|
@ -415,6 +416,7 @@ impl Pat {
|
|||
Pat::Record { args, .. } => {
|
||||
args.iter().map(|f| f.pat).for_each(f);
|
||||
}
|
||||
Pat::Box { inner } => f(*inner),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue