@@ -15,13 +15,14 @@ use middle::ty::{Ty, TypeFoldable};
15
15
use rustc:: middle:: const_eval:: ConstVal ;
16
16
use rustc:: mir:: repr as mir;
17
17
use 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 ;
21
21
22
22
use super :: operand:: { OperandRef , OperandValue } ;
23
23
use super :: MirContext ;
24
24
25
+
25
26
impl < ' bcx , ' tcx > MirContext < ' bcx , ' tcx > {
26
27
pub fn trans_constval ( & mut self ,
27
28
bcx : Block < ' bcx , ' tcx > ,
@@ -66,13 +67,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
66
67
ConstVal :: Uint ( v) => C_integral ( llty, v, false ) ,
67
68
ConstVal :: Str ( ref v) => C_str_slice ( ccx, v. clone ( ) ) ,
68
69
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) |
76
71
ConstVal :: Array ( id, _) | ConstVal :: Repeat ( id, _) => {
77
72
let expr = bcx. tcx ( ) . map . expect_expr ( id) ;
78
73
expr:: trans ( bcx, expr) . datum . val
0 commit comments