1
Fork 0

Emit a hard error when a panic occurs during const-eval

Previous, a panic during const evaluation would go through the
`const_err` lint. This PR ensures that such a panic always causes
compilation to fail.
This commit is contained in:
Aaron Hill 2021-05-25 20:54:59 -05:00
parent 2023cc3aa1
commit 2779fc1c47
No known key found for this signature in database
GPG key ID: B4087E510E98B164
15 changed files with 118 additions and 182 deletions

View file

@ -435,8 +435,12 @@ impl<T: Any> AsAny for T {
}
/// A trait for machine-specific errors (or other "machine stop" conditions).
pub trait MachineStopType: AsAny + fmt::Display + Send {}
impl MachineStopType for String {}
pub trait MachineStopType: AsAny + fmt::Display + Send {
/// If `true`, emit a hard error instead of going through the `CONST_ERR` lint
fn is_hard_err(&self) -> bool {
false
}
}
impl dyn MachineStopType {
#[inline(always)]