mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Determine function unsafety semantically
This commit is contained in:
parent
12f803d1e3
commit
5d8b4c40eb
12 changed files with 107 additions and 98 deletions
|
@ -1421,16 +1421,16 @@ impl Function {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool {
|
||||
db.function_data(self.id).is_unsafe()
|
||||
}
|
||||
|
||||
pub fn is_const(self, db: &dyn HirDatabase) -> bool {
|
||||
db.function_data(self.id).is_const()
|
||||
db.function_data(self.id).has_const_kw()
|
||||
}
|
||||
|
||||
pub fn is_async(self, db: &dyn HirDatabase) -> bool {
|
||||
db.function_data(self.id).is_async()
|
||||
db.function_data(self.id).has_async_kw()
|
||||
}
|
||||
|
||||
pub fn is_unsafe_to_call(self, db: &dyn HirDatabase) -> bool {
|
||||
hir_ty::is_fn_unsafe_to_call(db, self.id)
|
||||
}
|
||||
|
||||
/// Whether this function declaration has a definition.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue