Skip to content

Commit 8769cd2

Browse files
committed
Auto merge of #15140 - tetsuharuohzeki:issue-15088-comment, r=Veykril
Add the comment why `HasSource::source()` returns `Option` Fix #15088
2 parents 4a2ceef + 7b418d3 commit 8769cd2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/hir/src/has_source.rs

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ pub trait HasSource {
2121
/// Fetches the definition's source node.
2222
/// Using [`crate::Semantics::source`] is preferred when working with [`crate::Semantics`],
2323
/// as that caches the parsed file in the semantics' cache.
24+
///
25+
/// The current some implementations can return `InFile` instead of `Option<InFile>`.
26+
/// But we made this method `Option` to support rlib in the future
27+
/// by https://github.com/rust-lang/rust-analyzer/issues/6913
2428
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>;
2529
}
2630

0 commit comments

Comments
 (0)