@@ -216,9 +216,6 @@ pub enum Ty {
216
216
/// A tuple type. For example, `(i32, bool)`.
217
217
Tuple ( Arc < [ Ty ] > ) ,
218
218
219
- /// A array type. For example, `[i32]`.
220
- Array ( Arc < [ Ty ] > ) ,
221
-
222
219
// The projection of an associated type. For example,
223
220
// `<T as Trait<..>>::N`.pub
224
221
// Projection(ProjectionTy),
@@ -411,16 +408,6 @@ impl fmt::Display for Ty {
411
408
. to_fmt ( f)
412
409
}
413
410
}
414
- Ty :: Array ( ts) => {
415
- if ts. len ( ) == 1 {
416
- write ! ( f, "[{},]" , ts[ 0 ] )
417
- } else {
418
- join ( ts. iter ( ) )
419
- . surround_with ( "[" , "]" )
420
- . separator ( ", " )
421
- . to_fmt ( f)
422
- }
423
- }
424
411
Ty :: FnPtr ( sig) => {
425
412
join ( sig. input . iter ( ) )
426
413
. surround_with ( "fn(" , ")" )
@@ -1055,19 +1042,23 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1055
1042
} ,
1056
1043
Expr :: Tuple { exprs } => {
1057
1044
let mut ty_vec = Vec :: with_capacity ( exprs. len ( ) ) ;
1058
- for arg in exprs. iter ( ) {
1059
- ty_vec. push ( self . infer_expr ( * arg , & Expectation :: none ( ) ) ?) ;
1045
+ for expr in exprs. iter ( ) {
1046
+ ty_vec. push ( self . infer_expr ( * expr , & Expectation :: none ( ) ) ?) ;
1060
1047
}
1061
1048
1062
1049
Ty :: Tuple ( Arc :: from ( ty_vec) )
1063
1050
}
1064
1051
Expr :: Array { exprs } => {
1065
- let mut ty_vec = Vec :: with_capacity ( exprs. len ( ) ) ;
1066
- for arg in exprs. iter ( ) {
1067
- ty_vec. push ( self . infer_expr ( * arg, & Expectation :: none ( ) ) ?) ;
1052
+ let mut ty = Ty :: Unknown ;
1053
+ for expr in exprs. iter ( ) {
1054
+ let infered = self . infer_expr ( * expr, & Expectation :: none ( ) ) ?;
1055
+ match infered {
1056
+ Ty :: Unknown => ( ) ,
1057
+ _ => ty = infered,
1058
+ }
1068
1059
}
1069
1060
1070
- Ty :: Array ( Arc :: from ( ty_vec ) )
1061
+ Ty :: Slice ( Arc :: new ( ty ) )
1071
1062
}
1072
1063
} ;
1073
1064
// use a new type variable if we got Ty::Unknown here
0 commit comments