Skip to content

regression: error: expected one of !, ., ;, ?, {, }, or an operator, found :: #140223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cuviper opened this issue Apr 23, 2025 · 5 comments
Closed
Labels
A-decl-macros-1-2 Area: Declarative macros 1.2 A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-bisection Status: a bisection has been found for this issue
Milestone

Comments

@cuviper
Copy link
Member

cuviper commented Apr 23, 2025

[INFO] [stdout] error: expected one of `!`, `.`, `;`, `?`, `{`, `}`, or an operator, found `::`
[INFO] [stdout]  --> test.rs:8:5
[INFO] [stdout]   |
[INFO] [stdout] 8 |     ::assert_cmp::assert_op!(123 < 456);
[INFO] [stdout]   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of 7 possible tokens
[INFO] [stdout]   |
[INFO] [stdout]   = note: this error originates in the macro `::assert_cmp::assert_op` (in Nightly builds, run with -Z macro-backtrace for more info)

(and many more of the same)

With the suggested macro-backtrace, that particular instance reports:

error: expected one of `!`, `.`, `;`, `?`, `{`, `}`, or an operator, found `::`
  --> [...]/assert-cmp/lib.rs:48:24
   |
37 | /         macro_rules! $name_simple {
38 | |             ($left:ident $op:tt $right:ident) => {
39 | |                 $module::$name_expr!($left, $op, $right)
40 | |             };
...  |
48 | |                 $module::$name_expr!($left, $op, $right)
   | |                        ^^ expected one of 7 possible tokens
49 | |             };
50 | |         }
   | |_________- in this expansion of `::assert_cmp::assert_op!`
   |
  ::: test.rs:8:5
   |
8  |       ::assert_cmp::assert_op!(123 < 456);
   |       ----------------------------------- in this macro invocation

Version it worked on

It most recently worked on: 1.86.0

Version with regression

rustc 1.87.0-beta.5 (386abeb93 2025-04-19) in crater #139827.

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

@cuviper cuviper added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Apr 23, 2025
@cuviper cuviper added this to the 1.87.0 milestone Apr 23, 2025
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-untriaged Untriaged performance or correctness regression. labels Apr 23, 2025
@fmease
Copy link
Member

fmease commented Apr 23, 2025

Same regression range as #140219

  • PASS: rustc 1.87.0-nightly (2874876 2025-02-28)
  • FAIL: rustc 1.87.0-nightly (8c39296 2025-03-01)

@fmease
Copy link
Member

fmease commented Apr 23, 2025

Therefore it has to be #137517, cc @nnethercote

@fmease fmease added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example S-has-bisection Status: a bisection has been found for this issue A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-decl-macros-1-2 Area: Declarative macros 1.2 and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 23, 2025
@mejrs
Copy link
Contributor

mejrs commented Apr 23, 2025

MCVE is similar to #140219

Other crate (let's call it some_crate):

macro_rules! make_macro {
    ( $module:path, $function:path) => {
        #[macro_export]
        macro_rules! some_macro {
            () => {
                $module::$function();
            };
        }
    };
}

make_macro!(my_module, my_function);

pub mod my_module{
    pub fn my_function() {}
}

Main crate:

use some_crate::{my_module, some_macro};

fn main() {
    some_macro!();
}

If inlined into a single crate, then it fails on any rust version with the same expected one of 7 possible tokens error.

@nnethercote
Copy link
Contributor

nnethercote commented Apr 23, 2025

Yes, the crater run analysis for #124141 discusses assert-cmp. In other words, this is expected breakage and any fix should be done on the crate side.

@apiraino apiraino removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 24, 2025
@apiraino apiraino closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2025
@jieyouxu
Copy link
Member

Tagged #137517 w/ compat relnotes (#140241), since I can't seem to find any relnotes entries for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-decl-macros-1-2 Area: Declarative macros 1.2 A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-bisection Status: a bisection has been found for this issue
Projects
None yet
Development

No branches or pull requests

7 participants