rust-bakery / nom

Rust parser combinator framework
MIT License
9.18k stars 792 forks source link

A fix has to be implemented by those dependencies #1727

Closed ghost closed 2 months ago

ghost commented 4 months ago

Hello, and thank you for submitting an issue to nom!

First, please note that, for family reasons, I have limited time to work on nom, so following the advice here will make sure I will quickly understand your problem and answer as soon as possible. Second, if I don't get to work on your issue quickly, that does not mean I don't consider it important or useful. Major version releases happen once a year, and a lot of fixes are done for the occasion, once I have had time to think of the right solution. So I will get back to you :)

Prerequisites

Here are a few things you should provide to help me understand the issue:

Test case

Please provide a short, complete (with crate import, etc) test case for the issue, showing clearly the expected and obtained results.

Example test case:


The problem is with a package which contains code that will be rejected by a future version of Rust
Finished release [optimized] target(s) in 0.19s
warning: the following packages contain code that will be rejected by a future version of Rust: cexpr v0.3.6, nom v4.2.3
note:
To solve this problem, you can try the following approaches:

- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.

cexpr v0.3.6 has the following newer versions available: 0.4.0, 0.5.0, 0.6.0
nom v4.2.3 has the following newer versions available: 5.0.0-alpha1, 5.0.0-alpha2, 5.0.0-beta1, 5.0.0-beta2, 5.0.0-beta3, 5.0.0, 5.0.1, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 6.0.0-alpha1, 6.0.0-alpha2, 6.0.0-alpha3, 6.0.0-beta1, 6.0.0-beta2, 6.0.0-beta3, 6.0.0-beta4, 6.0.0-beta5, 6.0.0, 6.0.1, 6.1.0, 6.1.1, 6.1.2, 6.2.0, 6.2.1, 6.2.2, 7.0.0-alpha1, 7.0.0-alpha2, 7.0.0-alpha3, 7.0.0, 7.1.0, 7.1.1, 7.1.2, 7.1.3

- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - nom@4.2.3
  - Repository: https://github.com/Geal/nom
  - Detailed warning command: `cargo report future-incompatibilities --id 1 --package nom@4.2.3`

Below is what that command reports:
The following warnings were discovered during the build. These warnings are an
indication that the packages contain code that will become an error in a
future release of Rust. These warnings typically cover changes to close
soundness problems, unintended or undocumented behavior, or critical problems
that cannot be fixed in a backwards-compatible fashion, and are not expected
to be in wide use.

Each warning should contain a link for more information on what the warning
means and how to resolve it.

To solve this problem, you can try the following approaches:

- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.

cexpr v0.3.6 has the following newer versions available: 0.4.0, 0.5.0, 0.6.0
nom v4.2.3 has the following newer versions available: 5.0.0-alpha1, 5.0.0-alpha2, 5.0.0-beta1, 5.0.0-beta2, 5.0.0-beta3, 5.0.0, 5.0.1, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 6.0.0-alpha1, 6.0.0-alpha2, 6.0.0-alpha3, 6.0.0-beta1, 6.0.0-beta2, 6.0.0-beta3, 6.0.0-beta4, 6.0.0-beta5, 6.0.0, 6.0.1, 6.1.0, 6.1.1, 6.1.2, 6.2.0, 6.2.1, 6.2.2, 7.0.0-alpha1, 7.0.0-alpha2, 7.0.0-alpha3, 7.0.0, 7.1.0, 7.1.1, 7.1.2, 7.1.3

- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - cexpr@0.3.6
  - Repository: https://github.com/jethrogb/rust-cexpr
  - Detailed warning command: `cargo report future-incompatibilities --id 1 --package cexpr@0.3.6`

  - nom@4.2.3
  - Repository: https://github.com/Geal/nom
  - Detailed warning command: `cargo report future-incompatibilities --id 1 --package nom@4.2.3`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

The package `nom v4.2.3` currently triggers the following future incompatibility lints:
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:495:3
>     |
> 495 |   map!(i, be_u8, |x| x as i8)
>     |   --------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:501:3
>     |
> 501 |   map!(i, be_u16, |x| x as i16)
>     |   ----------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |       map!(__impl $i, call!($f), $g);
>     |                                     ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:508:3
>     |
> 508 | /   map!(i, be_u24, |x| if x & 0x80_00_00 != 0 {
> 509 | |     (x | 0xff_00_00_00) as i32
> 510 | |   } else {
> 511 | |     x as i32
> 512 | |   })
>     | |____- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:518:3
>     |
> 518 |   map!(i, be_u32, |x| x as i32)
>     |   ----------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:524:3
>     |
> 524 |   map!(i, be_u64, |x| x as i64)
>     |   ----------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:531:3
>     |
> 531 |   map!(i, be_u128, |x| x as i128)
>     |   ------------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:619:3
>     |
> 619 |   map!(i, le_u8, |x| x as i8)
>     |   --------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:625:3
>     |
> 625 |   map!(i, le_u16, |x| x as i16)
>     |   ----------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |       map!(__impl $i, call!($f), $g);
>     |                                     ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:632:3
>     |
> 632 | /   map!(i, le_u24, |x| if x & 0x80_00_00 != 0 {
> 633 | |     (x | 0xff_00_00_00) as i32
> 634 | |   } else {
> 635 | |     x as i32
> 636 | |   })
>     | |____- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:642:3
>     |
> 642 |   map!(i, le_u32, |x| x as i32)
>     |   ----------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:648:3
>     |
> 648 |   map!(i, le_u64, |x| x as i64)
>     |   ----------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:666:35
>     |
> 666 |     map!(__impl $i, call!($f), $g);
>     |                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:655:3
>     |
> 655 |   map!(i, le_u128, |x| x as i128)
>     |   ------------------------------- 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 `map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\sequence.rs:46:60
>     |
> 46  |       tuple_parser!($i, ($($parsed),*), call!($e), $($rest)*);
>     |                                                              ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:817:3
>     |
> 817 | /   recognize!(input,
> 818 | |     tuple!(
> 819 | |       opt!(alt!(char!('+') | char!('-'))),
> 820 | |       alt!(
> ...   |
> 830 | |     )
> 831 | |   )
>     | |___- 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 `tuple_parser`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `tuple_parser` which comes from the expansion of the macro `recognize` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>     --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\macros.rs:1005:24
>      |
> 1005 |       opt!($i, call!($f));
>      |                          ^
>      |
>     ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:817:3
>      |
> 817  | /   recognize!(input,
> 818  | |     tuple!(
> 819  | |       opt!(alt!(char!('+') | char!('-'))),
> 820  | |       alt!(
> ...    |
> 830  | |     )
> 831  | |   )
>      | |___- 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 `opt`
>      = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>      = note: this warning originates in the macro `opt` which comes from the expansion of the macro `recognize` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\sequence.rs:69:49
>     |
> 69  |       tuple_parser!($i, ($($parsed),*), call!($e));
>     |                                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:817:3
>     |
> 817 | /   recognize!(input,
> 818 | |     tuple!(
> 819 | |       opt!(alt!(char!('+') | char!('-'))),
> 820 | |       alt!(
> ...   |
> 830 | |     )
> 831 | |   )
>     | |___- 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 `tuple_parser`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `tuple_parser` which comes from the expansion of the macro `recognize` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\sequence.rs:69:49
>     |
> 69  |       tuple_parser!($i, ($($parsed),*), call!($e));
>     |                                                   ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:817:3
>     |
> 817 | /   recognize!(input,
> 818 | |     tuple!(
> 819 | |       opt!(alt!(char!('+') | char!('-'))),
> 820 | |       alt!(
> ...   |
> 830 | |     )
> 831 | |   )
>     | |___- 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 `tuple_parser`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `tuple_parser` which comes from the expansion of the macro `recognize` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\verbose_errors.rs:239:57
>     |
> 239 |     flat_map!(__impl $i, call!($f), $submac!($($args)*));
>     |                                                         ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:846:3
>     |
> 846 |   flat_map!(input, recognize_float, parse_to!(f32))
>     |   ------------------------------------------------- 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 `flat_map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `flat_map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\verbose_errors.rs:233:69
>     |
> 233 |     flat_map!(__impl $i, $submac!($($args)*), $submac2!($($args2)*));
>     |                                                                     ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:861:3
>     |
> 861 |   flat_map!(input, call!(recognize_float), parse_to!(f32))
>     |   -------------------------------------------------------- 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 `flat_map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `flat_map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\verbose_errors.rs:233:69
>     |
> 233 |     flat_map!(__impl $i, $submac!($($args)*), $submac2!($($args2)*));
>     |                                                                     ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:875:3
>     |
> 875 |   flat_map!(input, call!(recognize_float), parse_to!(f64))
>     |   -------------------------------------------------------- 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 `flat_map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `flat_map` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: trailing semicolon in macro used in expression position
>    --> C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\verbose_errors.rs:233:69
>     |
> 233 |     flat_map!(__impl $i, $submac!($($args)*), $submac2!($($args2)*));
>     |                                                                     ^
>     |
>    ::: C:\Users\huertaga\.cargo\registry\src\index.crates.io-6f17d22bba15001f\nom-4.2.3\src\nom.rs:890:3
>     |
> 890 |   flat_map!(input, call!(recognize_float), parse_to!(f64))
>     |   -------------------------------------------------------- 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 `flat_map`
>     = note: `#[allow(semicolon_in_expressions_from_macros)]` on by default
>     = note: this warning originates in the macro `flat_map` (in Nightly builds, run with -Z macro-backtrace for more info)
epage commented 4 months ago

Sounds like you are getting nom through cexpr.

The version of cexpr you are using is over 4 years old. The fix for this was in #1657 which was released in v5.1.3 and v6.2.2 .

If you upgrade to cexpr 0.4.0, 0.5.0, or 0.6.0, then this should be resolved.

ghost commented 4 months ago

Thanks for your soon response.

I think something else makes this invocation, because these are statements where is used command use, in a program.

use std::os::raw::c_char; use std::ffi::CStr; use calamine::{open_workbook, Reader, Range, DataType, Xlsx, XlsxError}; use std::error::Error; use csv::Writer; use std::fs::File; use std::io::BufWriter; use xlsxwriter::*;

This is Cargo.toml content: [package] name = "excel-merger" version = "0.1.0" edition = "2021"

See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies] calamine = "0.23.1" xlsxwriter = "0.1.0" csv = "1.1"

[lib] name = "excel_merger" path = "src/lib.rs" crate-type = ["cdylib"]

How can I know where explicitly is invoked cexpr?

epage commented 4 months ago

Run the command:

$ cargo tree --invert --package cexpr

And it will show you the dependency tree that leads to cexpr being a dependency.

ghost commented 4 months ago

This is the result:

cexpr v0.3.6 └── bindgen v0.51.1 [build-dependencies] └── libxlsxwriter-sys v0.8.7 └── xlsxwriter v0.1.0 └── excel-merger v0.1.0 (D:\Rust\excel-merger)

And I looked for the last xlsxwriter version. This is v0.6.0, but program is not compiling now. I am going to deal with this:

error[E0599]: no method named add_worksheet found for enum Result in the current scope --> src/lib.rs:85:56 85 let mut worksheet_xlsxwriter = workbook_xlsxwriter.add_worksheet(None).unwrap(); ^^^^^^^^^^^^^ method not found in Result<Workbook, XlsxError>
note: the method add_worksheet exists on the type xlsxwriter::Workbook --> C:\Users\huertaga.cargo\registry\src\index.crates.io-6f17d22bba15001f\xlsxwriter-0.6.0\src\workbook.rs:157:5 157 / pub fn add_worksheet<'a>( 158 &'a self, 159 sheet_name: Option<&str>, 160 ) -> Result<Worksheet<'a>, XlsxError> { _____^ help: use the ? operator to extract the xlsxwriter::Workbook value, propagating a Result::Err value to the caller
85 let mut worksheet_xlsxwriter = workbook_xlsxwriter?.add_worksheet(None).unwrap();
+
error[E0599]: no method named close found for enum Result in the current scope --> src/lib.rs:116:25 116 workbook_xlsxwriter.close().unwrap(); ^^^^^ method not found in Result<Workbook, XlsxError>
note: the method close exists on the type xlsxwriter::Workbook --> C:\Users\huertaga.cargo\registry\src\index.crates.io-6f17d22bba15001f\xlsxwriter-0.6.0\src\workbook.rs:277:5 277 pub fn close(mut self) -> Result<(), XlsxError> { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the ? operator to extract the xlsxwriter::Workbook value, propagating a Result::Err value to the caller
116 workbook_xlsxwriter?.close().unwrap();
+
stefnotch commented 4 months ago

I believe this can be closed, right?

ghost commented 4 months ago

I ask for apologies. I could not enter into GitHub link, because I am going to be at work in the office during two weeks. I hope as soon as I can be at HomeOffice, I can do it.

Regards.

De: stefnotch @.> Enviado el: martes, 27 de febrero de 2024 03:56 a. m. Para: rust-bakery/nom @.> CC: Gabriel Huerta Araujo @.>; Author @.> Asunto: Re: [rust-bakery/nom] A fix has to be implemented by those dependencies (Issue #1727)

No suele recibir correos electrónicos de @.**@.>. Por qué esto es importantehttps://aka.ms/LearnAboutSenderIdentification

I believe this can be closed, right?

— Reply to this email directly, view it on GitHubhttps://github.com/rust-bakery/nom/issues/1727#issuecomment-1966180553, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFL3AT3VJZSRHBDX2EMXZOTYVWUUJAVCNFSM6AAAAABC2XKAK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRWGE4DANJVGM. You are receiving this because you authored the thread.Message ID: @.**@.>>

ghost commented 3 months ago

This is the final code I could make it to work.

use std::os::raw::c_char; use std::ffi::CStr; use calamine::{open_workbook, Reader, Range, DataType, Xls, Xlsx}; use calamine::Error as CalamineError; use std::error::Error; use std::convert::From; use std::fmt; use csv::Writer; use std::fs::File; use std::fs; use std::io::BufWriter; use xlsxwriter::*; use libc::c_int; use std::path::Path;

pub struct ConcreteXlsxError { message: String, code: i32, }

impl ConcreteXlsxError { pub fn new(message: String, code: i32) -> Self { ConcreteXlsxError { message, code } }

pub fn get_message(&self) -> &str {
    &self.message
}

pub fn get_code(&self) -> i32 {
    self.code
}

}

[no_mangle]

pub extern "C" fn mergeExcelFiles(file1_path: const c_char, file2_path: const c_char, output_path: *const c_char) -> c_int { merge_excel_files_wrapper::(file1_path, file2_path, output_path) }

fn merge_excel_files_wrapper(file1_path: const c_char, file2_path: const c_char, output_path: *const c_char) -> c_int {
unsafe { let file1 = CStr::from_ptr(file1_path).to_string_lossy().into_owned(); let file2 = CStr::from_ptr(file2_path).to_string_lossy().into_owned(); let output = CStr::from_ptr(output_path).to_string_lossy().into_owned();

    // Convert the XLS file to XLSX
    let xlsx_file1 = convert_xls_to_xlsx(&file1).expect("Failed to convert XLS to XLSX");

    let xlsx_file2 = convert_xls_to_xlsx(&file2).expect("Failed to convert XLS to XLSX");
    let mut row_values: Vec<String> = Vec::new();   
    let mut index = 0;      
    // Process the first workbook
    let range1 = take_range(&xlsx_file1);
    match range1 {
        Ok(range) => process_range(&mut index, &range, &mut row_values),
        Err(err) => eprintln!("Error: {}", err),
    }

    // Process the second workbook
    let range2 = take_range(&xlsx_file2);
    match range2 {
        Ok(range) => process_range(&mut index, &range, &mut row_values),
        Err(err) => eprintln!("Error: {}", err),
    }

    // Write the combined data to a new Excel or CSV file
    if output.ends_with(".csv") {
        let _ = write_data_to_csv(&mut row_values, &output);
    }
    if let Err(err) = fs::remove_file(xlsx_file2) {
        eprintln!("Error removing file: {}", err);
    }
}
0

}

[derive(Debug)]

enum MyError { CalamineError(calamine::XlsxError), CalamineErrorXls(calamine::XlsError), XlsxWriterError(xlsxwriter::XlsxError), }

impl fmt::Display for MyError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { MyError::CalamineError(err) => write!(f, "Calamine error: {}", err), MyError::CalamineErrorXls(err) => write!(f, "Calamine error: {}", err), MyError::XlsxWriterError(err) => write!(f, "XlsxWriter error: {}", err), } } }

impl Error for MyError { fn source(&self) -> Option<&(dyn Error + 'static)> { match self { MyError::CalamineError(err) => Some(err), MyError::CalamineErrorXls(err) => Some(err), MyError::XlsxWriterError(err) => Some(err), } } }

impl From for MyError { fn from(error: calamine::XlsxError) -> Self { MyError::CalamineError(error) } }

impl From for MyError { fn from(error: calamine::XlsError) -> Self { MyError::CalamineErrorXls(error) } }

impl From for MyError { fn from(error: xlsxwriter::XlsxError) -> Self { MyError::XlsxWriterError(error) } }

fn take_range(xlsfile: &str) -> Result<Range, CalamineError> { let mut workbook: Xlsx<> = open_workbook(&xls_file)?; let sheetnames: Vec<> = workbook.sheet_names().into_iter().collect();

if let Some(first_sheet_name) = sheet_names.first() {
    let range = workbook.worksheet_range(first_sheet_name)?;
    Ok(range)
} else {
    Err(CalamineError::Msg("No sheets found in the Excel file"))
}

}

fn convert_xls_to_xlsx(xls_file: &str) -> Result<String, MyError> { let mut xlsx_file = xls_file.to_string(); let extension = Path::new(xls_file) .extension() .and_then(|ext| ext.to_str()) .unwrap_or("");

if extension == "xls" { 
    // Handle .xls file
    xlsx_file = xlsx_file.replace(extension, "xlsx");
    let mut workbook: Xls<_> = open_workbook(xls_file)?;
    let sheet = workbook.sheet_names().first().cloned();
    let range = workbook
        .worksheet_range(&sheet.as_ref().unwrap())
        .expect("Failed to get worksheet range");   

    let workbook_xlsxwriter = match Workbook::new(&xlsx_file) {
        Ok(workbook) => workbook,
        Err(error) => return Err(error.into()),
    };
    let mut worksheet_xlsxwriter = workbook_xlsxwriter.add_worksheet(None)?;
    for (row_index, row_result) in range.rows().enumerate() {
        let row: Result<_, Box<dyn std::error::Error>> = Ok(row_result);
        let row = row.expect("Failed to read row");
        for (col_index, cell) in row.iter().enumerate() {
            match cell {
                calamine::DataType::Empty => {
                    worksheet_xlsxwriter.write_blank((row_index as i32).try_into().unwrap(), (col_index as i32).try_into().unwrap(), None).unwrap();
                }
                calamine::DataType::String(value) => {
                    worksheet_xlsxwriter
                        .write_string((row_index as i32).try_into().unwrap(), (col_index as i32).try_into().unwrap(), value, None)
                        .unwrap();
                }
                calamine::DataType::Float(value) => {
                    worksheet_xlsxwriter
                        .write_number((row_index as i32).try_into().unwrap(), (col_index as i32).try_into().unwrap(), *value, None)
                        .unwrap();
                }
                calamine::DataType::Int(value) => {
                    worksheet_xlsxwriter
                        .write_number((row_index as i32).try_into().unwrap(), (col_index as i32).try_into().unwrap(), *value as f64, None)
                        .unwrap();
                }
                // Handle other data types as needed
                _ => {}
            }
        }
    }
    // Close the xlsxwriter workbook
    workbook_xlsxwriter.close().map_err::<MyError, _>(Into::into)?;
} 
Ok(xlsx_file.to_string())

}

fn process_range(index: &mut i32, range: &Range, row_values: &mut Vec) {

for (i, row) in range.rows().enumerate() {
    let mut row_value = String::new();
    for (j, cell) in row.iter().enumerate() {
        if j == 0 && i > 0 {
            row_value.push_str(&({ *index += 1; index }).to_string());
        } else if let Some(cell_value) = cell.get_string() {
            if j > 0 {
                row_value.push(',');
            }
            row_value.push_str(&format!("\"{}\"", cell_value));
        }
    }
    if i > 0 {
        row_values.push(row_value);
    }
}

}

fn write_data_to_csv(data: &mut Vec, output_path: &str) -> Result<(), Box> { let file = File::create(output_path)?; let mut writer = Writer::from_writer(BufWriter::new(file));

for row in data {
    writer.write_record(&[row.to_owned()])?;
}

writer.flush()?;
Ok(())

}

With this Cargo.toml: [package] name = "excel-merger" version = "0.1.0" edition = "2021"

See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies] calamine = "0.23.1"

xlsxwriter = "0.1.0"

xlsxwriter = "0.6.0" csv = "1.1" libc = "0.2"

[lib] name = "excel_merger" path = "src/lib.rs" crate-type = ["cdylib"]