fix: emit error when fragment is MethodReceiverExpr and items is empty

This commit is contained in:
bohan 2023-05-19 21:21:05 +08:00
parent 2d17294d18
commit 990b2899ad
3 changed files with 35 additions and 1 deletions

View file

@ -722,7 +722,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
});
}
};
if fragment_kind == AstFragmentKind::Expr && items.is_empty() {
if matches!(
fragment_kind,
AstFragmentKind::Expr | AstFragmentKind::MethodReceiverExpr
) && items.is_empty()
{
self.cx.emit_err(RemoveExprNotSupported { span });
fragment_kind.dummy(span)
} else {