-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clone error in closure to prevent compiler lifetime errors. #3
Conversation
There's a bit more of an explanation of what's going on here in this issue rust-lang/rust#81460. The gist is we added the impl I've known about this issue since it popped up in crater but haven't fixed it yet because I mistakenly assumed it was in test code and wouldn't affect anyone, apologies for that! 😬
I'm guessing this is because the reporting logic built into |
The thing I don't get about issue rust-lang/rust#81460 (or rather, the error) is the following:
As of 1.51 we have the following implementation for
Still no problems. The signature of That said, I think I get your explanation: because a new |
Co-authored-by: Jane Lusby <[email protected]>
Here is a link to the relevant repo, which branches |
I think you hit the nail on the head with this explanation, but Though I don't really understand why the function version here works... my best guess is that either the elided lifetime influences auto deref behavior with resolving the method or I really still don't understand how lifetimes work 🥴 |
FWIW, it works when I add explicit lifetime annotations to the closure: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2a0f2f0e40b8c2942d58d4ffdaaadcf6
Preaching to the choir here :). |
Presently, if you build
simple-eyre
fromcrates.io
, you get the following compiler error:I don't actually understand why
clone()
fixes this, but it does. I was test-drivingsimple-eyre
to see if it fits my needs, and while it doesn't atm (plaineyre
actually uses less.text
:o), I figured I should make a PR :).