More tidy fixes to CTFE
This commit is contained in:
parent
46b885f62b
commit
67a8666ac8
@ -472,7 +472,8 @@ fn to_str<'a, 'tcx, 'mir>(
|
|||||||
if let Value::ScalarPair(ptr, len) = val {
|
if let Value::ScalarPair(ptr, len) = val {
|
||||||
let len = len.not_undef()?.to_bits(ecx.memory.pointer_size())?;
|
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 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))
|
Ok(Symbol::intern(str))
|
||||||
} else {
|
} else {
|
||||||
bug!("panic arg is not a str")
|
bug!("panic arg is not a str")
|
||||||
|
@ -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
|
// Second argument must be a tuple matching the argument list of sig
|
||||||
let snd_ty = real_sig.inputs_and_output[1];
|
let snd_ty = real_sig.inputs_and_output[1];
|
||||||
match snd_ty.sty {
|
match snd_ty.sty {
|
||||||
<<<<<<< HEAD
|
|
||||||
ty::Tuple(tys) if sig.inputs().len() == tys.len() =>
|
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()
|
if sig.inputs()
|
||||||
.iter()
|
.iter()
|
||||||
.zip(tys)
|
.zip(tys)
|
||||||
.all(|(ty, real_ty)| check_ty_compat(ty, real_ty)) {
|
.all(|(ty, real_ty)| check_ty_compat(ty, real_ty)) {
|
||||||
>>>>>>> 7d30ba9... Fixup long code lines
|
|
||||||
return Ok(true)
|
return Ok(true)
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
|
Loading…
Reference in New Issue
Block a user