@@ -28,6 +28,7 @@ use crate::{
28
28
mir:: { BorrowckResult , MirBody , MirLowerError } ,
29
29
} ;
30
30
31
+ #[ allow( clippy:: needless_lifetimes) ]
31
32
#[ query_group:: query_group]
32
33
pub trait HirDatabase : DefDatabase + Upcast < dyn DefDatabase > + std:: fmt:: Debug {
33
34
#[ salsa:: invoke_actual( crate :: infer:: infer_query) ]
@@ -44,19 +45,19 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
44
45
45
46
#[ salsa:: invoke( crate :: mir:: monomorphized_mir_body_query) ]
46
47
#[ salsa:: cycle( crate :: mir:: monomorphized_mir_body_recover) ]
47
- fn monomorphized_mir_body (
48
- & self ,
48
+ fn monomorphized_mir_body < ' db > (
49
+ & ' db self ,
49
50
def : DefWithBodyId ,
50
51
subst : Substitution ,
51
- env : Arc < TraitEnvironment > ,
52
+ env : TraitEnvironment < ' db > ,
52
53
) -> Result < Arc < MirBody > , MirLowerError > ;
53
54
54
55
#[ salsa:: invoke( crate :: mir:: monomorphized_mir_body_for_closure_query) ]
55
- fn monomorphized_mir_body_for_closure (
56
- & self ,
56
+ fn monomorphized_mir_body_for_closure < ' db > (
57
+ & ' db self ,
57
58
def : ClosureId ,
58
59
subst : Substitution ,
59
- env : Arc < TraitEnvironment > ,
60
+ env : TraitEnvironment < ' db > ,
60
61
) -> Result < Arc < MirBody > , MirLowerError > ;
61
62
62
63
#[ salsa:: invoke( crate :: mir:: borrowck_query) ]
@@ -65,11 +66,11 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
65
66
66
67
#[ salsa:: invoke( crate :: consteval:: const_eval_query) ]
67
68
#[ salsa:: cycle( crate :: consteval:: const_eval_recover) ]
68
- fn const_eval (
69
- & self ,
69
+ fn const_eval < ' db > (
70
+ & ' db self ,
70
71
def : GeneralConstId ,
71
72
subst : Substitution ,
72
- trait_env : Option < Arc < TraitEnvironment > > ,
73
+ trait_env : Option < TraitEnvironment < ' db > > ,
73
74
) -> Result < Const , ConstEvalError > ;
74
75
75
76
#[ salsa:: invoke_actual( crate :: consteval:: const_eval_static_query) ]
@@ -81,9 +82,9 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
81
82
fn const_eval_discriminant ( & self , def : EnumVariantId ) -> Result < i128 , ConstEvalError > ;
82
83
83
84
#[ salsa:: invoke( crate :: method_resolution:: lookup_impl_method_query) ]
84
- fn lookup_impl_method (
85
- & self ,
86
- env : Arc < TraitEnvironment > ,
85
+ fn lookup_impl_method < ' db > (
86
+ & ' db self ,
87
+ env : TraitEnvironment < ' db > ,
87
88
func : FunctionId ,
88
89
fn_subst : Substitution ,
89
90
) -> ( FunctionId , Substitution ) ;
@@ -92,16 +93,20 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
92
93
93
94
#[ salsa:: invoke( crate :: layout:: layout_of_adt_query) ]
94
95
#[ salsa:: cycle( crate :: layout:: layout_of_adt_recover) ]
95
- fn layout_of_adt (
96
- & self ,
96
+ fn layout_of_adt < ' db > (
97
+ & ' db self ,
97
98
def : AdtId ,
98
99
subst : Substitution ,
99
- env : Arc < TraitEnvironment > ,
100
+ env : TraitEnvironment < ' db > ,
100
101
) -> Result < Arc < Layout > , LayoutError > ;
101
102
102
103
#[ salsa:: invoke( crate :: layout:: layout_of_ty_query) ]
103
104
#[ salsa:: cycle( crate :: layout:: layout_of_ty_recover) ]
104
- fn layout_of_ty ( & self , ty : Ty , env : Arc < TraitEnvironment > ) -> Result < Arc < Layout > , LayoutError > ;
105
+ fn layout_of_ty < ' db > (
106
+ & ' db self ,
107
+ ty : Ty ,
108
+ env : TraitEnvironment < ' db > ,
109
+ ) -> Result < Arc < Layout > , LayoutError > ;
105
110
106
111
#[ salsa:: invoke_actual( crate :: layout:: target_data_layout_query) ]
107
112
fn target_data_layout ( & self , krate : Crate ) -> Result < Arc < TargetDataLayout > , Arc < str > > ;
@@ -181,10 +186,10 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
181
186
182
187
#[ salsa:: invoke_actual( crate :: lower:: trait_environment_for_body_query) ]
183
188
#[ salsa:: transparent]
184
- fn trait_environment_for_body ( & self , def : DefWithBodyId ) -> Arc < TraitEnvironment > ;
189
+ fn trait_environment_for_body < ' db > ( & ' db self , def : DefWithBodyId ) -> TraitEnvironment < ' db > ;
185
190
186
191
#[ salsa:: invoke_actual( crate :: lower:: trait_environment_query) ]
187
- fn trait_environment ( & self , def : GenericDefId ) -> Arc < TraitEnvironment > ;
192
+ fn trait_environment < ' db > ( & ' db self , def : GenericDefId ) -> TraitEnvironment < ' db > ;
188
193
189
194
#[ salsa:: invoke_actual( crate :: lower:: generic_defaults_with_diagnostics_query) ]
190
195
#[ salsa:: cycle( crate :: lower:: generic_defaults_with_diagnostics_recover) ]
@@ -286,10 +291,10 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
286
291
287
292
#[ salsa:: invoke( crate :: traits:: normalize_projection_query) ]
288
293
#[ salsa:: transparent]
289
- fn normalize_projection (
290
- & self ,
294
+ fn normalize_projection < ' db > (
295
+ & ' db self ,
291
296
projection : crate :: ProjectionTy ,
292
- env : Arc < TraitEnvironment > ,
297
+ env : TraitEnvironment < ' db > ,
293
298
) -> Ty ;
294
299
295
300
#[ salsa:: invoke( crate :: traits:: trait_solve_query) ]
@@ -310,7 +315,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
310
315
311
316
#[ salsa:: invoke( crate :: drop:: has_drop_glue) ]
312
317
#[ salsa:: cycle( crate :: drop:: has_drop_glue_recover) ]
313
- fn has_drop_glue ( & self , ty : Ty , env : Arc < TraitEnvironment > ) -> DropGlue ;
318
+ fn has_drop_glue < ' db > ( & ' db self , ty : Ty , env : TraitEnvironment < ' db > ) -> DropGlue ;
314
319
}
315
320
316
321
#[ test]
0 commit comments