Add new diagnostic

This commit is contained in:
George 2022-04-26 17:04:44 -04:00
parent 082e4ca497
commit 14a127be3e
17 changed files with 234 additions and 30 deletions

View file

@ -3314,6 +3314,12 @@ impl<'hir> Node<'hir> {
_ => None,
}
}
/// Get the fields for the tuple-constructor,
/// if this node is a tuple constructor, otherwise None
pub fn tuple_fields(&self) -> Option<&'hir [FieldDef<'hir>]> {
if let Node::Ctor(&VariantData::Tuple(fields, _)) = self { Some(fields) } else { None }
}
}
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.