Change:
The previous version of the crate fails to compile with the error (see the build log). No error nor warning was present in the 1.25 release. Since is actually , the error is wrong and should be fixed. regressed from stable to beta () cc
cc -- initial git log dive notes that this could be related to miri transition? Not sure.
Jup it's a regression. :
Not yet fixed on beta, this needs a backport.
Backported to beta! Thanks!

Discussion:
Ok(true) } <del> fn constructor_covered_by_range(ctor: &Constructor, from: &ConstVal, to: &ConstVal, end: RangeEnd, ty: Ty) -> Result<bool, ErrorReported> { </del> <ins> fn constructor_covered_by_range<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor: &Constructor, from: &ConstVal, to: &ConstVal, end: RangeEnd, ty: Ty<'tcx>, ) -> Result<bool, ErrorReported> { </ins> trace!("constructor_covered_by_range {:#?}, {:#?}, {:#?}, {}", ctor, from, to, ty); <del> let cmp_from = |c_from| compare_const_vals(c_from, from, ty) </del> <ins> let cmp_from = |c_from| compare_const_vals(tcx, c_from, from, ty) </ins> .map(|res| res != Ordering::Less); <del> let cmp_to = |c_to| compare_const_vals(c_to, to, ty); </del> <ins> let cmp_to = |c_to| compare_const_vals(tcx, c_to, to, ty); </ins> macro_rules! some_or_ok { ($e:expr) => { match $e {

}, _ => { match constructor_covered_by_range( <ins> cx.tcx, </ins> constructor, &value.val, &value.val, RangeEnd::Included, value.ty, ) {

PatternKind::Range { lo, hi, ref end } => { match constructor_covered_by_range( <ins> cx.tcx, </ins> constructor, &lo.val, &hi.val, end.clone(), lo.ty, ) { Ok(true) => Some(vec![]),

pub use self::check_match::check_crate; pub(crate) use self::check_match::check_match; <del> use interpret::{const_val_field, const_discr}; </del> <ins> use interpret::{const_val_field, const_discr, self}; </ins> use rustc::middle::const_val::ConstVal; use rustc::mir::{Field, BorrowKind, Mutability};

(PatternKind::Constant { value: lo }, PatternKind::Constant { value: hi }) => { use std::cmp::Ordering; <del> match (end, compare_const_vals(&lo.val, &hi.val, ty).unwrap()) { </del> <ins> match (end, compare_const_vals(self.tcx, &lo.val, &hi.val, ty).unwrap()) { </ins> (RangeEnd::Excluded, Ordering::Less) => PatternKind::Range { lo, hi, end }, (RangeEnd::Excluded, _) => {

} } <del> pub fn compare_const_vals(a: &ConstVal, b: &ConstVal, ty: Ty) -> Option<Ordering> { </del> <ins> pub fn compare_const_vals<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, a: &ConstVal, b: &ConstVal, ty: Ty<'tcx>, ) -> Option<Ordering> { </ins> use rustc_const_math::ConstFloat; trace!("compare_const_vals: {:?}, {:?}", a, b); use rustc::mir::interpret::{Value, PrimVal};

// FIXME(oli-obk): report cmp errors? l.try_cmp(r).ok() }, <del> ty::TyInt(_) => Some((a as i128).cmp(&(b as i128))), </del> <ins> ty::TyInt(_) => { let a = interpret::sign_extend(tcx, a, ty).expect("layout error for TyInt"); let b = interpret::sign_extend(tcx, b, ty).expect("layout error for TyInt"); Some((a as i128).cmp(&(b as i128))) }, </ins> _ => Some(a.cmp(&b)), } },

} pub fn sign_extend(&self, value: u128, ty: Ty<'tcx>) -> EvalResult<'tcx, u128> { <del> let layout = self.layout_of(ty)?; let size = layout.size.bits(); assert!(layout.abi.is_signed()); // sign extend let amt = 128 - size; // shift the unsigned value to the left // and back to the right as signed (essentially fills with FF on the left) Ok((((value << amt) as i128) >> amt) as u128) </del> <ins> super::sign_extend(self.tcx.tcx, value, ty) </ins> } pub fn truncate(&self, value: u128, ty: Ty<'tcx>) -> EvalResult<'tcx, u128> { <del> let size = self.layout_of(ty)?.size.bits(); let amt = 128 - size; // truncate (shift left to drop out leftover values, shift right to fill with zeroes) Ok((value << amt) >> amt) </del> <ins> super::truncate(self.tcx.tcx, value, ty) </ins> } }

pub use self::machine::Machine; pub use self::memory::{write_target_uint, write_target_int, read_target_uint}; <ins> use rustc::mir::interpret::{EvalResult, EvalErrorKind}; use rustc::ty::{Ty, TyCtxt, ParamEnv}; pub fn sign_extend<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, value: u128, ty: Ty<'tcx>) -> EvalResult<'tcx, u128> { let param_env = ParamEnv::empty(); let layout = tcx.layout_of(param_env.and(ty)).map_err(|layout| EvalErrorKind::Layout(layout))?; let size = layout.size.bits(); assert!(layout.abi.is_signed()); // sign extend let amt = 128 - size; // shift the unsigned value to the left // and back to the right as signed (essentially fills with FF on the left) Ok((((value << amt) as i128) >> amt) as u128) } pub fn truncate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, value: u128, ty: Ty<'tcx>) -> EvalResult<'tcx, u128> { let param_env = ParamEnv::empty(); let layout = tcx.layout_of(param_env.and(ty)).map_err(|layout| EvalErrorKind::Layout(layout))?; let size = layout.size.bits(); let amt = 128 - size; // truncate (shift left to drop out leftover values, shift right to fill with zeroes) Ok((value << amt) >> amt) } </ins>

<ins> // Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // compile-pass fn main() { const MIN: i8 = -5; match 5i8 { MIN...-1 => {}, _ => {}, } } </ins>