@@ -17,7 +17,6 @@ use hair::cx::block;
17
17
use hair:: cx:: pattern:: PatNode ;
18
18
use hair:: cx:: to_ref:: ToRef ;
19
19
use rustc:: front:: map;
20
- use rustc:: middle:: const_eval;
21
20
use rustc:: middle:: def;
22
21
use rustc:: middle:: region:: CodeExtent ;
23
22
use rustc:: middle:: pat_util;
@@ -81,10 +80,9 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
81
80
}
82
81
}
83
82
84
- hir:: ExprLit ( ..) => {
85
- let value = const_eval:: eval_const_expr ( cx. tcx , self ) ;
86
- ExprKind :: Literal { literal : Literal :: Value { value : value } }
87
- }
83
+ hir:: ExprLit ( ..) => ExprKind :: Literal {
84
+ literal : cx. const_eval_literal ( self )
85
+ } ,
88
86
89
87
hir:: ExprBinary ( op, ref lhs, ref rhs) => {
90
88
if cx. tcx . is_method_call ( self . id ) {
@@ -273,8 +271,17 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
273
271
274
272
// Now comes the rote stuff:
275
273
276
- hir:: ExprRepeat ( ref v, ref c) =>
277
- ExprKind :: Repeat { value : v. to_ref ( ) , count : c. to_ref ( ) } ,
274
+ hir:: ExprRepeat ( ref v, ref c) => ExprKind :: Repeat {
275
+ value : v. to_ref ( ) ,
276
+ count : Expr {
277
+ ty : cx. tcx . expr_ty ( c) ,
278
+ temp_lifetime : None ,
279
+ span : c. span ,
280
+ kind : ExprKind :: Literal {
281
+ literal : cx. const_eval_literal ( c)
282
+ }
283
+ } . to_ref ( )
284
+ } ,
278
285
hir:: ExprRet ( ref v) =>
279
286
ExprKind :: Return { value : v. to_ref ( ) } ,
280
287
hir:: ExprBreak ( label) =>
0 commit comments