-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Closure inference is destroyed by wrappers #29834
Comments
Overloading inference evaluates a function in visitor order, so this is expected. |
I mean, even without closures: struct Foo;
impl Foo {
fn stuff(self) {}
}
fn compiles() {
let mut x = None;
loop {
x = Some(Foo);
if let Some(s) = x { s.stuff(); }
}
}
fn does_not_compile() {
let mut x = None;
loop {
if let Some(s) = x { s.stuff(); } //~ ERROR the type of this value must be known
x = Some(Foo);
}
}
fn main() {} |
Can you reopen this? It merits more discussion I think. edit: edited OP |
You can keep this issue closed as a duplicate of #25165. |
Your second issue is different enough. Could you edit your OP to represent that? From my investigation, the problem is that we don't relate the return type of |
@arielb1 I think that downward propagation is always supposed to happen, this looks like a missing case. |
Duplicate of #20841. Closing and nominating that one. |
This doesn't work:
yet without the wrapper it works just fine:
The text was updated successfully, but these errors were encountered: