rust-analyzer/crates/query-group-macro/tests/supertrait.rs
Chayim Refael Friedman c58ddafe90 Make HirFileId, EditionedFileId and macro files Salsa struct
And make more queries non-interned.

Also flip the default for queries, now the default is to not intern and to intern a query you need to say `invoke_interned`.
2025-04-19 22:10:52 +03:00

20 lines
434 B
Rust

use query_group_macro::query_group;
#[salsa::db]
pub trait SourceDb: salsa::Database {
/// Text of the file.
fn file_text(&self, id: usize) -> String;
}
#[query_group]
pub trait RootDb: SourceDb {
#[salsa::invoke_interned(parse)]
fn parse(&self, id: usize) -> String;
}
fn parse(db: &dyn RootDb, id: usize) -> String {
// this is the test: does the following compile?
db.file_text(id);
String::new()
}