Auto merge of #85704 - Aaron1011:const-panic-hard-err, r=RalfJung
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:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user