Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/files.rs')
-rw-r--r--crates/hir-expand/src/files.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir-expand/src/files.rs b/crates/hir-expand/src/files.rs
index 09a5c9326e..d64090f913 100644
--- a/crates/hir-expand/src/files.rs
+++ b/crates/hir-expand/src/files.rs
@@ -128,6 +128,16 @@ impl ErasedAstId {
}
}
+impl<FileKind, N: AstNode> InFileWrapper<FileKind, AstPtr<N>> {
+ #[inline]
+ pub fn upcast<M: AstNode>(self) -> InFileWrapper<FileKind, AstPtr<M>>
+ where
+ N: Into<M>,
+ {
+ self.map(|it| it.upcast())
+ }
+}
+
impl<FileKind, T> InFileWrapper<FileKind, T> {
pub fn new(file_id: FileKind, value: T) -> Self {
Self { file_id, value }