Change Option::Some bug to a fixme note

IMO this is too much work to be worth fixing at the moment.
This commit is contained in:
Zac Pullar-Strecker 2020-09-03 20:09:36 +12:00
parent c648884397
commit 26086faab2
2 changed files with 4 additions and 3 deletions

View file

@ -779,6 +779,7 @@ impl Function {
db.function_data(self.id).has_body db.function_data(self.id).has_body
} }
/// If this function is a method, the trait or type where it is declared.
pub fn method_owner(self, db: &dyn HirDatabase) -> Option<MethodOwner> { pub fn method_owner(self, db: &dyn HirDatabase) -> Option<MethodOwner> {
match self.as_assoc_item(db).map(|assoc| assoc.container(db)) { match self.as_assoc_item(db).map(|assoc| assoc.container(db)) {
Some(AssocItemContainer::Trait(t)) => Some(t.into()), Some(AssocItemContainer::Trait(t)) => Some(t.into()),

View file

@ -103,8 +103,8 @@ pub fn get_doc_link<T: Resolvable + Clone>(db: &dyn HirDatabase, definition: &T)
get_doc_link_impl(db, &module_def) get_doc_link_impl(db, &module_def)
} }
// TODO: // FIXME:
// BUG: For Option // BUG: For Option::Some
// Returns https://doc.rust-lang.org/nightly/core/prelude/v1/enum.Option.html#variant.Some // Returns https://doc.rust-lang.org/nightly/core/prelude/v1/enum.Option.html#variant.Some
// Instead of https://doc.rust-lang.org/nightly/core/option/enum.Option.html // Instead of https://doc.rust-lang.org/nightly/core/option/enum.Option.html
// This could be worked around by turning the `EnumVariant` into `Enum` before attempting resolution, // This could be worked around by turning the `EnumVariant` into `Enum` before attempting resolution,
@ -405,7 +405,7 @@ fn get_symbol_fragment(db: &dyn HirDatabase, field_or_assoc: &FieldOrAssocItem)
let is_trait_method = let is_trait_method =
matches!(function.method_owner(db), Some(MethodOwner::Trait(..))); matches!(function.method_owner(db), Some(MethodOwner::Trait(..)));
// This distinction may get more complicated when specialisation is available. // This distinction may get more complicated when specialisation is available.
// In particular this decision is made based on whether a method 'has defaultness'. // Rustdoc makes this decision based on whether a method 'has defaultness'.
// Currently this is only the case for provided trait methods. // Currently this is only the case for provided trait methods.
if is_trait_method && !function.has_body(db) { if is_trait_method && !function.has_body(db) {
format!("#tymethod.{}", function.name(db)) format!("#tymethod.{}", function.name(db))