mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Added consteval tests
This commit is contained in:
parent
2f84b6e2e5
commit
ad0a6bf1a3
6 changed files with 46 additions and 11 deletions
|
@ -952,6 +952,10 @@ impl Enum {
|
|||
pub fn ty(self, db: &dyn HirDatabase) -> Type {
|
||||
Type::from_def(db, self.id)
|
||||
}
|
||||
|
||||
pub fn is_data_carrying(self, db: &dyn HirDatabase) -> bool {
|
||||
self.variants(db).iter().all(|v| matches!(v.kind(db), StructKind::Unit))
|
||||
}
|
||||
}
|
||||
|
||||
impl HasVisibility for Enum {
|
||||
|
@ -996,7 +1000,6 @@ impl Variant {
|
|||
}
|
||||
|
||||
pub fn value(self, db: &dyn HirDatabase) -> Option<Expr> {
|
||||
// TODO(ole): Handle missing exprs (+1 to the prev)
|
||||
self.source(db)?.value.expr()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue