about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/query-group-macro/tests/supertrait.rs
blob: 70073ac1de323d2c02914ff80ef95f3b525927eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()
}