Can you give me a repro? I've been touching this recently https://github.com/rust-lang/rust/pull/72804 …, but it might not cover your case.
-
-
-
Honestly thought I'd be able to pare it down more than this. The intermediate iter struct is important to get it to give the bad suggestion. Couldn't reduce down to returning `self.0.iter()` directly. https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=62414e75e13830af0ae63570662e0385 …
1 reply 0 retweets 0 likes -
With the unrelated compiler error removed https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2b665a6403bd4fa87ea51da5230550d8 …
1 reply 0 retweets 1 like -
Replying to @sgrif
I see what happens... The suggestion is currently naive and only works well if there's only one inferred 'static, but here there are two and I wrote no code to account for them.
1 reply 0 retweets 3 likes -
Great repro case, I'll see if I can do something about it.
1 reply 0 retweets 4 likes -
Replying to @ekuber
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.
1 reply 0 retweets 1 like -
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
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
-
-
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 - 15 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.