Differentiate method/tymethod by determining 'defaultness'
Currently a method only has defaultness if it is a provided trait method, but this will change when specialisation is available and may need to become a concept known to hir. I opted to go for a 'fewest changes' approach given specialisation is still under development.
This commit is contained in:
@@ -772,7 +772,14 @@ impl Function {
|
||||
hir_ty::diagnostics::validate_body(db, self.id.into(), sink)
|
||||
}
|
||||
|
||||
pub fn parent_def(self, db: &dyn HirDatabase) -> Option<MethodOwner> {
|
||||
/// Whether this function declaration has a definition.
|
||||
///
|
||||
/// This is false in the case of required (not provided) trait methods.
|
||||
pub fn has_body(self, db: &dyn HirDatabase) -> bool {
|
||||
db.function_data(self.id).has_body
|
||||
}
|
||||
|
||||
pub fn method_owner(self, db: &dyn HirDatabase) -> Option<MethodOwner> {
|
||||
match self.as_assoc_item(db).map(|assoc| assoc.container(db)) {
|
||||
Some(AssocItemContainer::Trait(t)) => Some(t.into()),
|
||||
Some(AssocItemContainer::ImplDef(imp)) => {
|
||||
|
||||
Reference in New Issue
Block a user