Skip to content
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

Type inference works incorrectly with HRTB and closures #50973

Closed
oxalica opened this issue May 22, 2018 · 3 comments
Closed

Type inference works incorrectly with HRTB and closures #50973

oxalica opened this issue May 22, 2018 · 3 comments

Comments

@oxalica
Copy link
Contributor

oxalica commented May 22, 2018

I'm trying to make an alias for a trait with HRTB. But it causes type (lifetime of the argument) mismatch when working with closures.

Weirdly, when I write the hint _: &_, which seems hint nothing about lifetimes, it works again.

Here's the detail.

https://play.rust-lang.org/?gist=0fb0af047d432f2aa06782152661507a&version=nightly&mode=debug

@vitalyd
Copy link

vitalyd commented May 22, 2018

See #41078

@oxalica
Copy link
Contributor Author

oxalica commented May 23, 2018

Yeah, the compiler inferred some lifetime but not forall lifetime.

But it confused me that if I move the bound out of trait, like check2(), all of them work well.

@Mark-Simulacrum
Copy link
Member

Yes, I believe this is a duplicate of #41078. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants