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:
Nicholas Nethercote 2024-02-14 14:50:49 +11:00
parent e504c64a41
commit 6674be9657

View File

@ -859,7 +859,7 @@ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String>
}) })
} }
ast::TyKind::CVarArgs => Some("...".to_owned()), ast::TyKind::CVarArgs => Some("...".to_owned()),
ast::TyKind::Err => Some(context.snippet(self.span).to_owned()), ast::TyKind::Dummy | ast::TyKind::Err(_) => Some(context.snippet(self.span).to_owned()),
ast::TyKind::Typeof(ref anon_const) => rewrite_call( ast::TyKind::Typeof(ref anon_const) => rewrite_call(
context, context,
"typeof", "typeof",