@@ -141,7 +141,7 @@ fn const_deref(cx: &CrateContext, v: ValueRef, t: ty::t, explicit: bool)
141
141
let dv = match ty:: get ( t) . sty {
142
142
ty:: ty_ptr( mt) | ty:: ty_rptr( _, mt) => {
143
143
match ty:: get ( mt. ty ) . sty {
144
- ty:: ty_vec( _, None ) | ty:: ty_str( None ) => cx. sess ( ) . bug ( "unexpected slice" ) ,
144
+ ty:: ty_vec( _, None ) | ty:: ty_str => cx. sess ( ) . bug ( "unexpected slice" ) ,
145
145
_ => const_deref_ptr ( cx, v) ,
146
146
}
147
147
}
@@ -434,7 +434,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
434
434
let ( arr, len) = match ty:: get ( bt) . sty {
435
435
ty:: ty_vec( _, Some ( u) ) => ( bv, C_uint ( cx, u) ) ,
436
436
ty:: ty_rptr( _, mt) => match ty:: get ( mt. ty ) . sty {
437
- ty:: ty_vec( _, None ) | ty:: ty_str( None ) => {
437
+ ty:: ty_vec( _, None ) | ty:: ty_str => {
438
438
let e1 = const_get_elt ( cx, bv, [ 0 ] ) ;
439
439
( const_deref_ptr ( cx, e1) , const_get_elt ( cx, bv, [ 1 ] ) )
440
440
} ,
@@ -448,16 +448,12 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
448
448
let len = llvm:: LLVMConstIntGetZExtValue ( len) as u64 ;
449
449
let len = match ty:: get ( bt) . sty {
450
450
ty:: ty_uniq( ty) | ty:: ty_rptr( _, ty:: mt { ty, ..} ) => match ty:: get ( ty) . sty {
451
- ty:: ty_str( None ) => {
451
+ ty:: ty_str => {
452
452
assert ! ( len > 0 ) ;
453
453
len - 1
454
454
}
455
455
_ => len
456
456
} ,
457
- ty:: ty_str( Some ( _) ) => {
458
- assert ! ( len > 0 ) ;
459
- len - 1
460
- } ,
461
457
_ => len
462
458
} ;
463
459
if iv >= len {
0 commit comments