expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression
This commit is contained in:
parent
97717a5618
commit
cd22425990
3 changed files with 39 additions and 1 deletions
|
@ -735,7 +735,14 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
});
|
||||
}
|
||||
};
|
||||
fragment_kind.expect_from_annotatables(items)
|
||||
if fragment_kind == AstFragmentKind::Expr && items.is_empty() {
|
||||
let msg =
|
||||
"removing an expression is not supported in this position";
|
||||
self.cx.span_err(span, msg);
|
||||
fragment_kind.dummy(span)
|
||||
} else {
|
||||
fragment_kind.expect_from_annotatables(items)
|
||||
}
|
||||
}
|
||||
Err(mut err) => {
|
||||
err.emit();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue