Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ impl MacResult for MacEager {
return Some(p);
}
if let Some(e) = self.expr {
if let ast::ExprKind::Lit(_) = e.kind {
if matches!(e.kind, ast::ExprKind::Lit(_) | ast::ExprKind::IncludedBytes(_)) {
return Some(P(ast::Pat {
id: ast::DUMMY_NODE_ID,
span: e.span,
Expand Down
8 changes: 7 additions & 1 deletion src/test/ui/proc-macro/expand-expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,10 @@ expand_expr_fail!(echo_pm!(arbitrary_expression() + "etc"));

const _: u32 = recursive_expand!(); //~ ERROR: recursion limit reached while expanding `recursive_expand!`

fn main() {}
fn main() {
// https://github.com/rust-lang/rust/issues/104414
match b"Included file contents\n" {
include_bytes!("auxiliary/included-file.txt") => (),
_ => panic!("include_bytes! in pattern"),
}
}