mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
the "add missing members" assists: supported bracketed default const values
This commit is contained in:
parent
4e2be8e959
commit
61cabe029f
3 changed files with 43 additions and 6 deletions
|
@ -52,6 +52,7 @@ use hir_expand::name;
|
|||
use la_arena::{Arena, Idx};
|
||||
use mir::{MirEvalError, VTableMap};
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::AstNode;
|
||||
use traits::FnTrait;
|
||||
use triomphe::Arc;
|
||||
use utils::Generics;
|
||||
|
@ -723,12 +724,12 @@ where
|
|||
|
||||
pub fn known_const_to_string(konst: &Const, db: &dyn HirDatabase) -> Option<String> {
|
||||
if let ConstValue::Concrete(c) = &konst.interned().value {
|
||||
if let ConstScalar::UnevaluatedConst(GeneralConstId::InTypeConstId(_), _) = &c.interned {
|
||||
// FIXME: stringify the block expression
|
||||
return None;
|
||||
}
|
||||
if c.interned == ConstScalar::Unknown {
|
||||
return None;
|
||||
match c.interned {
|
||||
ConstScalar::UnevaluatedConst(GeneralConstId::InTypeConstId(cid), _) => {
|
||||
return Some(cid.source(db.upcast()).syntax().to_string());
|
||||
}
|
||||
ConstScalar::Unknown => return None,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
Some(konst.display(db).to_string())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue