Tighten up ErrorGuaranteed
handling.
- In `emit_producing_error_guaranteed`, only allow `Level::Error`. - In `emit_diagnostic`, only produce `ErrorGuaranteed` for `Level` and `DelayedBug`. (Not `Bug` or `Fatal`. They don't need it, because the relevant `emit` methods abort.) - Add/update various comments.
This commit is contained in:
parent
83adf883a2
commit
97c157fe1e
3 changed files with 22 additions and 13 deletions
|
@ -2477,9 +2477,8 @@ where
|
|||
pub struct ErrorGuaranteed(());
|
||||
|
||||
impl ErrorGuaranteed {
|
||||
/// To be used only if you really know what you are doing... ideally, we would find a way to
|
||||
/// eliminate all calls to this method.
|
||||
#[deprecated = "`Session::span_delayed_bug` should be preferred over this function"]
|
||||
/// Don't use this outside of `DiagCtxtInner::emit_diagnostic`!
|
||||
#[deprecated = "should only be used in `DiagCtxtInner::emit_diagnostic`"]
|
||||
pub fn unchecked_claim_error_was_emitted() -> Self {
|
||||
ErrorGuaranteed(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue