rust-lang / rust-lang/rust

`matches` is ambiguous

Open
#152,346 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-resolve E-needs-bisection needs-triage regression-from-stable-to-stable T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I feel like we've seen this before, but filing since it looks like it's occurring again in 1.94.

https://crater-reports.s3.amazonaws.com/beta-1.94-3/beta-2026-01-26/gh/3scale-rs.threescale-wasm-auth/log.txt

[INFO] [stdout] error[E0659]: `matches` is ambiguous
[INFO] [stdout]   --> /opt/rustwide/cargo-home/git/checkouts/threescalers-3c034920aa4ddc80/f813a7a/src/api_call.rs:23:9
[INFO] [stdout]    |
[INFO] [stdout] 23 |         matches!(self, Kind::Report)
[INFO] [stdout]    |         ^^^^^^^ ambiguous name
[INFO] [stdout]    |
[INFO] [stdout]    = note: ambiguous because of a conflict between a `macro_rules` name and a non-`macro_rules` name from another module
[INFO] [stdout] note: `matches` could refer to the macro defined here
[INFO] [stdout]   --> /opt/rustwide/cargo-home/git/checkouts/threescalers-3c034920aa4ddc80/f813a7a/src/util/compat/macros.rs:3:1
[INFO] [stdout]    |
[INFO] [stdout]  3 | / macro_rules! matches {
[INFO] [stdout]  4 | |     ($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => {
[INFO] [stdout]  5 | |         match $expression {
[INFO] [stdout]  6 | |             $( $pattern )|+ $( if $guard )? => true,
[INFO] [stdout] ...  |
[INFO] [stdout] 10 | | }
[INFO] [stdout]    | |_^
[INFO] [stdout] note: `matches` could also refer to the macro imported here
[INFO] [stdout]   --> /opt/rustwide/cargo-home/git/checkouts/threescalers-3c034920aa4ddc80/f813a7a/src/api_call.rs:1:5
[INFO] [stdout]    |
[INFO] [stdout]  1 | use std::prelude::v1::*;
[INFO] [stdout]    |     ^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]    = help: use `self::matches` to refer to this macro unambiguously

Panic:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked crater logs, especially the api_call.rs:23 diagnostic and the util/compat/macros.rs definition, then trace how the std::prelude::v1::* import creates the ambiguity. Done means the reported crates no longer hit the matches ambiguity or related panic under Rust 1.94.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.