Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-srv-cli/tests/common/utils.rs')
| -rw-r--r-- | crates/proc-macro-srv-cli/tests/common/utils.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/proc-macro-srv-cli/tests/common/utils.rs b/crates/proc-macro-srv-cli/tests/common/utils.rs index 051f28aee2..b78e107452 100644 --- a/crates/proc-macro-srv-cli/tests/common/utils.rs +++ b/crates/proc-macro-srv-cli/tests/common/utils.rs @@ -135,6 +135,11 @@ pub(crate) fn proc_macro_test_dylib_path() -> Utf8PathBuf { path.into() } +fn make_ctx() -> SyntaxContext { + // SAFETY: Tests do not use a Database, so this won't ever be used within salsa. + unsafe { SyntaxContext::from_u32(0) } +} + /// Creates a simple empty token tree suitable for testing. pub(crate) fn create_empty_token_tree( version: u32, @@ -144,8 +149,7 @@ pub(crate) fn create_empty_token_tree( file_id: EditionedFileId::new(FileId::from_raw(0), Edition::CURRENT), ast_id: span::ROOT_ERASED_FILE_AST_ID, }; - let span = - Span { range: TextRange::empty(0.into()), anchor, ctx: SyntaxContext::from_u32_safe(0) }; + let span = Span { range: TextRange::empty(0.into()), anchor, ctx: make_ctx() }; let builder = TopSubtreeBuilder::new(Delimiter { open: span, |