mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-03 18:29:23 +00:00

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`.
20 lines
434 B
Rust
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()
|
|
}
|