diff options
| author | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2023-06-26 17:05:13 +0900 |
|---|---|---|
| committer | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2023-06-26 17:05:13 +0900 |
| commit | 7b418d3a8ceb6d84cdb6e80da7514dbd120c5e17 (patch) | |
| tree | 23979f7942af668f4dd77aaedeed88e9fd0888ee | |
| parent | b092b45484fb25729385205710a6c561852fd6dd (diff) | |
| download | rust-7b418d3a8ceb6d84cdb6e80da7514dbd120c5e17.tar.gz rust-7b418d3a8ceb6d84cdb6e80da7514dbd120c5e17.zip | |
Add the comment why `HasSource::source()` returns `Option`
| -rw-r--r-- | crates/hir/src/has_source.rs | 4 |
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>>; } |
