about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-26 10:12:00 +0000
committerbors <bors@rust-lang.org>2023-06-26 10:12:00 +0000
commit8769cd24bcb742d33b2deeb010342ab8e41eb103 (patch)
treee319681ef3850f076425c0550dd4e7aa4a1ad8e2
parent4a2ceeff0fb53de168691b0f55d9808d221b867e (diff)
parent7b418d3a8ceb6d84cdb6e80da7514dbd120c5e17 (diff)
downloadrust-8769cd24bcb742d33b2deeb010342ab8e41eb103.tar.gz
rust-8769cd24bcb742d33b2deeb010342ab8e41eb103.zip
Auto merge of #15140 - tetsuharuohzeki:issue-15088-comment, r=Veykril
Add the comment why `HasSource::source()` returns `Option`

Fix https://github.com/rust-lang/rust-analyzer/issues/15088
-rw-r--r--crates/hir/src/has_source.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 63d11155c6a..b46a3856d45 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -21,6 +21,10 @@ pub trait HasSource {
     /// Fetches the definition's source node.
     /// Using [`crate::Semantics::source`] is preferred when working with [`crate::Semantics`],
     /// as that caches the parsed file in the semantics' cache.
+    ///
+    /// The current some implementations can return `InFile` instead of `Option<InFile>`.
+    /// But we made this method `Option` to support rlib in the future
+    /// by https://github.com/rust-lang/rust-analyzer/issues/6913
     fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>;
 }