Rollup merge of #108379 - compiler-errors:hir-error-guaranteed, r=cjgillot
Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants First step in making the `Err` variants of `ExprKind` and `TyKind` require an `ErrorGuaranteed` during parsing. Making the corresponding AST versions require `ErrorGuaranteed` is a bit harder, whereas it was pretty easy to do this for HIR, so let's do that first. The only weird thing about this PR is that `ErrorGuaranteed` is moved to `rustc_span`. This is *certainly* not the right place to put it, but `rustc_hir` cannot depend on `rustc_error` because the latter already depends on the former. Should I just pull out some of the error machinery from `rustc_error` into an even more minimal crate that `rustc_hir` can depend on? Advice would be appreciated.
This commit is contained in:
commit
19b8685b06
27 changed files with 111 additions and 88 deletions
|
@ -42,7 +42,7 @@ pub use rustc_error_messages::{
|
|||
pub use rustc_lint_defs::{pluralize, Applicability};
|
||||
use rustc_macros::fluent_messages;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::HashStableContext;
|
||||
pub use rustc_span::ErrorGuaranteed;
|
||||
use rustc_span::{Loc, Span};
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
@ -1846,17 +1846,3 @@ pub enum TerminalUrl {
|
|||
Yes,
|
||||
Auto,
|
||||
}
|
||||
|
||||
/// Useful type to use with `Result<>` indicate that an error has already
|
||||
/// been reported to the user, so no need to continue checking.
|
||||
#[derive(Clone, Copy, Debug, Encodable, Decodable, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(HashStable_Generic)]
|
||||
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.
|
||||
pub fn unchecked_claim_error_was_emitted() -> Self {
|
||||
ErrorGuaranteed(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue