Skip to content

Commit 699315e

Browse files
committed
Auto merge of #26519 - oli-obk:camel_case_const_val, r=eddyb
2 parents 4ffeb2e + 88b03f3 commit 699315e

File tree

6 files changed

+142
-145
lines changed

6 files changed

+142
-145
lines changed

src/librustc/middle/check_match.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub use self::Constructor::*;
1212
use self::Usefulness::*;
1313
use self::WitnessPreference::*;
1414

15-
use middle::const_eval::{compare_const_vals, const_bool, const_float, const_val};
15+
use middle::const_eval::{compare_const_vals, ConstVal};
1616
use middle::const_eval::{eval_const_expr, eval_const_expr_partial};
1717
use middle::const_eval::{const_expr_to_pat, lookup_const_by_id};
1818
use middle::def::*;
@@ -111,9 +111,9 @@ pub enum Constructor {
111111
/// Enum variants.
112112
Variant(ast::DefId),
113113
/// Literal values.
114-
ConstantValue(const_val),
114+
ConstantValue(ConstVal),
115115
/// Ranges of literal values (2..5).
116-
ConstantRange(const_val, const_val),
116+
ConstantRange(ConstVal, ConstVal),
117117
/// Array patterns of length n.
118118
Slice(usize),
119119
/// Array patterns with a subslice.
@@ -262,7 +262,7 @@ fn check_for_static_nan(cx: &MatchCheckCtxt, pat: &Pat) {
262262
ast_util::walk_pat(pat, |p| {
263263
if let ast::PatLit(ref expr) = p.node {
264264
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() => {
266266
span_warn!(cx.tcx.sess, p.span, E0003,
267267
"unmatchable NaN in pattern, \
268268
use the is_nan method in a guard instead");
@@ -391,9 +391,9 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, matrix: &Matrix, source: ast:
391391
}
392392
}
393393

394-
fn const_val_to_expr(value: &const_val) -> P<ast::Expr> {
394+
fn const_val_to_expr(value: &ConstVal) -> P<ast::Expr> {
395395
let node = match value {
396-
&const_bool(b) => ast::LitBool(b),
396+
&ConstVal::Bool(b) => ast::LitBool(b),
397397
_ => unreachable!()
398398
};
399399
P(ast::Expr {
@@ -596,7 +596,7 @@ fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty,
596596
max_slice_length: usize) -> Vec<Constructor> {
597597
match left_ty.sty {
598598
ty::TyBool =>
599-
[true, false].iter().map(|b| ConstantValue(const_bool(*b))).collect(),
599+
[true, false].iter().map(|b| ConstantValue(ConstVal::Bool(*b))).collect(),
600600

601601
ty::TyRef(_, ty::mt { ty, .. }) => match ty.sty {
602602
ty::TySlice(_) =>
@@ -826,7 +826,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usi
826826
}
827827

828828
fn range_covered_by_constructor(ctor: &Constructor,
829-
from: &const_val, to: &const_val) -> Option<bool> {
829+
from: &ConstVal, to: &ConstVal) -> Option<bool> {
830830
let (c_from, c_to) = match *ctor {
831831
ConstantValue(ref value) => (value, value),
832832
ConstantRange(ref from, ref to) => (from, to),

0 commit comments

Comments
 (0)