Yeah luckily this was easy to spot at the time because the code (written before impl trait and '_) was previously returning `Box<dyn Iterator<Box<dyn Stage + 'a>> + 'a>`. I was just curious if I could omit any/both of those lifetimes now.
-
-
Ironically you *can* omit the one the compiler suggests
1 reply 0 retweets 1 like -
Anyway I'm going to just keep following the compiler's suggestions. I'm sure it'll work eventually.
1 reply 0 retweets 1 like -
Replying to @sgrif
I'm happy that this works https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=42d893e4d8b401d160ed8f94c55228e1 … but I'm still convinced that the implicit 'static when dealing with traits was an ergonomic mistake.
1 reply 0 retweets 3 likes -
Replying to @ekuber
Yes I 100% agree. I'm also pretty sure it's not really documented anywhere. I learned about it from some friends on the lang team
1 reply 0 retweets 1 like -
Replying to @sgrif
The or linked earlier (and it's predecessors) aim at documenting it, as well as teaching that 'static can mean "owned", but that later point still needs a bit of work.
1 reply 0 retweets 0 likes -
I just checked and this is going to be the new outputpic.twitter.com/4gD1oeHIRc
1 reply 0 retweets 2 likes -
Replying to @ekuber
Certainly better. Now if it can just recommend a suggestion that isn't nonsense ;)
1 reply 0 retweets 0 likes -
Replying to @sgrif
Working on it. Trying things out but it'll be always a guess, because by the time we have the lifetimes we cannot tie those back to the exact part of the type.
1 reply 0 retweets 1 like -
You can get quite far with reconstructing it and infer things from context (like suggesting '_ on all dyn/impl traits) but for more complex cases we'll still have something slightly incorrect, I fear. Until we refactor the lifetime analysis to hold on to more type data for errors
1 reply 0 retweets 1 like
Once the error is suggesting + '_ +'_ we should just send them to discord lol
-
-
-
- 9 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.