Add an ErrorGuaranteed
to ast::TyKind::Err
.
This makes it more like `hir::TyKind::Err`, and avoids a `span_delayed_bug` call in `LoweringContext::lower_ty_direct`. It also requires adding `ast::TyKind::Dummy`, now that `ast::TyKind::Err` can't be used for that purpose in the absence of an error emission. There are a couple of cases that aren't as neat as I would have liked, marked with `FIXME` comments.
This commit is contained in:
parent
502ce8287b
commit
5233bc91da
14 changed files with 75 additions and 36 deletions
|
@ -567,10 +567,13 @@ impl DummyResult {
|
|||
}
|
||||
|
||||
/// A plain dummy type.
|
||||
pub fn raw_ty(sp: Span, is_error: bool) -> P<ast::Ty> {
|
||||
pub fn raw_ty(sp: Span) -> P<ast::Ty> {
|
||||
// FIXME(nnethercote): you might expect `ast::TyKind::Dummy` to be used here, but some
|
||||
// values produced here end up being lowered to HIR, which `ast::TyKind::Dummy` does not
|
||||
// support, so we use an empty tuple instead.
|
||||
P(ast::Ty {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
kind: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(ThinVec::new()) },
|
||||
kind: ast::TyKind::Tup(ThinVec::new()),
|
||||
span: sp,
|
||||
tokens: None,
|
||||
})
|
||||
|
@ -611,7 +614,7 @@ impl MacResult for DummyResult {
|
|||
}
|
||||
|
||||
fn make_ty(self: Box<DummyResult>) -> Option<P<ast::Ty>> {
|
||||
Some(DummyResult::raw_ty(self.span, self.is_error))
|
||||
Some(DummyResult::raw_ty(self.span))
|
||||
}
|
||||
|
||||
fn make_arms(self: Box<DummyResult>) -> Option<SmallVec<[ast::Arm; 1]>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue