Skip to content
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

Failed to compile ring under nightly Rust (1.61.0, 9f4dc0b4d 2022-03-23) #95267

Closed
messense opened this issue Mar 24, 2022 · 12 comments · Fixed by #95390
Closed

Failed to compile ring under nightly Rust (1.61.0, 9f4dc0b4d 2022-03-23) #95267

messense opened this issue Mar 24, 2022 · 12 comments · Fixed by #95390
Assignees
Labels
P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@messense
Copy link
Contributor

messense commented Mar 24, 2022

Cross post from briansmith/ring#1469

    Checking ring v0.16.20
error: no rules expected the token `aarch64_apple`
   --> /root/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/ring-0.16.20/src/cpu.rs:257:13
    |
165 |     macro_rules! features {
    |     --------------------- when calling this macro
...
257 |             aarch64_apple: true,
    |             ^^^^^^^^^^^^^ no rules expected this token in macro call

error[E0425]: cannot find value `AES` in module `cpu::arm`
   --> /root/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/ring-0.16.20/src/aead/aes.rs:381:65
    |
381 |         if cpu::intel::AES.available(cpu_features) || cpu::arm::AES.available(cpu_features) {
    |                                                                 ^^^ not found in `cpu::arm`
    |
help: consider importing this constant
    |
15  | use crate::cpu::intel::AES;
    |

error[E0425]: cannot find value `PMULL` in module `cpu::arm`
   --> /root/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/ring-0.16.20/src/aead/gcm.rs:315:26
    |
315 |             || cpu::arm::PMULL.available(cpu_features)
    |                          ^^^^^ not found in `cpu::arm`

error[E0425]: cannot find value `ARMCAP_STATIC` in this scope
   --> /root/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/ring-0.16.20/src/cpu.rs:235:41
    |
235 |             if self.mask == self.mask & ARMCAP_STATIC {
    |                                         ^^^^^^^^^^^^^ not found in this scope

Works fine on stable Rust.

https://github.com/briansmith/ring/blob/9cc0d45f4d8521f467bb3a621e74b1535e118188/src/cpu.rs#L165-L224

@zjp-CN
Copy link

zjp-CN commented Mar 24, 2022

That post is written by me.
I've opened a PR briansmith/ring#1470, and made some comments there.
I'm not an expert on Rust, actually I'm an amateur programmer, and this is what I can do for now.

@ctz
Copy link
Contributor

ctz commented Mar 24, 2022

1.61.0-nightly (5f37001 2022-03-22) works so this is a very recent nightly regression.

@kaimast
Copy link

kaimast commented Mar 25, 2022

I see that too when compiling maturin

@hunjixin
Copy link

same issue on ubuntu20

@zjp-CN
Copy link

zjp-CN commented Mar 25, 2022

Maybe related to this issue.
Here is a snippet of macro with /// on the match side:

#[rustfmt::skip]
macro_rules! f {
    (
        /// ab
    ) => {};
}

fn main() {
    f!();
}

Pass with rustc 1.61.0-nightly (5f37001 2022-03-22), you can try this snippet via

rustup default nightly-2022-03-23
# nightly-2022-03-23-x86_64-unknown-linux-gnu unchanged - rustc 1.61.0-nightly (5f3700105 2022-03-22)

Failed with rustc 1.61.0-nightly (9f4dc0b 2022-03-23), you can try this snippet via

rustup default nightly-2022-03-24
# nightly-2022-03-24-x86_64-unknown-linux-gnu unchanged - rustc 1.61.0-nightly (9f4dc0b4d 2022-03-23)
error: unexpected end of macro invocation
 --> src/main.rs:9:5
  |
2 | macro_rules! f {
  | -------------- when calling this macro
...
9 |     f!();
  |     ^^^^ missing tokens in macro arguments

Surprisingly, the code can be expanded on playground with:
Expand macros in code using the nightly compiler.
1.61.0-nightly (2022-03-19 8d60bf4)

@lqd
Copy link
Member

lqd commented Mar 25, 2022

The piece of code looks surprising, but bisection lead to #95159

@zjp-CN
Copy link

zjp-CN commented Mar 25, 2022

The piece of code looks surprising, but bisection lead to #95159

@lqd

Ok, I found it 10644e0

😄

@nnethercote nnethercote self-assigned this Mar 25, 2022
@nnethercote
Copy link
Contributor

Thanks for the report. Should be an easy fix, I will get to it on Monday.

@zjp-CN
Copy link

zjp-CN commented Mar 25, 2022

I think 10644e0 is right to some extent.
Even in previous Rust version, /// stuff in the matcher is not so useful and will be ignored like normal comments //:

#[rustfmt::skip]
macro_rules! f {
    (
        /// doc
    ) => { println!("/// doc"); };
    (#[$m:meta]) => { println!("#[$m:meta]"); };
    () => { println!("()"); };
}

fn main() {
    f!(
        /// doc
    );
    f!();
}

With rustc 1.61.0-nightly (5f37001 2022-03-22) or other versions before, the result is:

#[$m:meta]
/// doc

With rustc 1.61.0-nightly (9f4dc0b 2022-03-23), the result is:

#[$m:meta]
()

@bstrie bstrie added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Mar 25, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 25, 2022
@shepmaster
Copy link
Member

Surprisingly, the code can be expanded on playground with:

Note that the playground's nightly is a few days old and cannot be upgraded because of how this issue affects ring ;-)

orhun added a commit to orhun/git-cliff that referenced this issue Mar 26, 2022
Temporary fix until the `ring` build issue is fixed.

- briansmith/ring#1469
- rust-lang/rust#95267
orhun added a commit to orhun/git-cliff that referenced this issue Mar 26, 2022
Temporary fix until the `ring` build issue is fixed.

- briansmith/ring#1469
- rust-lang/rust#95267
soulmachine added a commit to crypto-crawler/crypto-crawler-rs that referenced this issue Mar 27, 2022
@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-critical

@rustbot rustbot added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 27, 2022
@nnethercote
Copy link
Contributor

Even in previous Rust version, /// stuff in the matcher is not so useful and will be ignored like normal comments //:

That's an interesting observation! But I'm not a language expert and I never intended to change behaviour in #95159, so I will fix this problem by going back to the old behaviour.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Mar 28, 2022
…acros, r=petrochenkov

Ignore doc comments in a declarative macro matcher.

Fixes rust-lang#95267. Reverts to the old behaviour before rust-lang#95159 introduced a
regression.

r? `@petrochenkov`
@bors bors closed this as completed in 9967594 Mar 28, 2022
soulmachine added a commit to crypto-crawler/crypto-msg-parser that referenced this issue Sep 10, 2022
soulmachine added a commit to crypto-crawler/crypto-crawler-rs that referenced this issue Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

Successfully merging a pull request may close this issue.