mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
the "add missing members" assists: implemented substitution of default values of const params
This commit is contained in:
parent
6918eb6ebd
commit
52b4392724
8 changed files with 127 additions and 52 deletions
|
@ -57,7 +57,8 @@ use triomphe::Arc;
|
|||
use utils::Generics;
|
||||
|
||||
use crate::{
|
||||
consteval::unknown_const, db::HirDatabase, infer::unify::InferenceTable, utils::generics,
|
||||
consteval::unknown_const, db::HirDatabase, display::HirDisplay, infer::unify::InferenceTable,
|
||||
utils::generics,
|
||||
};
|
||||
|
||||
pub use autoderef::autoderef;
|
||||
|
@ -719,3 +720,12 @@ where
|
|||
value.visit_with(&mut collector, DebruijnIndex::INNERMOST);
|
||||
collector.placeholders.into_iter().collect()
|
||||
}
|
||||
|
||||
pub fn known_const_to_string(konst: &Const, db: &dyn HirDatabase) -> Option<String> {
|
||||
if let ConstValue::Concrete(c) = &konst.interned().value {
|
||||
if c.interned == ConstScalar::Unknown {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
Some(konst.display(db).to_string())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue