libsip icon indicating copy to clipboard operation
libsip copied to clipboard

Update to nom 6.0.1

Open FallingSnow opened this issue 4 years ago • 6 comments
trafficstars

There are numerous errors like the one below using 6.0.0-alpha1.

error[E0277]: the trait bound `E: FromExternalError<&'a [u8], E>` is not satisfied
   --> /home/ayrton/Coding/rust/libsip/src/uri/domain.rs:77:43
    |
77  |     let (input, port) = opt::<_, _, E, _>(map_res::<_, _, _, _, E, _, _>(
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromExternalError<&'a [u8], E>` is not implemented for `E`
    | 
   ::: /home/ayrton/.cargo/registry/src/github.com-1ecc6299db9ec823/nom-6.0.1/src/combinator/mod.rs:115:37
    |
115 | pub fn map_res<I: Clone, O1, O2, E: FromExternalError<I, E2>, E2, F, G>(
    |                                     ------------------------ required by this bound in `map_res`
    |
help: consider further restricting this bound
    |
69  | pub fn parse_domain_domain<'a, E: ParseError<&'a [u8]> + FromExternalError<&'a [u8], E>>(
    |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FallingSnow avatar Dec 01 '20 03:12 FallingSnow

I'll have more time to take a look tomorrow. It would appear we need to use FromExternalError instead of ParseError in the parser function definitions. I'll look more into and hopefully have it patched in the next couple days.

patrickisgreene avatar Dec 01 '20 15:12 patrickisgreene

I've had some time to look into this more, It's coming from the extensive use of the map_res macro. It appears that map_res requires an implementation of FromExternalError.

I wont have time to work on this myself in the foreseeable future but I would gladly accept a PR request with this fix

patrickisgreene avatar Dec 05 '20 19:12 patrickisgreene

@KalitaAlexey Do you have the time to help us solve these FromExternalError issues?

FallingSnow avatar Dec 06 '20 04:12 FallingSnow

I didn't even see the message. I'll see if I can do it. What is the reason going from stable nom to alpha version?

KalitaAlexey avatar Dec 22 '20 08:12 KalitaAlexey

Ping @bytebuddha ^

FallingSnow avatar Dec 30 '20 18:12 FallingSnow

Hey Sorry I haven't replied, I'm out in the country on a hunting trip, and my phone's signal keeps dropping unless I'm on top of the mountain.

Just now I Quickly tried to clone libsip and run cargo check & cargo test and it compiles without issue, "=6.0.0-alpha1" was the current nom version when i last worked on this library, And it seems to compile just fine now?

I'm coming back to civilization at the end of next week, and will have some time to look at this again, I'm sorry for the long wait for a reply

patrickisgreene avatar Jan 02 '21 18:01 patrickisgreene