Rollup merge of #86340 - Smittyvb:ctfe-hard-error-message, r=RalfJung
Use better error message for hard errors in CTFE I noticed this while working on #86255: currently the same message is used for hard errors and soft errors in CTFE. This changes the error messages to make hard errors use a message that indicates the reality of the situation correctly, since usage of the constant is never allowed when there was a hard error evaluating it. This doesn't affect the behaviour of these error messages, only the content. This changes the error logic to check if the error should be hard or soft where it is generated, instead of where it is emitted, to allow this distinction in error messages.
This commit is contained in:
commit
c062f3dddd
16 changed files with 80 additions and 107 deletions
|
@ -518,4 +518,14 @@ impl InterpError<'_> {
|
|||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Should this error be reported as a hard error, preventing compilation, or a soft error,
|
||||
/// causing a deny-by-default lint?
|
||||
pub fn is_hard_err(&self) -> bool {
|
||||
use InterpError::*;
|
||||
match *self {
|
||||
MachineStop(ref err) => err.is_hard_err(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue