From: Luqman Aden Date: Sat, 27 Jul 2013 08:38:55 +0000 (-0400) Subject: librustc: Stop trying to make invalid slice with vec in static. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=4a85b08e08456920f07cf8bb583064f84c23575d;p=rust.git librustc: Stop trying to make invalid slice with vec in static. --- diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index db9e3db2c0f..853b3a3c28f 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -211,11 +211,16 @@ pub fn const_expr(cx: @mut CrateContext, e: @ast::expr) -> ValueRef { } ty::AutoBorrowVec(ty::re_static, m) => { assert!(m != ast::m_mutbl); - let size = machine::llsize_of(cx, - val_ty(llconst)); assert_eq!(abi::slice_elt_base, 0); assert_eq!(abi::slice_elt_len, 1); - llconst = C_struct([llptr, size]); + + match ty::get(ty).sty { + ty::ty_evec(_, ty::vstore_fixed(*)) => { + let size = machine::llsize_of(cx, val_ty(llconst)); + llconst = C_struct([llptr, size]); + } + _ => {} + } } _ => { cx.sess.span_bug(e.span,