Lifetime trouble with hidden Self when going to edition 2018 #56719
Labels
A-edition-2018
Area: The 2018 edition
A-lifetimes
Area: Lifetimes / regions
F-rust_2018_preview
`#![feature(rust_2018_preview)]`
OK, so I'm not sure this is a bug or annoyance, but it still acts a bit weird. And I don't know what to search for if it was already reported.
Anyway, let's have this code that compiles under edition 2015:
When I switch to 2018, it starts complaining that the
s
parameter ofparsed_len
needs the'a
lifetime. Well, I guess that's because ofSelf
in there (if I useParsed
instead, it is OK with it).But if I obey, the
process
no longer wants to accept the associated function, it says:expected bound lifetime parameter, found concrete lifetime
. Putting it into a closure (process(|s| Parsed::parsed_len(s))
) fixes that. Which is strange, it's still the same function, isn't it?Should it be doing this? I'd hope the
process
would still accept the associated function, even though the lifetime is on the struct, not only on the parameter.Also,
cargo fix
doesn't help with this transition (though I don't know what it should do about it).The text was updated successfully, but these errors were encountered: