8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ use hir;
11
12
use hir:: def_id:: DefId ;
12
13
use ty:: { self , Ty , TyCtxt } ;
13
14
use syntax:: ast;
@@ -24,8 +25,9 @@ pub enum SimplifiedType {
24
25
FloatSimplifiedType ( ast:: FloatTy ) ,
25
26
AdtSimplifiedType ( DefId ) ,
26
27
StrSimplifiedType ,
27
- ArraySimplifiedType ,
28
- PtrSimplifiedType ,
28
+ ArraySimplifiedType ( usize ) ,
29
+ SliceSimplifiedType ,
30
+ PtrSimplifiedType ( hir:: Mutability ) ,
29
31
NeverSimplifiedType ,
30
32
TupleSimplifiedType ( usize ) ,
31
33
TraitSimplifiedType ( DefId ) ,
@@ -57,8 +59,9 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
57
59
ty:: TyFloat ( float_type) => Some ( FloatSimplifiedType ( float_type) ) ,
58
60
ty:: TyAdt ( def, _) => Some ( AdtSimplifiedType ( def. did ) ) ,
59
61
ty:: TyStr => Some ( StrSimplifiedType ) ,
60
- ty:: TyArray ( ..) | ty:: TySlice ( _) => Some ( ArraySimplifiedType ) ,
61
- ty:: TyRawPtr ( _) => Some ( PtrSimplifiedType ) ,
62
+ ty:: TyArray ( _, n) => Some ( ArraySimplifiedType ( n) ) ,
63
+ ty:: TySlice ( _) => Some ( SliceSimplifiedType ) ,
64
+ ty:: TyRawPtr ( mt) => Some ( PtrSimplifiedType ( mt. mutbl ) ) ,
62
65
ty:: TyTrait ( ref trait_info) => {
63
66
Some ( TraitSimplifiedType ( trait_info. principal . def_id ( ) ) )
64
67
}
0 commit comments