@@ -30,6 +30,7 @@ use crate::{
30
30
LabelId , Literal , LogicOp , MatchArm , Ordering , Pat , PatId , RecordFieldPat , RecordLitField ,
31
31
Statement ,
32
32
} ,
33
+ intern:: Interned ,
33
34
item_scope:: BuiltinShadowMode ,
34
35
path:: { GenericArgs , Path } ,
35
36
type_ref:: { Mutability , Rawness , TypeRef } ,
@@ -432,7 +433,7 @@ impl ExprCollector<'_> {
432
433
}
433
434
ast:: Expr :: CastExpr ( e) => {
434
435
let expr = self . collect_expr_opt ( e. expr ( ) ) ;
435
- let type_ref = Box :: new ( TypeRef :: from_ast_opt ( & self . ctx ( ) , e. ty ( ) ) ) ;
436
+ let type_ref = Interned :: new ( TypeRef :: from_ast_opt ( & self . ctx ( ) , e. ty ( ) ) ) ;
436
437
self . alloc_expr ( Expr :: Cast { expr, type_ref } , syntax_ptr)
437
438
}
438
439
ast:: Expr :: RefExpr ( e) => {
@@ -466,15 +467,16 @@ impl ExprCollector<'_> {
466
467
if let Some ( pl) = e. param_list ( ) {
467
468
for param in pl. params ( ) {
468
469
let pat = self . collect_pat_opt ( param. pat ( ) ) ;
469
- let type_ref = param. ty ( ) . map ( |it| TypeRef :: from_ast ( & self . ctx ( ) , it) ) ;
470
+ let type_ref =
471
+ param. ty ( ) . map ( |it| Interned :: new ( TypeRef :: from_ast ( & self . ctx ( ) , it) ) ) ;
470
472
args. push ( pat) ;
471
473
arg_types. push ( type_ref) ;
472
474
}
473
475
}
474
476
let ret_type = e
475
477
. ret_type ( )
476
478
. and_then ( |r| r. ty ( ) )
477
- . map ( |it| Box :: new ( TypeRef :: from_ast ( & self . ctx ( ) , it) ) ) ;
479
+ . map ( |it| Interned :: new ( TypeRef :: from_ast ( & self . ctx ( ) , it) ) ) ;
478
480
let body = self . collect_expr_opt ( e. body ( ) ) ;
479
481
self . alloc_expr ( Expr :: Lambda { args, arg_types, ret_type, body } , syntax_ptr)
480
482
}
@@ -629,7 +631,8 @@ impl ExprCollector<'_> {
629
631
return ;
630
632
}
631
633
let pat = self . collect_pat_opt ( stmt. pat ( ) ) ;
632
- let type_ref = stmt. ty ( ) . map ( |it| TypeRef :: from_ast ( & self . ctx ( ) , it) ) ;
634
+ let type_ref =
635
+ stmt. ty ( ) . map ( |it| Interned :: new ( TypeRef :: from_ast ( & self . ctx ( ) , it) ) ) ;
633
636
let initializer = stmt. initializer ( ) . map ( |e| self . collect_expr ( e) ) ;
634
637
self . statements_in_scope . push ( Statement :: Let { pat, type_ref, initializer } ) ;
635
638
}
0 commit comments