@@ -15,13 +15,14 @@ use middle::ty::{Ty, TypeFoldable};
1515use rustc:: middle:: const_eval:: ConstVal ;
1616use rustc:: mir:: repr as mir;
1717use trans:: common:: { self , Block , C_bool , C_bytes , C_floating_f64 , C_integral , C_str_slice } ;
18- use trans:: consts:: { self , TrueConst } ;
19- use trans:: { type_of , expr} ;
20-
18+ use trans:: consts;
19+ use trans:: expr;
20+ use trans :: type_of ;
2121
2222use super :: operand:: { OperandRef , OperandValue } ;
2323use super :: MirContext ;
2424
25+
2526impl < ' bcx , ' tcx > MirContext < ' bcx , ' tcx > {
2627 pub fn trans_constval ( & mut self ,
2728 bcx : Block < ' bcx , ' tcx > ,
@@ -66,13 +67,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
6667 ConstVal :: Uint ( v) => C_integral ( llty, v, false ) ,
6768 ConstVal :: Str ( ref v) => C_str_slice ( ccx, v. clone ( ) ) ,
6869 ConstVal :: ByteStr ( ref v) => consts:: addr_of ( ccx, C_bytes ( ccx, v) , 1 , "byte_str" ) ,
69- ConstVal :: Struct ( id) | ConstVal :: Tuple ( id) => {
70- let expr = bcx. tcx ( ) . map . expect_expr ( id) ;
71- match consts:: const_expr ( ccx, expr, param_substs, None , TrueConst :: Yes ) {
72- Ok ( ( val, _) ) => val,
73- Err ( e) => panic ! ( "const eval failure: {}" , e. description( ) ) ,
74- }
75- } ,
70+ ConstVal :: Struct ( id) | ConstVal :: Tuple ( id) |
7671 ConstVal :: Array ( id, _) | ConstVal :: Repeat ( id, _) => {
7772 let expr = bcx. tcx ( ) . map . expect_expr ( id) ;
7873 expr:: trans ( bcx, expr) . datum . val
0 commit comments