mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Add highlight support for unsafe fn calls and raw ptr deref
This commit is contained in:
parent
2f6ab77708
commit
a9cb2933fb
11 changed files with 125 additions and 6 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue