Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/hir.rs')
-rw-r--r--crates/hir-def/src/hir.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs
index 6eba859264..2f7724c72e 100644
--- a/crates/hir-def/src/hir.rs
+++ b/crates/hir-def/src/hir.rs
@@ -224,6 +224,7 @@ pub enum Expr {
Loop {
body: ExprId,
label: Option<LabelId>,
+ source: LoopSource,
},
Call {
callee: ExprId,
@@ -389,6 +390,17 @@ impl Expr {
}
}
+/// The loop type that yielded an `Expr::Loop`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum LoopSource {
+ /// A `loop { .. }` loop.
+ Loop,
+ /// A `while _ { .. }` loop.
+ While,
+ /// A `for _ in _ { .. }` loop.
+ ForLoop,
+}
+
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OffsetOf {
pub container: TypeRefId,
@@ -717,6 +729,7 @@ pub enum Pat {
Deref {
inner: PatId,
},
+ NotNull,
ConstBlock(ExprId),
/// An expression inside a pattern. That can only occur inside assignments.
///
@@ -734,7 +747,8 @@ impl Pat {
| Pat::Wild
| Pat::Missing
| Pat::Rest
- | Pat::Expr(_) => {}
+ | Pat::Expr(_)
+ | Pat::NotNull => {}
Pat::Bind { subpat, .. } => {
subpat.iter().copied().for_each(f);
}