Skip to content

nom 8.0.0 take/map combinators are now FnMut but dbg_dmp only accepts Fn #1844

Open
@sebosp

Description

@sebosp

After upgrading from nom 7.1.1 to 8.0.0 on a crate it started to fail.
The CHANGELOG.md points to map combinator taking now FnMut.
The same appears to be the case for take, if I want to use dbg_dmp it seems the signature needs to be adjusted as well.

error[E0277]: expected a `Fn(&[u8])` closure, found `impl FnMut(&[u8]) -> Result<(&[u8], &[u8]), nom::Err<_>>`
  --> src/parser/mpq_user_data.rs:75:40
   |
75 |         let (input, content) = dbg_dmp(take(user_data_header_size as usize), "content")(input)?;
   |                                ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn(&[u8])` closure, found `impl FnMut(&[u8]) -> Result<(&[u8], &[u8]), nom::Err<_>>`
   |                                |                                                                                                                                                                                                                                                        |                                required by a bound introduced by this call
   |
   = help: the trait `Fn(&[u8])` is not implemented for `impl FnMut(&[u8]) -> Result<(&[u8], &[u8]), nom::Err<_>>`
   = note: `impl FnMut(&[u8]) -> Result<(&[u8], &[u8]), nom::Err<_>>` implements `FnMut`, but it must implement `Fn`, which is more general
note: required by a bound in `dbg_dmp`                                                                                                                                                                                                                                                      --> /home/seb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/error.rs:492:1    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions