Skip to content

non-pattern macro in pattern position: include_bytes #104414

Closed
@trinity-1686a

Description

@trinity-1686a

Code

I tried this code:

fn main() {
    match b"a\n" {
        include_bytes!("file.inc") => (),
        _ => panic!("no match"),
    }
}

I expected to see this happen: code compiles and execute

Instead, this happened: compilation fails with

error: non-pattern macro in pattern position: include_bytes
 --> src/main.rs:3:9
  |
4 |         include_bytes!("file.inc") => (),
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `regression` due to previous error

Version it worked on

It most recently worked on: rustc 1.65.0 (897e37553 2022-11-02) and rustc 1.67.0-nightly (1286ee23e 2022-11-05)

Version with regression

rustc --version --verbose:

rustc 1.67.0-nightly (e631891f7 2022-11-13)
binary: rustc
commit-hash: e631891f7ad40eac3ef58ec3c2b57ecd81e40615
commit-date: 2022-11-13
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Notes

used by x509-signature. I suspect #103812 (but did not confirm) might be the cause of the breakage as it is a recent change on that area.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.P-highHigh priorityregression-untriagedUntriaged performance or correctness regression.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions