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:
parent
2023cc3aa1
commit
2779fc1c47
15 changed files with 118 additions and 182 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue