Skip to content

One of tests is broken #15

@ignatenkobrain

Description

@ignatenkobrain
[  101s] ---- src/cfg.rs - if_cfg (line 54) stdout ----
[  101s] error: unexpected end of macro invocation
[  101s]  --> src/cfg.rs:59:2
[  101s]   |
[  101s] 6 | })
[  101s]   |  ^ missing tokens in macro arguments
[  101s] 
[  101s] error: aborting due to previous error
[  101s] 
[  101s] Couldn't compile the test.
[  101s] 
[  101s] failures:
[  101s]     src/cfg.rs - if_cfg (line 54)

Activity

cuviper

cuviper commented on Feb 18, 2020

@cuviper

I believe this is a consequence of a change to meta parsing that became stable in Rust 1.40.
rust-lang/rust#63674

rust-mac/src/cfg.rs

Lines 56 to 59 in 66afc66

/// # fn main() {
/// if_cfg!(test {
/// println!("Crate built as a test suite");
/// })

So the whole test { ... } now gets consumed by the $cfg:meta matcher, and then the macro thinks it's missing the $t:block.

There was a crater run for that Rust change which showed 0 regressions. However, the mac crate was masked because of existing errors from deny(warnings):

[INFO] [stderr]     Checking mac v0.1.1 (/opt/rustwide/workdir)
[INFO] [stderr] error: `...` range patterns are deprecated
[INFO] [stderr]   --> src/matches.rs:42:41
[INFO] [stderr]    |
[INFO] [stderr] 42 |         matches!(bar.as_bytes()[1], b'0'... b'9')
[INFO] [stderr]    |                                         ^^^ help: use `..=` for an inclusive range
[INFO] [stderr]    |
[INFO] [stderr] note: lint level defined here
[INFO] [stderr]   --> src/lib.rs:1:24
[INFO] [stderr]    |
[INFO] [stderr] 1  | #![cfg_attr(test, deny(warnings))]
[INFO] [stderr]    |                        ^^^^^^^^
[INFO] [stderr]    = note: `#[deny(ellipsis_inclusive_range_patterns)]` implied by `#[deny(warnings)]`
[INFO] [stderr] 
[INFO] [stderr] error: aborting due to previous error
[INFO] [stderr] 
[INFO] [stderr] error: Could not compile `mac`.

I'll note this upstream for posterity, but I'm sure it's too late to fix this.

If you care to change syntax, maybe you can use a separator like $cfg:meta => $t:block.

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

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cuviper@ignatenkobrain

        Issue actions

          One of tests is broken · Issue #15 · reem/rust-mac