danielhenrymantilla / lending-iterator.rs

Lending iterators on stable Rust
https://docs.rs/lending-iterator
Apache License 2.0
78 stars 4 forks source link

MSRV Doesn't seem right #4

Open kiranshila opened 2 years ago

kiranshila commented 2 years ago

Hey there, awesome package! I have a quick question about the MSRV.

I'm following the docs to impl LendingIterator for my own type, where in the docs it mentions:

trait LendingIterator {
    type Item<'next>
    where
        Self : 'next,
    ;
...

For my type I've implemented

#[gat]
impl<'db> LendingIterator for ReadHalf<'db> {
    type Item<'next> = PsrdadaResult<&'next [i8]>
    where
        Self: 'next;
...

This works fine in Rust 1.61.0, but anything earlier (down to your stated MSRV of 1.57.0) I get

error: expected one of `!`, `+`, `::`, or `;`, found keyword `where`
   --> /home/kiran/.cargo/git/checkouts/psrdada-rs-960163a6f839822c/489137d/src/lib.rs:286:5
    |
284 | impl<'db> LendingIterator for ReadHalf<'db> {
    |                                             - while parsing this item list starting here
285 |     type Item<'next> = PsrdadaResult<&'next [i8]>
    |                                                  - expected one of `!`, `+`, `::`, or `;`
286 |     where
    |     ^^^^^ unexpected token
...
332 | }
    | - the item list ends here

Any help would be appreciated.

kiranshila commented 2 years ago

I got rid of the where line and things seem to work fine, so disregard. Haha.

danielhenrymantilla commented 2 years ago

Hmm reopening since this indeed should not happen. I think the issue is that the order/location of the where clause evolved, and you are using the more recent one: could you try doing something like:

type Item<'next>
where
    Self : 'next,
=
    PsrdadaResult<&'next [i8]>
;

If it works with that, then you can indeed close as completed 🙂 else, I'll look into it.