@@ -67,6 +67,14 @@ fn opt_deref_kind(t: ty::t) -> option<deref_kind> {
67
67
some ( deref_comp ( comp_res) )
68
68
}
69
69
70
+ ty:: ty_evec ( mt, ty:: vstore_fixed ( _) ) {
71
+ some ( deref_comp ( comp_index ( t, mt. mutbl ) ) )
72
+ }
73
+
74
+ ty:: ty_estr ( ty:: vstore_fixed ( _) ) {
75
+ some ( deref_comp ( comp_index ( t, m_imm) ) )
76
+ }
77
+
70
78
_ {
71
79
none
72
80
}
@@ -344,26 +352,31 @@ impl public_methods for borrowck_ctxt {
344
352
}
345
353
} ;
346
354
347
- let ptr = alt deref_kind ( self . tcx , base_cmt. ty ) {
348
- deref_ptr ( ptr) { ptr }
355
+ ret alt deref_kind( self . tcx, base_cmt. ty) {
356
+ deref_ptr( ptr) {
357
+ // make deref of vectors explicit, as explained in the comment at
358
+ // the head of this section
359
+ let deref_lp = base_cmt. lp. map { |lp| @lp_deref( lp, ptr) } ;
360
+ let deref_cmt = @{ id: expr. id, span: expr. span,
361
+ cat: cat_deref( base_cmt, 0 u, ptr) , lp: deref_lp,
362
+ mutbl: m_imm, ty: mt. ty} ;
363
+ comp( expr, deref_cmt, base_cmt. ty, mt)
364
+ }
365
+
349
366
deref_comp( _) {
350
- self . tcx . sess . span_bug (
351
- expr. span ,
352
- "Deref of indexable type yielded comp kind" ) ;
367
+ // fixed-length vectors have no deref
368
+ comp( expr, base_cmt, base_cmt. ty, mt)
353
369
}
354
370
} ;
355
371
356
- // make deref of vectors explicit, as explained in the comment at
357
- // the head of this section
358
- let deref_lp = base_cmt. lp . map { |lp| @lp_deref ( lp, ptr) } ;
359
- let deref_cmt = @{ id: expr. id , span: expr. span ,
360
- cat: cat_deref ( base_cmt, 0 u, ptr) , lp: deref_lp,
361
- mutbl: m_imm, ty: mt. ty } ;
362
- let comp = comp_index ( base_cmt. ty , mt. mutbl ) ;
363
- let index_lp = deref_lp. map { |lp| @lp_comp ( lp, comp) } ;
364
- @{ id: expr. id , span: expr. span ,
365
- cat: cat_comp ( deref_cmt, comp) , lp: index_lp,
366
- mutbl: mt. mutbl , ty: mt. ty }
372
+ fn comp( expr: @ast:: expr, of_cmt: cmt,
373
+ vect: ty:: t, mt: ty:: mt) -> cmt {
374
+ let comp = comp_index( vect, mt. mutbl) ;
375
+ let index_lp = of_cmt. lp. map { |lp| @lp_comp( lp, comp) } ;
376
+ @{ id: expr. id, span: expr. span,
377
+ cat: cat_comp( of_cmt, comp) , lp: index_lp,
378
+ mutbl: mt. mutbl, ty: mt. ty}
379
+ }
367
380
}
368
381
369
382
fn cat_tuple_elt < N : ast_node > ( elt: N , cmt: cmt) -> cmt {
0 commit comments