error message improvements

This commit is contained in:
Oliver Schneider 2016-06-21 09:43:27 +02:00
parent 2dbd30fa51
commit 422e5edd28
No known key found for this signature in database
GPG Key ID: 56D6EEA0FC67AC46

View File

@ -85,11 +85,11 @@ impl<'tcx> fmt::Display for EvalError<'tcx> {
EvalError::FunctionPointerTyMismatch(expected, got) =>
write!(f, "tried to call a function of type {:?} through a function pointer of type {:?}", expected, got),
EvalError::ArrayIndexOutOfBounds(span, len, index) =>
write!(f, "array index {} out of bounds {} at {:?}", index, len, span),
write!(f, "index out of bounds: the len is {} but the index is {} at {:?}", len, index, span),
EvalError::Math(span, ref err) =>
write!(f, "mathematical operation at {:?} failed with {:?}", span, err),
write!(f, "{:?} at {:?}", err, span),
EvalError::InvalidChar(c) =>
write!(f, "invalid utf8 character: {}", c),
write!(f, "tried to interpret an invalid 32-bit value as a char: {}", c),
_ => write!(f, "{}", self.description()),
}
}