@@ -18,6 +18,7 @@ use crate::{
18
18
child_by_source:: ChildBySource ,
19
19
db:: DefDatabase ,
20
20
dyn_map:: DynMap ,
21
+ intern:: Interned ,
21
22
keys,
22
23
src:: { HasChildSource , HasSource } ,
23
24
type_ref:: { LifetimeRef , TypeBound , TypeRef } ,
@@ -29,7 +30,7 @@ use crate::{
29
30
#[ derive( Clone , PartialEq , Eq , Debug ) ]
30
31
pub struct TypeParamData {
31
32
pub name : Option < Name > ,
32
- pub default : Option < TypeRef > ,
33
+ pub default : Option < Interned < TypeRef > > ,
33
34
pub provenance : TypeParamProvenance ,
34
35
}
35
36
@@ -43,7 +44,7 @@ pub struct LifetimeParamData {
43
44
#[ derive( Clone , PartialEq , Eq , Debug ) ]
44
45
pub struct ConstParamData {
45
46
pub name : Name ,
46
- pub ty : TypeRef ,
47
+ pub ty : Interned < TypeRef > ,
47
48
}
48
49
49
50
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
@@ -75,7 +76,7 @@ pub enum WherePredicate {
75
76
76
77
#[ derive( Clone , PartialEq , Eq , Debug ) ]
77
78
pub enum WherePredicateTypeTarget {
78
- TypeRef ( TypeRef ) ,
79
+ TypeRef ( Interned < TypeRef > ) ,
79
80
/// For desugared where predicates that can directly refer to a type param.
80
81
TypeParam ( LocalTypeParamId ) ,
81
82
}
@@ -256,7 +257,8 @@ impl GenericParams {
256
257
for type_param in params. type_params ( ) {
257
258
let name = type_param. name ( ) . map_or_else ( Name :: missing, |it| it. as_name ( ) ) ;
258
259
// FIXME: Use `Path::from_src`
259
- let default = type_param. default_type ( ) . map ( |it| TypeRef :: from_ast ( lower_ctx, it) ) ;
260
+ let default =
261
+ type_param. default_type ( ) . map ( |it| Interned :: new ( TypeRef :: from_ast ( lower_ctx, it) ) ) ;
260
262
let param = TypeParamData {
261
263
name : Some ( name. clone ( ) ) ,
262
264
default,
@@ -280,7 +282,7 @@ impl GenericParams {
280
282
for const_param in params. const_params ( ) {
281
283
let name = const_param. name ( ) . map_or_else ( Name :: missing, |it| it. as_name ( ) ) ;
282
284
let ty = const_param. ty ( ) . map_or ( TypeRef :: Error , |it| TypeRef :: from_ast ( lower_ctx, it) ) ;
283
- let param = ConstParamData { name, ty } ;
285
+ let param = ConstParamData { name, ty : Interned :: new ( ty ) } ;
284
286
let param_id = self . consts . alloc ( param) ;
285
287
sm. const_params . insert ( param_id, const_param. clone ( ) ) ;
286
288
}
@@ -334,11 +336,11 @@ impl GenericParams {
334
336
( Either :: Left ( type_ref) , bound) => match hrtb_lifetimes {
335
337
Some ( hrtb_lifetimes) => WherePredicate :: ForLifetime {
336
338
lifetimes : hrtb_lifetimes. clone ( ) ,
337
- target : WherePredicateTypeTarget :: TypeRef ( type_ref) ,
339
+ target : WherePredicateTypeTarget :: TypeRef ( Interned :: new ( type_ref) ) ,
338
340
bound,
339
341
} ,
340
342
None => WherePredicate :: TypeBound {
341
- target : WherePredicateTypeTarget :: TypeRef ( type_ref) ,
343
+ target : WherePredicateTypeTarget :: TypeRef ( Interned :: new ( type_ref) ) ,
342
344
bound,
343
345
} ,
344
346
} ,
0 commit comments