flux_middle/
cstore.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use rustc_span::{def_id::DefId, Symbol};

use crate::{queries::QueryResult, rty};

pub type OptResult<T> = Option<QueryResult<T>>;

pub trait CrateStore {
    fn fn_sig(&self, def_id: DefId) -> OptResult<rty::EarlyBinder<rty::PolyFnSig>>;
    fn adt_def(&self, def_id: DefId) -> OptResult<rty::AdtDef>;
    fn adt_sort_def(&self, def_id: DefId) -> OptResult<rty::AdtSortDef>;
    fn generics_of(&self, def_id: DefId) -> OptResult<rty::Generics>;
    fn refinement_generics_of(&self, def_id: DefId) -> OptResult<rty::RefinementGenerics>;
    fn item_bounds(&self, def_id: DefId) -> OptResult<rty::EarlyBinder<rty::Clauses>>;
    fn predicates_of(&self, def_id: DefId) -> OptResult<rty::EarlyBinder<rty::GenericPredicates>>;
    fn assoc_refinements_of(&self, def_id: DefId) -> OptResult<rty::AssocRefinements>;
    fn assoc_refinements_def(
        &self,
        key: (DefId, Symbol),
    ) -> OptResult<rty::EarlyBinder<rty::Lambda>>;
    fn default_assoc_refinements_def(
        &self,
        key: (DefId, Symbol),
    ) -> OptResult<Option<rty::EarlyBinder<rty::Lambda>>>;
    fn sort_of_assoc_reft(
        &self,
        key: (DefId, Symbol),
    ) -> OptResult<Option<rty::EarlyBinder<rty::FuncSort>>>;
    fn variants(
        &self,
        def_id: DefId,
    ) -> OptResult<rty::Opaqueness<rty::EarlyBinder<rty::PolyVariants>>>;
    fn type_of(&self, def_id: DefId) -> OptResult<rty::EarlyBinder<rty::TyOrCtor>>;
}

pub type CrateStoreDyn = dyn CrateStore;