@@ -12,7 +12,7 @@ pub use self::Constructor::*;
12
12
use self :: Usefulness :: * ;
13
13
use self :: WitnessPreference :: * ;
14
14
15
- use middle:: const_eval:: { compare_const_vals, const_bool , const_float , const_val } ;
15
+ use middle:: const_eval:: { compare_const_vals, ConstVal } ;
16
16
use middle:: const_eval:: { eval_const_expr, eval_const_expr_partial} ;
17
17
use middle:: const_eval:: { const_expr_to_pat, lookup_const_by_id} ;
18
18
use middle:: def:: * ;
@@ -111,9 +111,9 @@ pub enum Constructor {
111
111
/// Enum variants.
112
112
Variant ( ast:: DefId ) ,
113
113
/// Literal values.
114
- ConstantValue ( const_val ) ,
114
+ ConstantValue ( ConstVal ) ,
115
115
/// Ranges of literal values (2..5).
116
- ConstantRange ( const_val , const_val ) ,
116
+ ConstantRange ( ConstVal , ConstVal ) ,
117
117
/// Array patterns of length n.
118
118
Slice ( usize ) ,
119
119
/// Array patterns with a subslice.
@@ -262,7 +262,7 @@ fn check_for_static_nan(cx: &MatchCheckCtxt, pat: &Pat) {
262
262
ast_util:: walk_pat ( pat, |p| {
263
263
if let ast:: PatLit ( ref expr) = p. node {
264
264
match eval_const_expr_partial ( cx. tcx , & * * expr, None ) {
265
- Ok ( const_float ( f) ) if f. is_nan ( ) => {
265
+ Ok ( ConstVal :: Float ( f) ) if f. is_nan ( ) => {
266
266
span_warn ! ( cx. tcx. sess, p. span, E0003 ,
267
267
"unmatchable NaN in pattern, \
268
268
use the is_nan method in a guard instead") ;
@@ -391,9 +391,9 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, matrix: &Matrix, source: ast:
391
391
}
392
392
}
393
393
394
- fn const_val_to_expr ( value : & const_val ) -> P < ast:: Expr > {
394
+ fn const_val_to_expr ( value : & ConstVal ) -> P < ast:: Expr > {
395
395
let node = match value {
396
- & const_bool ( b) => ast:: LitBool ( b) ,
396
+ & ConstVal :: Bool ( b) => ast:: LitBool ( b) ,
397
397
_ => unreachable ! ( )
398
398
} ;
399
399
P ( ast:: Expr {
@@ -596,7 +596,7 @@ fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty,
596
596
max_slice_length : usize ) -> Vec < Constructor > {
597
597
match left_ty. sty {
598
598
ty:: TyBool =>
599
- [ true , false ] . iter ( ) . map ( |b| ConstantValue ( const_bool ( * b) ) ) . collect ( ) ,
599
+ [ true , false ] . iter ( ) . map ( |b| ConstantValue ( ConstVal :: Bool ( * b) ) ) . collect ( ) ,
600
600
601
601
ty:: TyRef ( _, ty:: mt { ty, .. } ) => match ty. sty {
602
602
ty:: TySlice ( _) =>
@@ -826,7 +826,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usi
826
826
}
827
827
828
828
fn range_covered_by_constructor ( ctor : & Constructor ,
829
- from : & const_val , to : & const_val ) -> Option < bool > {
829
+ from : & ConstVal , to : & ConstVal ) -> Option < bool > {
830
830
let ( c_from, c_to) = match * ctor {
831
831
ConstantValue ( ref value) => ( value, value) ,
832
832
ConstantRange ( ref from, ref to) => ( from, to) ,
0 commit comments