Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Future incompatibility: trailing semicolon in macro used in expression position (currently nightly/beta-only) #23

Open
Ltrlg opened this issue Jan 26, 2023 · 5 comments · May be fixed by #24

Comments

@Ltrlg
Copy link

Ltrlg commented Jan 26, 2023

rustc --version: rustc 1.69.0-nightly (c18a5e8a5 2023-01-25)

cargo report future-incompatibilities --package buf_redux@0.8.4 after a build:

warning: trailing semicolon in macro used in expression position
   --> /home/ltrlg/.cargo/registry/src/github.com-1ecc6299db9ec823/buf_redux-0.8.4/src/policy.rs:25:57
    |
25  |     ($val:expr) => ( return $crate::policy::DoRead($val); );
    |                                                         ^
...
118 |         if buffer.len() >= self.0 { do_read!(false) }
    |                                     --------------- in this macro invocation
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
    = note: macro invocations at the end of a block are treated as expressions
    = note: to ignore the value produced by the macro, add a semicolon after the invocation of `do_read`
    = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
    = note: this warning originates in the macro `do_read` (in Nightly builds, run with -Z macro-backtrace for more info)

Linked issue: rust-lang/rust#79813
According to rust-lang/rust#103418, the warning will come in stable 1.68 (2023-03-09).

@Ltrlg Ltrlg changed the title Future incompatibility: trailing semicolon in macro used in expression position (currently nightly-only) Future incompatibility: trailing semicolon in macro used in expression position (currently nightly/beta-only) Jan 26, 2023
@jianshu93
Copy link

I also notice the same warning for rust 1.69 nightly version. This will be updated soon right?

Thanks,

Jianshu

@omac777
Copy link

omac777 commented Jan 27, 2023

LOL was just dropping by to report the same issue. :)

The package `buf_redux v0.8.4` currently triggers the following future incompatibility lints:
> warning: trailing semicolon in macro used in expression position
>    --> /var/home/davidm/.cargo/registry/src/github.com-1ecc6299db9ec823/buf_redux-0.8.4/src/policy.rs:25:57
>     |
> 25  |     ($val:expr) => ( return $crate::policy::DoRead($val); );
>     |                                                         ^
> ...
> 118 |         if buffer.len() >= self.0 { do_read!(false) }
>     |                                     --------------- in this macro invocation
>     |
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
>     = note: macro invocations at the end of a block are treated as expressions
>     = note: to ignore the value produced by the macro, add a semicolon after the invocation of `do_read`
>     = note: `-A semicolon-in-expressions-from-macros` implied by `-A warnings`
>     = note: this warning originates in the macro `do_read` (in Nightly builds, run with -Z macro-backtrace for more info)

Thank you.

Aaron1011 added a commit to Aaron1011/buf_redux that referenced this issue Jan 30, 2023
Fixes abonander#23

This will allow the macro to continue to be used in expression
position (e.g. match arms), where semicolons are not allowed.
@Aaron1011 Aaron1011 linked a pull request Jan 30, 2023 that will close this issue
@jianshu93
Copy link

Nobody is maintaining the repo right. I am wondering when this fix can be submitted to crates.io

Thank,

Jianshu

@Ltrlg
Copy link
Author

Ltrlg commented Jan 31, 2023

Please be patient, @abonander has plenty of time to notice before it becomes a problem:

  1. The breaking release of rustc is still far from today (the stable one enabling the warning is not even published).
  2. The fix will be semver-compatible with the latest published version of buf_redux (no hard-to-plan migration across the dependents tree, just cargo update when available on crates.io).
  3. The fix is already available: people wanting the warning to stop displaying can use a Git dependency to Remove trailing semicolon from do_read macro #24 (or equivalent) until it is available on crates.io (I guess this should be fine at least for nightly/beta users).

@oherrala
Copy link

oherrala commented Feb 14, 2023

@Ltrlg It really looks like this crate is unmaintained so moving away from buf_redux or forking the project to new name is better alternative than waiting anyone to merge fixes and release new version of this crate.

If you check this repository you see there's no reaction to any pull requests or open issues since 2019. My question about maintenance status of this crate has been unanswered in #22. I also posted issue to RustSec's advisory-db: rustsec/advisory-db#1602

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants