Skip to content

regression: error: expected identifier, found metavariable #140219

New issue

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

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

Already on GitHub? # to your account

Closed
cuviper opened this issue Apr 23, 2025 · 6 comments
Closed

regression: error: expected identifier, found metavariable #140219

cuviper opened this issue Apr 23, 2025 · 6 comments
Labels
A-parser Area: The lexing & parsing of Rust source code to an AST 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 S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@cuviper
Copy link
Member

cuviper commented Apr 23, 2025

Three crater results failed with similar error messages:

[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]    --> src/main.rs:341:9
[INFO] [stdout]     |
[INFO] [stdout] 341 |         assert_aclose!(trac, fd, 1e-8);
[INFO] [stdout]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |         |
[INFO] [stdout]     |         expected identifier, found metavariable
[INFO] [stdout]     |         in this macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `assert_aclose` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]    --> src/main.rs:350:9
[INFO] [stdout]     |
[INFO] [stdout] 350 |         assert_aclose!(fd, d_traction, 1e-8);
[INFO] [stdout]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |         |
[INFO] [stdout]     |         expected identifier, found metavariable
[INFO] [stdout]     |         in this macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `assert_aclose` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]    --> src/main.rs:358:9
[INFO] [stdout]     |
[INFO] [stdout] 358 |         assert_aclose!(trac, fd, 1e-8);
[INFO] [stdout]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |         |
[INFO] [stdout]     |         expected identifier, found metavariable
[INFO] [stdout]     |         in this macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `assert_aclose` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]    --> src/main.rs:367:9
[INFO] [stdout]     |
[INFO] [stdout] 367 |         assert_aclose!(fd, d_traction, 1e-8);
[INFO] [stdout]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |         |
[INFO] [stdout]     |         expected identifier, found metavariable
[INFO] [stdout]     |         in this macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `assert_aclose` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]   --> examples/ex1.rs:72:9
[INFO] [stdout]    |
[INFO] [stdout] 72 |         assert_close_l2!(&av, &ev, 1e-5);
[INFO] [stdout]    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]    |         |
[INFO] [stdout]    |         expected identifier, found metavariable
[INFO] [stdout]    |         in this macro invocation
[INFO] [stdout]    |
[INFO] [stdout]    = note: this error originates in the macro `assert_close_l2` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]    --> src/training/node_estimation/multi_kde/gaussian_kde.rs:125:9
[INFO] [stdout]     |
[INFO] [stdout] 125 |         assert_close_l1!(&result, &expected, 0.0000001);
[INFO] [stdout]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |         |
[INFO] [stdout]     |         expected identifier, found metavariable
[INFO] [stdout]     |         in this macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `assert_close_l1` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]   --> src/training/node_estimation/multi_kde/gaussian_kernel_estimate.rs:82:9
[INFO] [stdout]    |
[INFO] [stdout] 82 |         assert_close_l1!(&result, &expected, 0.0000001)
[INFO] [stdout]    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]    |         |
[INFO] [stdout]    |         expected identifier, found metavariable
[INFO] [stdout]    |         in this macro invocation
[INFO] [stdout]    |
[INFO] [stdout]    = note: this error originates in the macro `assert_close_l1` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: expected identifier, found metavariable
[INFO] [stdout]    --> src/training/node_estimation/multi_kde/mod.rs:211:9
[INFO] [stdout]     |
[INFO] [stdout] 211 |         assert_close_l1!(&Array1::from_vec(peaks), &Array1::from_vec(expected), 0.4)
[INFO] [stdout]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |         |
[INFO] [stdout]     |         expected identifier, found metavariable
[INFO] [stdout]     |         in this macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `assert_close_l1` (in Nightly builds, run with -Z macro-backtrace for more info)

These macros come from the ndarray-linalg crate, and AFAICT they haven't changed since 2019.
https://github.com/rust-ndarray/ndarray-linalg/blob/master/ndarray-linalg/src/assert.rs

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

Possibly #137517, but I haven't performed any bisection or minimization.

@mejrs
Copy link
Contributor

mejrs commented Apr 23, 2025

I've reproduced it locally with the Cohesive-Zone-Argmin-Mirror example, will try to minimize. The regression is present on rustc 1.88.0-nightly (6bc57c6bf 2025-04-22) too.

@mejrs
Copy link
Contributor

mejrs commented Apr 23, 2025

Minimized:

Other crate (let's call it some_crate):

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

make_macro!(my_function);

pub fn my_function() {}

Main crate:

use some_crate::some_macro;

fn main() {
    some_macro!();
}

I can't figure out how to inline into one crate; that makes it fail on both stable and beta:

PS C:\Users\bruno\Rust\my_module> rustup default stable && cargo check
info: using existing install for 'stable-x86_64-pc-windows-msvc'
info: default toolchain set to 'stable-x86_64-pc-windows-msvc'

  stable-x86_64-pc-windows-msvc unchanged - rustc 1.86.0 (05f9846f8 2025-03-31)

    Checking my_module v0.1.0 (C:\Users\bruno\Rust\my_module)
error: expected identifier, found `my_function`
  --> src\main.rs:5:25
   |
5  |                 $crate::$function();
   |                         ^^^^^^^^^ expected identifier
...
16 |     some_macro!();
   |     ------------- in this macro invocation
   |
   = note: this error originates in the macro `some_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `my_module` (bin "my_module") due to 1 previous error
PS C:\Users\bruno\Rust\my_module> rustup default beta && cargo check
info: using existing install for 'beta-x86_64-pc-windows-msvc'
info: default toolchain set to 'beta-x86_64-pc-windows-msvc'

  beta-x86_64-pc-windows-msvc unchanged - rustc 1.87.0-beta.1 (45165c82a 2025-04-01)

    Checking my_module v0.1.0 (C:\Users\bruno\Rust\my_module)
error: expected identifier, found metavariable
  --> src\main.rs:5:25
   |
5  |                 $crate::$function();
   |                         ^^^^^^^^^ expected identifier, found metavariable
...
16 |     some_macro!();
   |     ------------- in this macro invocation
   |
   = note: this error originates in the macro `some_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `my_module` (bin "my_module") due to 1 previous error

@mejrs
Copy link
Contributor

mejrs commented Apr 23, 2025

Possibly #137517, but I haven't performed any bisection or minimization.

Checks out; I bisect to rustc 1.87.0-nightly (287487624 2025-02-28) and rustc 1.87.0-nightly (8c392966a 2025-03-01). The change in that PR's error messages also look like the change in the messages in my message above.

cc @nnethercote

@fmease fmease added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue S-has-bisection Status: A bisection has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 23, 2025
@fmease fmease added the A-parser Area: The lexing & parsing of Rust source code to an AST label Apr 23, 2025
@jieyouxu
Copy link
Member

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

@jieyouxu
Copy link
Member

jieyouxu commented May 5, 2025

Closing this as an intentional breaking change; relnotes against 1.87.0 is tracked in #140241.

@jieyouxu jieyouxu closed this as completed May 5, 2025
@jieyouxu jieyouxu removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 10, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-parser Area: The lexing & parsing of Rust source code to an AST 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 S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants