More tidy fixes to CTFE

This commit is contained in:
Bernardo Meurer 2018-08-23 09:21:40 -07:00
parent 46b885f62b
commit 67a8666ac8
No known key found for this signature in database
GPG Key ID: E421C74191EA186C
2 changed files with 5 additions and 9 deletions

View File

@ -472,7 +472,8 @@ fn to_str<'a, 'tcx, 'mir>(
if let Value::ScalarPair(ptr, len) = val {
let len = len.not_undef()?.to_bits(ecx.memory.pointer_size())?;
let bytes = ecx.memory.read_bytes(ptr.not_undef()?, Size::from_bytes(len as u64))?;
let str = ::std::str::from_utf8(bytes).map_err(|err| EvalErrorKind::ValidationFailure(err.to_string()))?;
let str = ::std::str::from_utf8(bytes)
.map_err(|err| EvalErrorKind::ValidationFailure(err.to_string()))?;
Ok(Symbol::intern(str))
} else {
bug!("panic arg is not a str")

View File

@ -252,16 +252,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
// Second argument must be a tuple matching the argument list of sig
let snd_ty = real_sig.inputs_and_output[1];
match snd_ty.sty {
<<<<<<< HEAD
ty::Tuple(tys) if sig.inputs().len() == tys.len() =>
if sig.inputs().iter().zip(tys).all(|(ty, real_ty)| check_ty_compat(ty, real_ty)) {
=======
ty::TyTuple(tys) if sig.inputs().len() == tys.len() =>
if sig.inputs()
.iter()
.zip(tys)
.all(|(ty, real_ty)| check_ty_compat(ty, real_ty)) {
>>>>>>> 7d30ba9... Fixup long code lines
.iter()
.zip(tys)
.all(|(ty, real_ty)| check_ty_compat(ty, real_ty)) {
return Ok(true)
},
_ => {}