Skip to content

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

Not planned
@cuviper

Description

@cuviper
Member
[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

Activity

added
C-bugCategory: This is a bug.
regression-untriagedUntriaged performance or correctness regression.
on Apr 23, 2025
added this to the 1.87.0 milestone on Apr 23, 2025
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
and removed
regression-untriagedUntriaged performance or correctness regression.
on Apr 23, 2025
fmease

fmease commented on Apr 23, 2025

@fmease
Member

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

fmease commented on Apr 23, 2025

@fmease
Member

Therefore it has to be #137517, cc @nnethercote

added
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
S-has-bisectionStatus: A bisection has been found for this issue
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Apr 23, 2025
mejrs

mejrs commented on Apr 23, 2025

@mejrs
Contributor

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

nnethercote commented on Apr 23, 2025

@nnethercote
Contributor

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.

removed
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Apr 24, 2025
jieyouxu

jieyouxu commented on Apr 24, 2025

@jieyouxu
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-decl-macros-1-2Area: Declarative macros 1.2A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.S-has-bisectionStatus: A bisection has been found for this issueregression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Development

    No branches or pull requests

      Participants

      @cuviper@nnethercote@apiraino@fmease@jieyouxu

      Issue actions

        regression: error: expected one of `!`, `.`, `;`, `?`, `{`, `}`, or an operator, found `::` · Issue #140223 · rust-lang/rust