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

One of tests is broken #15

Open
ignatenkobrain opened this issue Feb 18, 2020 · 1 comment
Open

One of tests is broken #15

ignatenkobrain opened this issue Feb 18, 2020 · 1 comment

Comments

@ignatenkobrain
Copy link

[  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)
@cuviper
Copy link

cuviper commented Feb 18, 2020

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants