Add highlight support for unsafe fn calls and raw ptr deref

This commit is contained in:
Paul Daniel Faria 2020-06-02 18:49:09 -04:00
parent 2f6ab77708
commit a9cb2933fb
11 changed files with 125 additions and 6 deletions

View file

@ -637,6 +637,10 @@ impl Function {
db.function_data(self.id).params.clone()
}
pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool {
db.function_data(self.id).is_unsafe
}
pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) {
let _p = profile("Function::diagnostics");
let infer = db.infer(self.id.into());
@ -1190,6 +1194,10 @@ impl Type {
)
}
pub fn is_raw_ptr(&self) -> bool {
matches!(&self.ty.value, Ty::Apply(ApplicationTy { ctor: TypeCtor::RawPtr(..), .. }))
}
pub fn contains_unknown(&self) -> bool {
return go(&self.ty.value);